Geting Main brower window corridnates
-
I wish to work with the main window area in Internet Explorer and I want to get its coordinates. I have used the following: long lpl = 0, lpt = 0, lpw = 0, lph = 0; m_spWebBrowser2->get_Left(&lpl); m_spWebBrowser2->get_Top(&lpt); m_spWebBrowser2->get_Height(&lph); m_spWebBrowser2->get_Width(&lpw); then converted the client points to Windows points: int npl = 0, npt = 0, npr = 0, npb = 0; npt = (int) lpt; //top npl = (int) lpl; //left npr = (int) lpw + npl; //right npb = (int) lph + npt; //bottom m_spWebBrowser2->ClientToWindow(&npt, &npl); //top left m_spWebBrowser2->ClientToWindow(&npb, &npr); // bottom right Unfortunately this does not seem to work. First I noticed that the values returned for the top left corridnates of the window are not consistant. Everytime I open the browser they change position even though the browser opens in the same size and location. secondly, if I create a RECT out of these corridnates and pass that into a create dialog function the window created does not cover the whole area. RECT rctB = {npl, npt, npr, npb}; m_hwndDialog = m_dlgDialog.Create(NULL, rctB, lpWindowName, 0, 0, 0, NULL); m_dlgDialg.ShowWindow(SW_SHOW); Thanks in advnace