shdocvw: Better iexplore.exe command line handling.

This commit is contained in:
Jacek Caban 2007-09-09 20:19:03 +02:00 committed by Alexandre Julliard
parent 72060f04fe
commit 735bf5a6f7
1 changed files with 21 additions and 25 deletions

View File

@ -120,10 +120,9 @@ static void create_frame_hwnd(InternetExplorer *This)
NULL, NULL /* FIXME */, shdocvw_hinstance, This); NULL, NULL /* FIXME */, shdocvw_hinstance, This);
} }
static IWebBrowser2 *create_ie_window(LPCWSTR url) static IWebBrowser2 *create_ie_window(LPCSTR cmdline)
{ {
IWebBrowser2 *wb = NULL; IWebBrowser2 *wb = NULL;
VARIANT var_url;
InternetExplorer_Create(NULL, &IID_IWebBrowser2, (void**)&wb); InternetExplorer_Create(NULL, &IID_IWebBrowser2, (void**)&wb);
if(!wb) if(!wb)
@ -131,13 +130,26 @@ static IWebBrowser2 *create_ie_window(LPCWSTR url)
IWebBrowser2_put_Visible(wb, VARIANT_TRUE); IWebBrowser2_put_Visible(wb, VARIANT_TRUE);
V_VT(&var_url) = VT_BSTR; if(!*cmdline) {
V_BSTR(&var_url) = SysAllocString(url); IWebBrowser2_GoHome(wb);
}else {
VARIANT var_url;
DWORD len;
/* navigate to the first page */ if(!strncasecmp(cmdline, "-nohome", 7))
IWebBrowser2_Navigate2(wb, &var_url, NULL, NULL, NULL, NULL); cmdline += 7;
SysFreeString(V_BSTR(&var_url)); V_VT(&var_url) = VT_BSTR;
len = MultiByteToWideChar(CP_ACP, 0, cmdline, -1, NULL, 0);
V_BSTR(&var_url) = SysAllocStringLen(NULL, len);
MultiByteToWideChar(CP_ACP, 0, cmdline, -1, V_BSTR(&var_url), len);
/* navigate to the first page */
IWebBrowser2_Navigate2(wb, &var_url, NULL, NULL, NULL, NULL);
SysFreeString(V_BSTR(&var_url));
}
return wb; return wb;
} }
@ -190,24 +202,8 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
ExitProcess(1); ExitProcess(1);
} }
/* FIXME: there are lots of other commandline options we need to parse */ if(strcasecmp(szCommandLine, "-embedding"))
if(!strncasecmp(szCommandLine, "-nohome", 7)) { wb = create_ie_window(szCommandLine);
FIXME("skipping -nohome option\n");
szCommandLine += 8;
}
if(strcmp(szCommandLine, "-Embedding")) {
LPWSTR url;
DWORD len;
len = MultiByteToWideChar(CP_ACP, 0, szCommandLine, -1, NULL, 0);
url = shdocvw_alloc(len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szCommandLine, -1, url, len);
wb = create_ie_window(url);
shdocvw_free(url);
}
/* run the message loop for this thread */ /* run the message loop for this thread */
while (GetMessageW(&msg, 0, 0, 0)) while (GetMessageW(&msg, 0, 0, 0))