2002/04/28 02:06:27
[org.ibex.core.git] / src / org / xwt / plat / Win32.cc
index c99ec19..af70e1d 100644 (file)
@@ -17,7 +17,7 @@
 #include <gcj/cni.h>
 
 #include <java/lang/Integer.h>
-#include <org/xwt/util/Hash.h>
+#include <java/util/Hashtable.h>
 #include <org/xwt/Box.h>
 #include <org/xwt/Surface.h>
 #include <org/xwt/DoubleBuffer.h>
@@ -53,6 +53,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {
         return (LRESULT)surface->WndProc((jint)hwnd, (jint)iMsg, (jint)wParam, (jint)lParam);
 
     } else {
+        java::lang::System::out->print(JvNewStringLatin1("miss on hwnd "));
+        java::lang::System::out->println((jint)hwnd);
         // this is really lame -- Win32 insists on being able to call your WndProc BEFORE CreateWindow returns...
         return DefWindowProc(hwnd, iMsg, wParam, lParam);
     }
@@ -525,7 +527,7 @@ void org::xwt::plat::Win32$Win32Surface::natInit(jboolean framed) {
     hdc = (jint)GetDC((HWND)hwnd);
 }
 
-void org::xwt::plat::Win32$Win32Surface::finalize() { DeleteObject((void*)hwnd); }
+void org::xwt::plat::Win32$Win32Surface::finalize() { /* DeleteObject((void*)hwnd); */ }
 void org::xwt::plat::Win32$Win32Surface::toFront() { BringWindowToTop((HWND)hwnd); }
 void org::xwt::plat::Win32$Win32Surface::toBack() { SetWindowPos((HWND)hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); }
 void org::xwt::plat::Win32$Win32Surface::_dispose() { PostMessage((HWND)hwnd, WM_USER_DISPOSE, 0, 0); }
@@ -834,11 +836,10 @@ using namespace std;
 
 #define CLSID_STRING_SIZE 39
 
-const char XWT_friendlyName[] = "XWT ActiveX Control (Hydrogen)";
+const char XWT_friendlyName[] = "XWT ActiveX Control (build " BUILDID ")";
 const char XWT_versionIndependantProgramID[] = "XWT.ActiveX";
-const char XWT_programID[] = "XWT.ActiveX.Hydrogen";
-extern "C" const CLSID XWT_clsid = { 0xc60d6d23, 0x3a7d, 0x11d6, { 0x82, 0xf9, 0x0, 0x50, 0x56, 0xca, 0x92, 0x50 } };
-
+const char XWT_programID[] = "XWT.ActiveX (build " BUILDID ")";
+extern "C" const CLSID XWT_clsid = CLSID_STRUCT;
 static HMODULE g_hModule = NULL;    //DLL handle
 
 
@@ -1027,13 +1028,18 @@ class ShoeHorn : public IShoeHorn {
             which[0] = '0' + i;
             which[1] = '\0';
             result = RegQueryValueEx(hkey, which, NULL, &type, (BYTE*)buf, &buflen);
-            check(result == ERROR_SUCCESS, "RegQueryValueEx() failed in ShoeHorn::Load()");
+            if (result != ERROR_SUCCESS)
+                if (i == 0) {
+                    check(0, "RegQueryValueEx() failed in ShoeHorn::Load()");
+                } else {
+                    break;
+                }
             buf[buflen] = '\0';
             
             char cmdline[200];
             for(int i=0; i<200; i++) cmdline[i] = '\0';
             strncpy(cmdline, buf, 200);
-            strncpy(cmdline + strlen(cmdline), "\\xwt.exe", 200 - strlen(cmdline));
+            strncpy(cmdline + strlen(cmdline), "\\xwt-" BUILDID ".exe", 200 - strlen(cmdline));
             strncpy(cmdline + strlen(cmdline), " ", 200 - strlen(cmdline));
             strncpy(cmdline + strlen(cmdline), url, 200 - strlen(cmdline));
             
@@ -1054,7 +1060,7 @@ class ShoeHorn : public IShoeHorn {
             if (b) return S_OK;
         }
 
-        check(0, "unable to locate xwt.exe in ActiveX cache folders");
+        check(0, "unable to locate xwt-" BUILDID ".exe in ActiveX cache folders");
     }
 
     ShoeHorn() : m_cRef(1) { };