+++ /dev/null
-/*\r
- * help.h\r
- *\r
- * Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.\r
- * ------------------------------------------------------------------------\r
- *\r
- * GNU XBoard is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or (at\r
- * your option) any later version.\r
- *\r
- * GNU XBoard is distributed in the hope that it will be useful, but\r
- * WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see http://www.gnu.org/licenses/. *\r
- *\r
- *------------------------------------------------------------------------\r
- ** See the file ChangeLog for a revision history. */\r
-\r
-/* Windows html help function to avoid having to link with the htmlhlp.lib */\r
-\r
-#include <windows.h>\r
-#include <stdio.h>\r
-#include "config.h"
-#include "help.h"
-\r
-FILE *debugFP;\r
-\r
-HWND WINAPI\r
-HtmlHelp( HWND hwnd, LPCSTR helpFile, UINT action, DWORD_PTR data )\r
-{\r
- PROCESS_INFORMATION helpProcInfo;\r
- STARTUPINFO siStartInfo;\r
- char buf[100];\r
- static int status = 0;\r
- FILE *f;\r
-\r
- if(status < 0) return NULL;\r
-\r
- if(!status) {\r
- f = fopen(helpFile, "r");\r
- if(f == NULL) {\r
- status = -1;\r
- return NULL;\r
- }\r
- status = 1;\r
- fclose(f);\r
- }\r
-\r
- siStartInfo.cb = sizeof(STARTUPINFO);\r
- siStartInfo.lpReserved = NULL;\r
- siStartInfo.lpDesktop = NULL;\r
- siStartInfo.lpTitle = NULL;\r
- siStartInfo.dwFlags = STARTF_USESTDHANDLES;\r
- siStartInfo.cbReserved2 = 0;\r
- siStartInfo.lpReserved2 = NULL;\r
- siStartInfo.hStdInput = NULL;\r
- siStartInfo.hStdOutput = NULL;\r
- siStartInfo.hStdError = debugFP;\r
-\r
- snprintf(buf, sizeof(buf)/sizeof(buf[0]),"Hh.exe %s", helpFile);\r
-\r
- // ignore the other parameters; just start the viewer with the help file\r
- if( CreateProcess(NULL,\r
- buf, /* command line */\r
- NULL, /* process security attributes */\r
- NULL, /* primary thread security attrs */\r
- FALSE, /* handles are inherited */\r
- DETACHED_PROCESS|CREATE_NEW_PROCESS_GROUP,\r
- NULL, /* use parent's environment */\r
- NULL,\r
- &siStartInfo, /* STARTUPINFO pointer */\r
- &helpProcInfo) /* receives PROCESS_INFORMATION */\r
- ) return hwnd; else return NULL;\r
-}\r
-\r
-//HWND WINAPI\r
-int\r
-MyHelp(HWND hwnd, LPSTR helpFile, UINT action, DWORD_PTR data)\r
-{\r
- static int status = 0;\r
- FILE *f;\r
-\r
- if(status < 0) return 0;\r
-\r
- if(!status) {\r
- f = fopen(helpFile, "r");\r
- if(f == NULL) {\r
- status = -1;\r
- return 0;\r
- }\r
- status = 1;\r
- fclose(f);\r
- }\r
- return WinHelp(hwnd, helpFile, action, data);\r
-}\r