4 * Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
\r
5 * ------------------------------------------------------------------------
\r
7 * GNU XBoard is free software: you can redistribute it and/or modify
\r
8 * it under the terms of the GNU General Public License as published by
\r
9 * the Free Software Foundation, either version 3 of the License, or (at
\r
10 * your option) any later version.
\r
12 * GNU XBoard is distributed in the hope that it will be useful, but
\r
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
15 * General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program. If not, see http://www.gnu.org/licenses/. *
\r
20 *------------------------------------------------------------------------
\r
21 ** See the file ChangeLog for a revision history. */
\r
23 /* Windows html help function to avoid having to link with the htmlhlp.lib */
\r
25 #include <windows.h>
\r
32 HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD_PTR data )
\r
34 PROCESS_INFORMATION helpProcInfo;
\r
35 STARTUPINFO siStartInfo;
\r
37 static int status = 0;
\r
40 if(status < 0) return NULL;
\r
43 f = fopen(helpFile, "r");
\r
52 siStartInfo.cb = sizeof(STARTUPINFO);
\r
53 siStartInfo.lpReserved = NULL;
\r
54 siStartInfo.lpDesktop = NULL;
\r
55 siStartInfo.lpTitle = NULL;
\r
56 siStartInfo.dwFlags = STARTF_USESTDHANDLES;
\r
57 siStartInfo.cbReserved2 = 0;
\r
58 siStartInfo.lpReserved2 = NULL;
\r
59 siStartInfo.hStdInput = NULL;
\r
60 siStartInfo.hStdOutput = NULL;
\r
61 siStartInfo.hStdError = debugFP;
\r
63 snprintf(buf, sizeof(buf)/sizeof(buf[0]),"Hh.exe %s", helpFile);
\r
65 // ignore the other parameters; just start the viewer with the help file
\r
66 if( CreateProcess(NULL,
\r
67 buf, /* command line */
\r
68 NULL, /* process security attributes */
\r
69 NULL, /* primary thread security attrs */
\r
70 FALSE, /* handles are inherited */
\r
71 DETACHED_PROCESS|CREATE_NEW_PROCESS_GROUP,
\r
72 NULL, /* use parent's environment */
\r
74 &siStartInfo, /* STARTUPINFO pointer */
\r
75 &helpProcInfo) /* receives PROCESS_INFORMATION */
\r
76 ) return hwnd; else return NULL;
\r
81 MyHelp(HWND hwnd, LPSTR helpFile, UINT action, DWORD_PTR data)
\r
83 static int status = 0;
\r
86 if(status < 0) return 0;
\r
89 f = fopen(helpFile, "r");
\r
97 return WinHelp(hwnd, helpFile, action, data);
\r