몇일 삽질해서 찾았습니다.(쩝쩝)
이것가지고 몇일이나 삽질하다니... 실력의 밑바닥이 드러나더군요
IE6.0 에러라도고 하고 .. 그러더군요
http://javascript.about.com/library/bliebug.htm
http://forums.digitalpoint.com/showthread.php?t=11965
javascript 에는 이런부분에 대한 해결책이 많던데..
미처 그쪽은 찾아볼 생각도 않고...
해결책은 간단합니다.
그냥 Document.Body.ScrollTop 이렇게 찾는데...
Body대신 DocumentElement로 바꿔서 찾으시면 됩니다.
Document.DocumentElement.ScrollTop
TCppWebBroswer에서 ScrollBar의 위치를 가져오려면?
long hei;
hei=WebBroswer->OleObject.OlePropertyGet("Document").OlePropertyGet("DocumentElement").OlePropertyGet("ScrollTop");
ShowMessage(hei);
문론 모든경우에 되지는 않습니다.
Document.Body.ScrollTop
Document.DocumentElement.ScrollTop
두가지를 병행해야 할것입니다.
그럼..
장성호 님이 쓰신 글 :
: 안녕하세요
: 좋은 하루 되세요
:
: TCppWebBrowser로 scrollbar 를 제어하고 있습니다.
: scrollbar의 위치를 가져오고 설정하고...
:
: 팁게시판에 김태선님이 올려놓으신 팁을 이용했습니다.
:
http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_tip&no=575
:
http://www.codeproject.com/miscctrl/scrollbrowser.asp
:
: long __fastcall TZWebMain::GetScrollHei(TCppWebBrowser *CppWebBrowser)
: {
: HRESULT hr;
:
: IDispatch *pDisp = CppWebBrowser->Document;
: if(pDisp==NULL )return 0;
:
: // get document interface
: ::IHTMLDocument2 *pDocument = NULL;
: hr = pDisp->QueryInterface( ::IID_IHTMLDocument2, (void**)&pDocument );
: if(!SUCCEEDED( hr ))return 0;
: if(pDocument==NULL )return 0;
:
: // this is the trick!
: // take the body element from document...
: ::IHTMLElement *pBody = NULL;
: hr = pDocument->get_body( &pBody );
: if(!SUCCEEDED( hr ))return 0;
: if(pBody==NULL )return 0;
:
: // from body we can get element2 interface,
: // which allows us to do scrolling
: ::IHTMLElement2 *pElement = NULL;
: hr = pBody->QueryInterface(::IID_IHTMLElement2,(void**)&pElement);
: if(!SUCCEEDED( hr ))return 0;
: if(pElement==NULL )return 0;
:
: long scroll_height;
: pElement->get_scrollTop(&scroll_height );
:
: return scroll_height;
: }
:
:
: 그런데 문제는 위팁을 이용해서 get_scrollTop 으로
: scroll의 위치를 가져오면 항상 0 으로 나오는 사이트가 많습니다.
:
: 여기 볼랜드 포럼(
http://www.borlandforum.com)도 마찬가지구요
:
: 여러가지로 테스트 결과 한가지 현상을 발견했으니....
:
: 웹페이지 맨 위에 아래 문구가 있는경우 안되더군요
:
: < ! DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN ' > (안보여서 띄어씀)
:
: 위와같은 현상은
: webBroswer의 Border설정에도 똑같이 안 먹습니다.
:
: WebBroswer->OleObject.OlePropertyGet("Document").OlePropertyGet("Body").OlePropertyGet("style").OlePropertySet("Border","none");
:
:
: web은 잘몰라서 그런데....
: < ! DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN ' > ==> 이놈이 의미하는것이 무엇인지 알고싶구요
: 위 함수로 scrollbar의 위치를 못구하는 경우의 해결책을 알고싶습니다.
:
: 감사합니다.
:
:
: -추신-
: 첨부파일은 borlandforum.com의 html 에서
: 위 doctype에 대한 문장을 뺀경우와 그렇지 않는경우의 html파일입니다.