Search Results

Search found 9 results on 1 pages for 'extintor'.

Page 1/1 | 1 

  • How to access webbrowser object on this code? C++

    - by extintor
    I found this example http://www.mvps.org/user32/webhost.cab that host an Internet Explorer WebBrowser object, and it uses this code to access the object void webhostwnd::CreateEmbeddedWebControl(void) { OleCreate(CLSID_WebBrowser,IID_IOleObject,OLERENDER_DRAW,0,&site,&storage,(void**)&mpWebObject); mpWebObject->SetHostNames(L"Web Host",L"Web View"); // I have no idea why this is necessary. remark it out and everything works perfectly. OleSetContainedObject(mpWebObject,TRUE); RECT rect; GetClientRect(hwnd,&rect); mpWebObject->DoVerb(OLEIVERB_SHOW,NULL,&site,-1,hwnd,&rect); IWebBrowser2* iBrowser; mpWebObject->QueryInterface(IID_IWebBrowser2,(void**)&iBrowser); VARIANT vURL; vURL.vt = VT_BSTR; vURL.bstrVal = SysAllocString(L"http://google.com"); VARIANT ve1, ve2, ve3, ve4; ve1.vt = VT_EMPTY; ve2.vt = VT_EMPTY; ve3.vt = VT_EMPTY; ve4.vt = VT_EMPTY; iBrowser->put_Left(0); iBrowser->put_Top(0); iBrowser->put_Width(rect.right); iBrowser->put_Height(rect.bottom); iBrowser->Navigate2(&vURL, &ve1, &ve2, &ve3, &ve4); VariantClear(&vURL); iBrowser->Release(); } I don't have much experience with cpp, I want to know how to access that same ie object (to use Navigate2 for example) from a button or something like that. How could I achieve this?

    Read the article

  • When do I need to deallocate memory?

    - by extintor
    I am using this code inside a class to make a webbrowser control visit a website: void myClass::visitWeb(const char *url) { WCHAR buffer[MAX_LEN]; ZeroMemory(buffer, sizeof(buffer)); MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, url, strlen(url), buffer, sizeof(buffer)-1); VARIANT vURL; vURL.vt = VT_BSTR; vURL.bstrVal = SysAllocString(buffer); // webbrowser navigate code... VariantClear(&vURL); } I call visitWeb from another void function that gets called on the handlemessage() for the app. Do I need to do some memory deallocation here?, I see vURL is being deallocated by VariantClear but should I deallocate memory for buffer? I've been told that in another bool I have in the same app I shouldn't deallocate anything because everything clear out when the bool return true/false, but what happens on this void?

    Read the article

  • Should I use a global var or call the function every time? C++

    - by extintor
    Im using: bool GetOS(LPTSTR pszOS) { OSVERSIONINFOEX osve; BOOL bOsVersionInfoEx; ZeroMemory(&osve, sizeof(OSVERSIONINFOEX)); osve.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osve)) ) return false; TCHAR buf[80]; StringCchPrintf( buf, 80, TEXT("%u.%u.%u.%u"), osve.dwPlatformId, osve.dwMajorVersion, osve.dwMinorVersion, osve.dwBuildNumber); StringCchCat(pszOS, BUFSIZE, buf); return true; } to get the windows version, and I am planning to use pszOS every a few minutes, Should I use pszOS as a global var or call GetOS() every time? What's the best option from a performance point of view.

    Read the article

  • Weird characters at the beginning of a LPTSTR? C++

    - by extintor
    I am using this code to get the windows version: define BUFSIZE 256 bool config::GetOS(LPTSTR OSv) { OSVERSIONINFOEX osve; BOOL bOsVersionInfoEx; ZeroMemory(&osve, sizeof(OSVERSIONINFOEX)); osve.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osve)) ) return false; TCHAR buf[BUFSIZE]; StringCchPrintf(buf, BUFSIZE, TEXT("%u.%u.%u.%u"), osve.dwPlatformId, osve.dwMajorVersion, osve.dwMinorVersion, osve.dwBuildNumber); StringCchCat(OSv, BUFSIZE, buf); return true; } And I am testing it with: LPTSTR OSv= new TCHAR[BUFSIZE]; config c; c.GetOS(OSv); MessageBox(OSv, 0, 0); And in the msgbox I get something like this äì5.1.20 (where 5.1.20 is = to OSv) but the first 2 or 3 chars are some weird characters that I don't know when they came from. Even stranger, if I call that second piece again it shows it ok, it only show the weird characters the first time I execute it. Does someone has an idea what's going on here?

    Read the article

  • When do I need to deallocate memory? C++

    - by extintor
    I am using this code inside a class to make a webbrowser control visit a website: void myClass::visitWeb(const char *url) { WCHAR buffer[MAX_LEN]; ZeroMemory(buffer, sizeof(buffer)); MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, url, strlen(url), buffer, sizeof(buffer)-1); VARIANT vURL; vURL.vt = VT_BSTR; vURL.bstrVal = SysAllocString(buffer); // webbrowser navigate code... VariantClear(&vURL); } Do I need to do some memory deallocation here?, I see vURL is being deallocated by VariantClear but should I deallocate memory for buffer? I've been told that in another bool I have in the same app I shouldn't deallocate anything because everything clear out when the bool return true/false, but what happens on this void?

    Read the article

  • Edit strings vars in compiled exe? C++ win32

    - by extintor
    I want to have a few strings in my c++ app and I want to be able to edit them later in the deployed applications (the compiled exe), Is there a way to make the exe edit itself or it resources so I can update the strings value? The app checks for updates on start, so I'm thinking about using that to algo send the command when I need to edit the strings (for example the string that contains the url used to check for updates). I don't want to use anything external to the exe, I could simply use the registry but I prefer to keep everything inside the exe. I am using visual studio 2010 c++ (or any other version of ms visual c++).

    Read the article

  • How to access CWebBrowser class instance (defined in a protected class) in a different class? C++

    - by extintor
    I have been playing with this webbrowser control example I got it working and added some timers using ON_WM_TIMER. Now I would like to access the m_Browser (CWebBrowser class instance) defined inside the protected CMyBrowserView class into a different class. (for example CMyBrowserApp in the code sample) and use .Navigate and other functions. How can I do this? (im using visual studio 6 c++)

    Read the article

1