Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mnemosyne.cs.du.edu!isis.cs.du.edu!ebergman From: ebergman@isis.cs.du.edu (Eric Bergman-Terrell) Subject: Prog. to call Help Manager Message-ID: <1991May18.014148.735@mnemosyne.cs.du.edu> Sender: usenet@mnemosyne.cs.du.edu (netnews admin account) Reply-To: ebergman@isis.cs.du.edu (Eric Bergman-Terrell) Organization: Nyx, Public Access Unix (sponsored by U. of Denver Math/CS dept.) Disclaimer1: Nyx is a public access Unix system run by the University of Disclaimer2: Denver for the Denver community. The University has neither Disclaimer3: control over nor responsibility for the opinions of users. Date: Sat, 18 May 91 01:41:48 GMT 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 #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