Pelles C forum
C language => Tips & tricks => Topic started by: TimoVJL on June 28, 2013, 06:19:37 PM
-
There was an ATL example, but it disappeared ?
It was so good, that i have try to do similar one.
-
You can use "MSCAL.Calendar" or "MSHTML:<H1>Hello World</H1>" instead of "http://forum.pellesc.de" for example.
-
Tried "OWC.Spreadsheet.9" and it works.
But now I need AtlAxGetControl()?
The ATL header files are in PSDK but they need C++.
Is there a way to make this work?
-
HRESULT __declspec(dllimport) WINAPI AtlAxGetControl(HWND hwnd, IUnknown** unk);
atlx.defLIBRARY ATL.DLL
EXPORTS
"_AtlGetVersion@4"
"_AtlAxWinInit@0"
"_AtlAxGetControl@8"
-
Thanks!!
-
I can not understand this source code.
How does C "know" that it is the browser object that needs to be called?
What else can be placed on the form (in the window)?
-
That ATL control container choose that control.
Q192560 (https://jeffpar.github.io/kbarchive/kb/192/Q192560/)
ATL Control Containment FAQ (https://docs.microsoft.com/en-us/cpp/atl/atl-control-containment-faq?view=vs-2019)
-
TimoVJL, if I open some pages with ATL browser, I have javascript error. That annoying me from many messageboxes (script error, continue?)
Do you know, how to disable it? And why original Internet Explorer don't show this.
-
I discovered, that need option Silent->true (in IWebBrowser2). But how to add it, if ATL hided all options?
-
Yes! I did it !!! (https://s.tcdn.co/fb5/980/fb598033-cd8e-31ec-a28b-e35d1692ff08/192/5.png)
I take number of guid from https://www.magnumdb.com
Another code i take from Timo sources
DEFINE_GUID(IID_IWebBrowser2,0xd30c1661,0xcdaf,0x11d0,{0x8a,0x3e,0x00,0xc0,0x4f,0xc9,0xe2,0x6e});
HRESULT __declspec(dllimport) WINAPI AtlAxGetControl(HWND h,IUnknown** pp);
///skipped
case WM_CREATE:
hr = AtlAxWinInit();
hBrowser = CreateWindowEx(WS_EX_STATICEDGE, "AtlAxWin",
"https://yandex.ru",
WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL
, 0, 0, 0, 0, hWnd,
(HMENU)IDC_BROWSER, GetModuleHandle(NULL), NULL);
AtlAxGetControl(hBrowser, &unkn);
unkn->lpVtbl->QueryInterface(unkn, &IID_IWebBrowser2, (void **)&pBrowser2);
pBrowser2->lpVtbl->put_Silent(pBrowser2,TRUE);
All works! Thanks Timo, thanks to you, I understood COM a little (can to copy-paste it).