Category : C Source Code
Archive   : HELPLIB.ZIP
Filename : HELPDEMO.C
* FILE: helpdemo.c
* PURPOSE: to demonstrate the use of the helplib DLL
**********************************************************************/
#include
#include "helpdemo.h"
HANDLE hInstance; /* The Instance handle */
char szClass[10]; /* Window class name (see the .rc file) */
char szTitle[40]; /* Window title (see the .rc file) */
char szAbout[40]; /* About box string (see the .rc file */
static HWND hWnd;
long FAR PASCAL WndProc (HWND, unsigned, WORD, LONG);
BOOL NEAR Initialize( HANDLE, int );
/***********************************************************************
*Application main program.
***********************************************************************/
int PASCAL WinMain( hInst, hPrevInst, lpszCmdLine, nCmdShow )
HANDLE hInst; /* Our instance handle */
HANDLE hPrevInst; /* Previous instance of this application */
LPSTR lpszCmdLine; /* Pointer to any command line params */
int nCmdShow; /* Parameter to use for first ShowWindow */
{
MSG msg; /* Message structure */
HANDLE hAccel; /* Accelerator handle */
/* Save our instance handle in a global variable */
hInstance = hInst;
/* Initialize application, quit if any errors */
if( ! Initialize( hPrevInst, nCmdShow ) )
{return FALSE;
}
/* Main message processing loop. Get each message, then translate
* keyboard messages and finally dispatch each message to its window
* function.
*/
hAccel = LoadAccelerators(hInstance,szClass);
while( GetMessage( &msg, NULL, 0, 0 ) )
{if (!TranslateAccelerator(hWnd, hAccel, &msg))
{TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
return msg.wParam;
}
/************************************************************************
*Initialize the application.
*************************************************************************/
BOOL NEAR Initialize( hPrevInst, nCmdShow )
HANDLE hPrevInst; /* Previous instance handle, 0 if first */
int nCmdShow; /* Parameter from WinMain for ShowWindow */
{
WNDCLASS WndClass; /* Class structure for RegisterClass */
HMENU hMenu; /* Handle to the (system) menu */
if( ! hPrevInst ) {
/* Initialization for first instance only */
/* Load strings from resource file */
LoadString( hInstance, IDS_CLASS, szClass, sizeof(szClass) );
LoadString( hInstance, IDS_TITLE, szTitle, sizeof(szTitle) );
/* Register our window class */
WndClass.style = CS_HREDRAW | CS_VREDRAW;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInstance;
WndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
WndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
WndClass.hbrBackground = COLOR_WINDOW + 1;
WndClass.lpszMenuName = szClass;
WndClass.lpszClassName = szClass;
if( ! RegisterClass( &WndClass ) )
return FALSE;
}
else
{/* Initialization for subsequent instances only */
/* Copy data from previous instance */
GetInstanceData( hPrevInst, szClass, sizeof(szClass) );
GetInstanceData( hPrevInst, szTitle, sizeof(szTitle) );
}
/* Initialization for every instance */
/* Create the window */
hWnd = CreateWindow(
szClass, /* Class name */
szTitle, /* Window title */
WS_OVERLAPPEDWINDOW , /* window style */
CW_USEDEFAULT, /* x */
0, /* y */
CW_USEDEFAULT, /* x width */
0, /* y width */
NULL, /* Parent hWnd (none for top-level) */
NULL, /* Menu handle */
hInstance, /* Owning instance handle */
NULL /* Parameter to pass in WM_CREATE (none) */
);
/* Insert "About..." into system menu */
LoadString( hInstance, IDS_ABOUT, szAbout, sizeof(szAbout) );
hMenu = GetSystemMenu(hWnd, FALSE);
ChangeMenu(hMenu, 0, NULL, 999, MF_APPEND | MF_SEPARATOR);
ChangeMenu(hMenu, 0, (LPSTR)szAbout, IDS_ABOUT, MF_APPEND | MF_STRING);
/* Make the window visible */
ShowWindow( hWnd, nCmdShow );
/* Got all the information, update our display */
UpdateWindow( hWnd );
return TRUE;
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/