#include <windows.h>
#include <commctrl.h>
+#ifndef NO_HTMLHELP
#include <htmlhelp.h>
+#endif /* NO_HTMLHELP */
#include <stdio.h>
#include <assert.h>
#define HELP_FILE_NAME "puzzles.hlp"
#define HELP_CNT_NAME "puzzles.cnt"
+#ifndef NO_HTMLHELP
#define CHM_FILE_NAME "puzzles.chm"
+#endif /* NO_HTMLHELP */
+#ifndef NO_HTMLHELP
typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD);
-static DWORD html_help_cookie;
static htmlhelp_t htmlhelp;
static HINSTANCE hh_dll;
+#endif /* NO_HTMLHELP */
enum { NONE, HLP, CHM } help_type;
char *help_path;
const char *help_topic;
va_list ap;
va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
+ _vsnprintf(buf, 4095, fmt, ap);
dputs(buf);
va_end(ap);
}
q = strrchr(b, ':');
if (q && q >= r) r = q+1;
+#ifndef NO_HTMLHELP
/*
* Try HTML Help first.
*/
FreeLibrary(hh_dll);
}
if (htmlhelp) {
- htmlhelp(NULL, NULL, HH_INITIALIZE, (DWORD)&html_help_cookie);
help_path = dupstr(b);
help_type = CHM;
help_topic = thegame.htmlhelp_topic;
return;
}
}
+#endif /* NO_HTMLHELP */
/*
* Now try old-style .HLP.
fe->help_running = TRUE;
break;
case CHM:
+#ifndef NO_HTMLHELP
assert(help_path);
assert(htmlhelp);
if (topic) {
htmlhelp(fe->hwnd, str, HH_DISPLAY_TOPIC, 0);
fe->help_running = TRUE;
break;
+#endif /* NO_HTMLHELP */
case NONE:
assert(!"This shouldn't happen");
break;
WinHelp(fe->hwnd, help_path, HELP_QUIT, 0);
break;
case CHM:
+#ifndef NO_HTMLHELP
assert(htmlhelp);
htmlhelp(NULL, NULL, HH_CLOSE_ALL, 0);
break;
+#endif /* NO_HTMLHELP */
case NONE:
assert(!"This shouldn't happen");
break;
*/
static void cleanup_help(void)
{
- if (help_type == CHM) {
- assert(htmlhelp);
- htmlhelp(NULL, NULL, HH_UNINITIALIZE, html_help_cookie);
- }
+ /* Nothing to do currently.
+ * (If we were running HTML Help single-threaded, this is where we'd
+ * call HH_UNINITIALIZE.) */
}
static void check_window_size(frontend *fe, int *px, int *py)
}
AppendMenu(menu, MF_SEPARATOR, 0, 0);
- AppendMenu(menu, MF_ENABLED, IDM_LOAD, "Load");
- AppendMenu(menu, MF_ENABLED, IDM_SAVE, "Save");
+ AppendMenu(menu, MF_ENABLED, IDM_LOAD, "Load...");
+ AppendMenu(menu, MF_ENABLED, IDM_SAVE, "Save...");
AppendMenu(menu, MF_SEPARATOR, 0, 0);
if (thegame.can_print) {
- AppendMenu(menu, MF_ENABLED, IDM_PRINT, "Print");
+ AppendMenu(menu, MF_ENABLED, IDM_PRINT, "Print...");
AppendMenu(menu, MF_SEPARATOR, 0, 0);
}
AppendMenu(menu, MF_ENABLED, IDM_UNDO, "Undo");
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = inst;
- wndclass.hIcon = LoadIcon(inst, IDI_APPLICATION);
+ wndclass.hIcon = LoadIcon(inst, MAKEINTRESOURCE(200));
+ if (!wndclass.hIcon) /* in case resource file is absent */
+ wndclass.hIcon = LoadIcon(inst, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;