home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ipfe10.zip
/
IPFEDEMO.C
< prev
next >
Wrap
Text File
|
1993-05-29
|
6KB
|
246 lines
/* File: IPFEDEMO.C
Author: Bill Perez
Date: 5/26/1993
Purpose: Simple demo program to show adding help using IPF Editor's
help generation routines.
Operating System: OS/2 2.x PM
Revision: 0.1
Revision History:
0.1 - 5/26/1993 - Initial Coding, Bill Perez.
Notes:
Link with IPF Editor generated C source IFPEDHLP.C. Include
IPF Editor generated C and RC files IPFEDHLP.H and IPFEDHLP.RC
into this file and resource file, respectively.
(C) 1993 Bill Perez.
*/
// Includes
#define INCL_PM
#include <os2.h>
#include "ipfedhlp.h" // IPF Editor generated include file for help
// Definitions
// Structures
// Typedefs
// Global variables
HWND
hwndFrame,
hwndClient;
// Prototypes
int main(int argc, char *argv[], char *envp[]);
#pragma linkage( IPFEDemoWndProc, system )
MRESULT EXPENTRY IPFEDemoWndProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 );
#pragma linkage( IPFEDemoDlgProc, system )
MRESULT EXPENTRY IPFEDemoDlgProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 );
int main(int argc, char *argv[], char *envp[])
{
HAB
hab; // Anchor block
HMQ
hmq; // Message Queue handle
PCHAR
pszClass = "IPFEDEMO"; // Class name
ULONG
flFrameFlags = // Frame definition
FCF_SIZEBORDER | FCF_MENU | FCF_ICON |
FCF_TITLEBAR | FCF_SHELLPOSITION | FCF_TASKLIST |
FCF_MINMAX;
QMSG
qmsg; // Message queue contents
hab = WinInitialize( 0 );
hmq = WinCreateMsgQueue( hab, 0 );
// Register our window class
WinRegisterClass(
hab,
pszClass,
(PFNWP) IPFEDemoWndProc,
CS_SIZEREDRAW,
0 );
// Create standard window
hwndFrame =
WinCreateStdWindow(
HWND_DESKTOP,
WS_VISIBLE,
&flFrameFlags,
pszClass,
"IPF Editor Demo C Program",
WS_VISIBLE,
0L,
IDD_IPFEDEMO,
&hwndClient );
// Initialize help system
HelpInit( hwndFrame );
// Loop until terminated
while( WinGetMsg( hab, &qmsg, 0L, 0, 0 ) )
WinDispatchMsg( hab, &qmsg );
// Terminate help system
HelpDestroyInstance();
// Kill window
WinDestroyWindow( hwndFrame );
// Destroy message queue
WinDestroyMsgQueue( hmq );
// Kill handle to anchor block
WinTerminate( hab );
// Exit with error code of zero
exit( 0 );
}
/*****************************************************************
Function: IPFEDemoWndProc()
Author: Bill Perez
Date: 5/26/1993
Purpose: Main window procedure for IPF Editor demo. Handles all
messages for IPF Editor Demo program.
Revision: 1.0
Revision History:
1.0 - Initial Coding, Bill Perez.
*/
MRESULT EXPENTRY IPFEDemoWndProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
HPS
hps; // PS access
switch( msg )
{
case WM_CREATE:
return (MRESULT) 0L;
// Process messages help needs to be aware of
case WM_ACTIVATE:
case WM_INITMENU:
return HelpProcessMessages( hwnd, msg, mp1, mp2 );
case HM_ERROR:
DosBeep( 500, 250 );
DosBeep( 500, 250 );
return HelpProcessMessages( hwnd, msg, mp1, mp2 );
case HM_HELPSUBITEM_NOT_FOUND:
DosBeep( 1000, 100 );
return HelpProcessMessages( hwnd, msg, mp1, mp2 );
case WM_HELP:
DosBeep( 100, 100 );
return HelpProcessMessages( hwnd, msg, mp1, mp2 );
// Process command messages
case WM_COMMAND:
// Make sure help get's chance to see WM_COMMAND message
HelpProcessMessages( hwnd, msg, mp1, mp2 );
// Process menu commands, now
switch( SHORT1FROMMP( mp1 ) )
{
// Exit program
case IDM_QUIT:
WinPostMsg( hwnd, WM_QUIT, 0L, 0L );
return (MRESULT) 0L;
// Display a message box
case IDM_MESSAGE_BOX:
WinMessageBox(
HWND_DESKTOP,
hwnd,
"Select the Help Button to see sample help for message boxes.",
"IPF Editor Sample Program",
IDMB_SAMPLE,
MB_OK | MB_HELP | MB_ICONEXCLAMATION );
return (MRESULT) 0L;
// Display a dialog box
case IDM_SAMPLE_DIALOG:
WinDlgBox(
HWND_DESKTOP,
hwnd,
(PFNWP) IPFEDemoDlgProc,
0L,
IDD_SAMPLE_DLG,
(PVOID) NULL );
return (MRESULT) 0L;
}
break;
// Erase window
case WM_PAINT:
hps = WinBeginPaint( hwnd, 0L, NULL );
GpiErase( hps );
WinEndPaint( hps );
return (MRESULT) 0L;
}
return WinDefWindowProc( hwnd, msg, mp1, mp2 );
}
/*****************************************************************
Function: IPFEDemoDlgProc()
Author: Bill Perez
Date: 5/26/1993
Purpose: Sample dialog box procedure for dialog sample.
Revision: 1.0
Revision History:
1.0 - Initial Coding, Bill Perez.
*/
MRESULT EXPENTRY IPFEDemoDlgProc( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
{
switch( msg )
{
case WM_INITDLG:
return (MRESULT) 0L;
case WM_COMMAND:
switch( SHORT1FROMMP( mp1 ) )
{
case IDPB_DONE:
WinDismissDlg( hwnd, TRUE );
return (MRESULT) 0L;
}
return (MRESULT) 0L;
}
return WinDefDlgProc( hwnd, msg, mp1, mp2 );
}
InstallHelpHook( HAB hab, HMQ hmq )
{
}