WinHelp invocation (server side)

Eric Pouech eric.pouech at wanadoo.fr
Sun Nov 10 05:42:48 CST 2002


 
-------------- next part --------------
Name:          wh_winhelp
ChangeLog:     implemented a wine only scheme for interprocess WinHelp message passing (server side)
License:       X11
GenDate:       2002/11/10 11:37:28 UTC
ModifiedFiles: programs/Makefile.in programs/winhelp/string.c programs/winhelp/winhelp.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/Makefile.in,v
retrieving revision 1.26
diff -u -u -r1.26 Makefile.in
--- programs/Makefile.in	18 Sep 2002 23:10:21 -0000	1.26
+++ programs/Makefile.in	10 Nov 2002 11:34:21 -0000
@@ -68,7 +72,8 @@
 # Symlinks to apps that we want to run from inside the source tree
 SYMLINKS = \
 	wineconsole.exe \
-	winedbg.exe
+	winedbg.exe \
+	winhelp.exe
 
 @MAKE_RULES@
 
@@ -121,7 +126,11 @@
 winedbg.exe$(DLLEXT): winedbg/winedbg.exe$(DLLEXT)
 	$(RM) $@ && $(LN_S) winedbg/winedbg.exe$(DLLEXT) $@
 
+winhelp.exe$(DLLEXT): winhelp/winhelp.exe$(DLLEXT)
+	$(RM) $@ && $(LN_S) winhelp/winhelp.exe$(DLLEXT) $@
+
 wineconsole/wineconsole.exe$(DLLEXT): wineconsole
 winedbg/winedbg.exe$(DLLEXT): winedbg
+winhelp/winhelp.exe$(DLLEXT): winhelp
 
 ### Dependencies:
Index: programs/winhelp/string.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winhelp/string.c,v
retrieving revision 1.3
diff -u -u -r1.3 string.c
--- programs/winhelp/string.c	14 May 2002 03:48:10 -0000	1.3
+++ programs/winhelp/string.c	10 Nov 2002 11:30:55 -0000
@@ -18,19 +18,16 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "windows.h"
-#include "winhelp.h"
-
 /* Class names */
 
-CHAR MAIN_WIN_CLASS_NAME[]       = "WHMain";
-CHAR BUTTON_BOX_WIN_CLASS_NAME[] = "WHButtonBox";
-CHAR TEXT_WIN_CLASS_NAME[]       = "WHText";
-CHAR SHADOW_WIN_CLASS_NAME[]     = "WHShadow";
-CHAR STRING_BUTTON[]             = "BUTTON";
+char MAIN_WIN_CLASS_NAME[]       = "MS_WINHELP";
+char BUTTON_BOX_WIN_CLASS_NAME[] = "WHButtonBox";
+char TEXT_WIN_CLASS_NAME[]       = "WHText";
+char SHADOW_WIN_CLASS_NAME[]     = "WHShadow";
+char STRING_BUTTON[]             = "BUTTON";
 
 /* Resource names */
-CHAR STRING_DIALOG_TEST[]    = "DIALOG_TEST";
+char STRING_DIALOG_TEST[]        = "DIALOG_TEST";
 
 /* Local Variables:    */
 /* c-file-style: "GNU" */
Index: programs/winhelp/winhelp.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winhelp/winhelp.c,v
retrieving revision 1.17
diff -u -u -r1.17 winhelp.c
--- programs/winhelp/winhelp.c	21 Oct 2002 19:18:42 -0000	1.17
+++ programs/winhelp/winhelp.c	10 Nov 2002 10:44:53 -0000
@@ -54,11 +54,11 @@
  */
 int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
 {
-    MSG    msg;
-    LONG   lHash = 0;
+    MSG         msg;
+    LONG        lHash = 0;
 
     Globals.hInstance = hInstance;
-
+    
     /* Get options */
     while (*cmdline && (*cmdline == ' ' || *cmdline == '-'))
     {
@@ -87,6 +87,14 @@
 	case 't':
             MacroTest = TRUE;
             break;
+
+        case 'x':
+            show = SW_HIDE; 
+            break;
+
+        default:
+            WINE_FIXME("Unsupported cmd line: %s\n", cmdline);
+            break;
 	}
     }
 
@@ -142,6 +150,69 @@
             RegisterClass(&class_shadow));
 }
 
+typedef struct
+{
+    WORD size;
+    WORD command;
+    LONG data;
+    LONG reserved;
+    WORD ofsFilename;
+    WORD ofsData;
+} WINHELP,*LPWINHELP;
+
+/******************************************************************
+ *		WINHELP_HandleCommand
+ *
+ *
+ */
+static LRESULT  WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
+{
+    COPYDATASTRUCT*     cds = (COPYDATASTRUCT*)lParam;
+    WINHELP*            wh;
+
+    if (cds->dwData != 0xA1DE505)
+    {
+        WINE_FIXME("Wrong magic number (%08lx)\n", cds->dwData);
+        return 0;
+    }
+
+    wh = (WINHELP*)cds->lpData;
+
+    if (wh)
+    {
+        WINE_TRACE("Got[%u]: cmd=%u data=%08lx fn=%s\n", 
+                   wh->size, wh->command, wh->data,
+                   wh->ofsFilename ? (LPSTR)wh + wh->ofsFilename : "");
+        switch (wh->command)
+        {
+        case HELP_QUIT:
+            MACRO_Exit();
+            break;
+        case HELP_FINDER:
+            /* in fact, should be the topic dialog box */
+            if (wh->ofsFilename)
+            {
+                MACRO_JumpHash((LPSTR)wh + wh->ofsFilename, "main", 0);
+            }
+            break;
+        case HELP_CONTEXT:
+        case HELP_SETCONTENTS:
+        case HELP_CONTENTS:
+        case HELP_CONTEXTPOPUP:
+        case HELP_FORCEFILE:
+        case HELP_HELPONHELP:
+        case HELP_KEY:
+        case HELP_PARTIALKEY:
+        case HELP_COMMAND:
+        case HELP_MULTIKEY:
+        case HELP_SETWINPOS:
+            WINE_FIXME("NIY\n");
+            break;
+        }
+    }
+    return 0L;
+}
+
 /***********************************************************************
  *
  *           WINHELP_CreateHelpWindow
@@ -257,6 +329,7 @@
                 WINHELP_SetupText(win->hTextWnd);
                 InvalidateRect(win->hTextWnd, NULL, TRUE);
                 SendMessage(win->hMainWnd, WM_USER, 0, 0);
+                ShowWindow(win->hMainWnd, nCmdShow);
                 UpdateWindow(win->hTextWnd);
 
 
@@ -418,8 +491,9 @@
     case WM_DESTROY:
         if (Globals.hPopupWnd) DestroyWindow(Globals.hPopupWnd);
         break;
+    case WM_COPYDATA:
+        return WINHELP_HandleCommand((HWND)wParam, lParam);
     }
-
     return DefWindowProc(hWnd, msg, wParam, lParam);
 }
 


More information about the wine-patches mailing list