I'm very new to Visual C++ (dropped in at the deepend).
I have a small program that, in simple terms, runs Internet Explorer.
A code snippet that illustrates how it currently works:
Problem is that if a user runs the exe again, it re-uses the IEXPLORE process (visible in Task Manager) thus sharing the environment already in use - you get another IE window but not the new environment.
I believe from reading up that this seems to be default functionality. However, I need it to create a completely separate, individual Internet Explorer process (so that another IEXPLORE process would appear in Task Manager). To achieve this I believe I need to use something like the following but I don't know enough to make it work:
Any help would be much appreciated.
T
I have a small program that, in simple terms, runs Internet Explorer.
A code snippet that illustrates how it currently works:
Code:
// Obtain an IWebBrowser2 object
_bstr_t bstrAppName("InternetExplorer.Application");
CLSIDFromProgID( bstrAppName, &clsid );
CoCreateInstance( clsid, NULL, CLSCTX_SERVER, IID_IUnknown, (LPVOID*)&pInterface );
pInterface->QueryInterface( IID_IWebBrowser2, (LPVOID*)&pBrowser );
pInterface->Release();
I believe from reading up that this seems to be default functionality. However, I need it to create a completely separate, individual Internet Explorer process (so that another IEXPLORE process would appear in Task Manager). To achieve this I believe I need to use something like the following but I don't know enough to make it work:
Code:
IWebBrowser2 *pBrowser = NULL;
IClassFactory *pCF = NULL;
IUnknown *pInterface = NULL;
DWORD g_dwRegister;
// Obtain an IWebBrowser2 object
_bstr_t bstrAppName("InternetExplorer.Application");
CLSIDFromProgID( bstrAppName, &clsid );
CoGetClassObject( clsid, CLSCTX_LOCAL_SERVER, NULL, IID_IClassFactory, (LPVOID*)&pCF );
CoRegisterClassObject(clsid, (IClassFactory *) pCF, CLSCTX_LOCAL_SERVER, REGCLS_MULTI_SEPARATE, &g_dwRegister );
CoCreateInstance( clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (VOID**)&pBrowser );
pCF->CreateInstance( NULL, IID_IWebBrowser2, (VOID**)&pBrowser ); //added by tb
pCF->Release();
CoRevokeClassObject (g_dwRegister );
T