Make sure you have included: Ws2tcpip.h and have added Ws2_32.lib to the linker
macattack
Posts
-
Build ATL Server problem -
BHO reading HTML input valueI am trying to read an html page and retrieve the value of three hidden input fields sure as: VC++6.0/ATL/BHO -- Below is the code I am working with to read in the value (1500) but it is not working. I think i am missing something. HRESULT hr; TCHAR sPort[25]; IDispatch* pElemDisp = NULL; IHTMLInputHiddenElement* pElem = NULL; IHTMLElementCollection *pElemcoll; // Get the WebBrowser's document object CComPtr pDisp; HRESULT hr = m_spWebBrowser2->get_Document(&pDisp); if (FAILED(hr)) return false; CComQIPtr spHTML; spHTML = pDisp; _variant_t tagName("input"); _variant_t tagNamePort("port"); BSTR* pValuePort = NULL; spHTML->get_forms(&pElemcoll); hr = pElemColl->tags( tagName, &pElemDisp ); if ( SUCCEEDED(hr) ) { hr = pElemDisp->QueryInterface( IID_IHTMLInputHiddenElement, (void**)&pElem ); if ( SUCCEEDED(hr) ) { hr = pElem->get_value(pValuePort); if ( SUCCEEDED(hr) ) { //Set port _stprintf(sPort, _T("%s"), (LPCTSTR)pValuePort); m_sPort = (int)sPort; } pElem->Release(); } pElemDisp->Release(); } //at this point m_sPort is NULL not 1500 :-( I think I may not be handling the Element Collection object correctly. Any pointers as to where i am going wrong? Thank you for any help you can give..
-
Problem writing Browser Helper ObjectYou know that in the RGS file there are 2 CLSID's right? Did you select the correct one?
-
Geting Main brower window corridnatesI 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
-
Restricting a BHOYes but if I did that my url would need to be hardcoded. I have a product that I will be marketing and as a result mey be host on a variety of web sites. I guess I could create a hidden field and set the value to some string like: {2F94BC6A-9E91-4010-B991-EA0E22F9FED4} and test for it. But I was hoping there would be a cleaner solution.
-
Restricting a BHOI have a Browser Helper Object that contains code I want to execute after a user logs into my website and only after logging into my website. What is the best way to start the code execution? I have thought of creating a hidden field named "start" on the web page and setting the field value to some unique string. Then searching for that field and testing the for the known value. Is there a cleaner solution. Thank you in advance for your suggestions.
-
Layered ATL WindowI have a Browser Helper Object that I have created and I want it to create a Window using the API function CreateWindowEx so that I can using the window layering extended style described here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/layerwin.asp My question is how do I create a window using this API in my ATL project? I have tried creating a class that inherates from CWindows and then using the http://www.codeproject.com/w2k/QDWndTransparency.asp?print=true But this does not have the same effect. I really need a faded window using: hwnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TRANSPARENT, gszFade, gszFade, WS_POPUP | WS_VISIBLE, prc->left, prc->top, 0, 0, NULL, (HMENU)0, ghinst, NULL); My goal is to have a window placed over the browser main window that I can then draw on. Any suggestions? Thank you much, Mike