Hello there.
I have a Win32 C++ Application. There is the _tWinMain(...) Method with GetMessage(...) in a while loop at the end. Before GetMessage(...) I create the main window with
HWND m_MainHwnd = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, CAxWindow::GetWndClassName(), _TEXT("http://www.-website-.com"), WS_POPUP, 0, 0, 1024, 768, NULL, NULL, m_Instance, NULL);
ShowWindow(m_MainHwnd)
If I do not create the main window, my application needs about 150K in memory.
But with creating the main window with the WebBrowser Control inside, the memory usage increases to 8500K.
But, I want to dynamically unload the main window. My _tWinMain(...) keeps running! Im unloading with
DestroyWindow(m_MainHwnd)
But the WebBrowser control won't unload and free up it's memory used!
Application memory used is still 8500K!
I can also get the WebBrowser Instance or with some additional code the WebBrowser HWND
IWebBrowser2* m_pWebBrowser2;
CAxWindow wnd = (CAxWindow)m_MainHwnd;
HRESULT hRet = wnd.QueryControl(IID_IWebBrowser2, (void**)&m_pWebBrowser2);
So I tried to free up the memory used by main window and WebBrowser control with (let's say it's experimental):
if(m_pWebBrowser2)
m_pWebBrowser2->Release();
DestroyWindow(m_hwndWebBrowser); //<-- just analogous
OleUninitialize();
No success at all.
I also created a wrapper class which creates the main window. I created a pointer and freed it up with delete:
Wrapper* wrapper = new Wrapper();
//wrapper creates main window inside and shows it
//...do some stuff
delete(wrapper);
No success. Still 8500K.
So please, how can I get rid of the main window and it's WebBrowser control and free up the memory, returning to about 150K.
Later I will recreate the window. It's a dynamically load and unload of the main window, depending on other commands.
Thanks!
Regards
Martin