comparison win/browser.c @ 615:f253a7559a59

Allow context menu to be shown.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 23 Mar 2008 05:15:45 +0000
parents 420c6c94abc7
children 412af8059331
comparison
equal deleted inserted replaced
614:0ab21b3b1d52 615:f253a7559a59
1 /* Browser.c 1 /* Browser.c
2 2
3 This is a Win32 C application (ie, no MFC, WTL, nor even any C++ -- just plain C) that demonstrates 3 This is a Win32 C application (ie, no MFC, WTL, nor even any C++ -- just plain C) that demonstrates
4 how to embed a browser "control" (actually, an OLE object) in your own window (in order to display a 4 how to embed a browser "control" (actually, an OLE object) in your own window (in order to display a
5 web page, or an HTML file on disk). 5 web page, or an HTML file on disk).
6 6
7 The example opens a main window with a child window into which we embed the browser object. We also 7 The example opens a main window with a child window into which we embed the browser object. We also
391 // here, instead of 'This' being a IDocHostUIHandler *). 391 // here, instead of 'This' being a IDocHostUIHandler *).
392 392
393 // We will return S_OK to tell the browser not to display its default context menu, 393 // We will return S_OK to tell the browser not to display its default context menu,
394 // or return S_FALSE to let the browser show its default context menu. For this 394 // or return S_FALSE to let the browser show its default context menu. For this
395 // example, we wish to disable the browser's default context menu. 395 // example, we wish to disable the browser's default context menu.
396 return(S_OK); 396 // return(S_OK);
397 return(S_FALSE);
397 } 398 }
398 399
399 // Called at initialization of the browser object UI. We can set various features of the browser object here. 400 // Called at initialization of the browser object UI. We can set various features of the browser object here.
400 HRESULT STDMETHODCALLTYPE UI_GetHostInfo(IDocHostUIHandler FAR* This, DOCHOSTUIINFO __RPC_FAR *pInfo) 401 HRESULT STDMETHODCALLTYPE UI_GetHostInfo(IDocHostUIHandler FAR* This, DOCHOSTUIINFO __RPC_FAR *pInfo)
401 { 402 {
728 // Actually, we're going to lie to the browser again. We're going to return our own _IOleClientSiteEx 729 // Actually, we're going to lie to the browser again. We're going to return our own _IOleClientSiteEx
729 // struct, and tell the browser that it's a IOleClientSite struct. It's ok. The first thing in our 730 // struct, and tell the browser that it's a IOleClientSite struct. It's ok. The first thing in our
730 // _IOleClientSiteEx is an embedded IOleClientSite, so the browser doesn't mind. We want the browser 731 // _IOleClientSiteEx is an embedded IOleClientSite, so the browser doesn't mind. We want the browser
731 // to continue passing our _IOleClientSiteEx pointer wherever it would normally pass a IOleClientSite 732 // to continue passing our _IOleClientSiteEx pointer wherever it would normally pass a IOleClientSite
732 // pointer. 733 // pointer.
733 // 734 //
734 // The IUnknown interface uses the same VTable as the first object in our _IOleClientSiteEx 735 // The IUnknown interface uses the same VTable as the first object in our _IOleClientSiteEx
735 // struct (which happens to be an IOleClientSite). So if the browser is asking us to match 736 // struct (which happens to be an IOleClientSite). So if the browser is asking us to match
736 // IID_IUnknown, then we'll also return a pointer to our _IOleClientSiteEx. 737 // IID_IUnknown, then we'll also return a pointer to our _IOleClientSiteEx.
737 738
738 if (!memcmp(riid, &IID_IUnknown, sizeof(GUID)) || !memcmp(riid, &IID_IOleClientSite, sizeof(GUID))) 739 if (!memcmp(riid, &IID_IUnknown, sizeof(GUID)) || !memcmp(riid, &IID_IOleClientSite, sizeof(GUID)))