4 * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 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
33 HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD_PTR data )
\r
35 PROCESS_INFORMATION helpProcInfo;
\r
36 STARTUPINFO siStartInfo;
\r
38 static int status = 0;
\r
41 if(status < 0) return NULL;
\r
44 f = fopen(helpFile, "r");
\r
53 siStartInfo.cb = sizeof(STARTUPINFO);
\r
54 siStartInfo.lpReserved = NULL;
\r
55 siStartInfo.lpDesktop = NULL;
\r
56 siStartInfo.lpTitle = NULL;
\r
57 siStartInfo.dwFlags = STARTF_USESTDHANDLES;
\r
58 siStartInfo.cbReserved2 = 0;
\r
59 siStartInfo.lpReserved2 = NULL;
\r
60 siStartInfo.hStdInput = NULL;
\r
61 siStartInfo.hStdOutput = NULL;
\r
62 siStartInfo.hStdError = debugFP;
\r
64 snprintf(buf, sizeof(buf)/sizeof(buf[0]),"Hh.exe %s", helpFile);
\r
66 // ignore the other parameters; just start the viewer with the help file
\r
67 if( CreateProcess(NULL,
\r
68 buf, /* command line */
\r
69 NULL, /* process security attributes */
\r
70 NULL, /* primary thread security attrs */
\r
71 FALSE, /* handles are inherited */
\r
72 DETACHED_PROCESS|CREATE_NEW_PROCESS_GROUP,
\r
73 NULL, /* use parent's environment */
\r
75 &siStartInfo, /* STARTUPINFO pointer */
\r
76 &helpProcInfo) /* receives PROCESS_INFORMATION */
\r
77 ) return hwnd; else return NULL;
\r
82 MyHelp(HWND hwnd, LPSTR helpFile, UINT action, DWORD_PTR data)
\r
84 static int status = 0;
\r
87 if(status < 0) return 0;
\r
90 f = fopen(helpFile, "r");
\r
98 return WinHelp(hwnd, helpFile, action, data);
\r