ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/18/91)
Here's the program I wrote to call the help manager with the specified
.hlp filename. Further details at end.
***** phones.h: *****
#define HELP_FILENAME "phones.hlp"
long FAR PASCAL WndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
***** phones.c *****
#include <windows.h>
#include "phones.h"
#pragma argsused
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
static char *szAppName = "Telephone Roster";
WNDCLASS wndclass;
HWND hwnd;
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(hInstance, "ICON");
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
RegisterClass(&wndclass);
}
hwnd = CreateWindow(szAppName, szAppName,
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
WinHelp(hwnd, HELP_FILENAME, HELP_INDEX, NULL);
return 0;
}
long FAR PASCAL WndProc(HWND hwnd, WORD message, WORD wparam, LONG lparam)
{
if (message == WM_DESTROY)
{
WinHelp(hwnd, HELP_FILENAME, HELP_QUIT, NULL);
PostQuitMessage(0);
return 0;
}
else return DefWindowProc(hwnd, message, wparam, lparam);
}
***** Further Details: *****
1. Regardless of what icon is used by this program initially, it will
be replaced by the "?" icon of the help manager. Consequenly
don't bother making your own icon - "steal" the one in winhelp.exe
with your resource editor.
2. You'll want to change the value of HELP_FILENAME in phones.h.
3. If you include this program in the load= line in your win.ini file, you'll
be disappointed - the program doesn't start up "minimized". If anyone
solves this problem, please let me know.
Suggested .hlp files:
Telephone roster for your company
Area code list
International time zones
Postal Rates