Jacek Caban : shdocvw: Better iexplore.exe command line handling.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Sep 10 10:18:07 CDT 2007


Module: wine
Branch: master
Commit: 735bf5a6f783e12336ee5e80e83cc8b11abb565e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=735bf5a6f783e12336ee5e80e83cc8b11abb565e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Sep  9 20:19:03 2007 +0200

shdocvw: Better iexplore.exe command line handling.

---

 dlls/shdocvw/iexplore.c |   46 +++++++++++++++++++++-------------------------
 1 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c
index 3ab39ee..adcaeee 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -120,10 +120,9 @@ static void create_frame_hwnd(InternetExplorer *This)
             NULL, NULL /* FIXME */, shdocvw_hinstance, This);
 }
 
-static IWebBrowser2 *create_ie_window(LPCWSTR url)
+static IWebBrowser2 *create_ie_window(LPCSTR cmdline)
 {
     IWebBrowser2 *wb = NULL;
-    VARIANT var_url;
 
     InternetExplorer_Create(NULL, &IID_IWebBrowser2, (void**)&wb);
     if(!wb)
@@ -131,13 +130,26 @@ static IWebBrowser2 *create_ie_window(LPCWSTR url)
 
     IWebBrowser2_put_Visible(wb, VARIANT_TRUE);
 
-    V_VT(&var_url) = VT_BSTR;
-    V_BSTR(&var_url) = SysAllocString(url);
+    if(!*cmdline) {
+        IWebBrowser2_GoHome(wb);
+    }else {
+        VARIANT var_url;
+        DWORD len;
+
+        if(!strncasecmp(cmdline, "-nohome", 7))
+            cmdline += 7;
+
+        V_VT(&var_url) = VT_BSTR;
 
-    /* navigate to the first page */
-    IWebBrowser2_Navigate2(wb, &var_url, NULL, NULL, NULL, NULL);
+        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);
 
-    SysFreeString(V_BSTR(&var_url));
+        /* navigate to the first page */
+        IWebBrowser2_Navigate2(wb, &var_url, NULL, NULL, NULL, NULL);
+
+        SysFreeString(V_BSTR(&var_url));
+    }
 
     return wb;
 }
@@ -190,24 +202,8 @@ DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow)
         ExitProcess(1);
     }
 
-    /* FIXME: there are lots of other commandline options we need to parse */
-    if(!strncasecmp(szCommandLine, "-nohome", 7)) {
-	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);
-    }
+    if(strcasecmp(szCommandLine, "-embedding"))
+        wb = create_ie_window(szCommandLine);
 
     /* run the message loop for this thread */
     while (GetMessageW(&msg, 0, 0, 0))




More information about the wine-cvs mailing list