home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
mag&info
/
msjv7_5.zip
/
WINCPP.ARJ
/
CPP3.ARJ
/
WINAPP.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-01
|
2KB
|
71 lines
#include"WinApp.h"
BOOL CALLBACK _export AboutDlg(HWND, UINT, WPARAM, LPARAM);
HINSTANCE WinApphInstance = 0;
HINSTANCE WinApphPrevInstance = 0;
LPSTR WinApplpCmdLine = NULL;
int WinAppnCmdShow = 0;
WinApp *pWinApp = NULL;
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
#if defined(DEBUG)
assert(pWinApp != NULL); // WinApp pointer should be valid
#endif
// initialize the myApp object, theApp
pWinApp->Init(hInstance,hPrevInstance,lpCmdLine,nCmdShow);
// the following is the same logic as GENERIC.C
if(!pWinApp->PrevInstance())
if(!pWinApp->InitApplication())
return FALSE;
// Perform initializations that apply to a specific instance
if(!pWinApp->InitInstance())
return FALSE;
// Acquire and dispatch messages until a WM_QUIT message is received.
MSG msg; // message
while(GetMessage(&msg, // message structure
NULL, // handle of window receiving the message
NULL, // lowest message to examine
NULL)) // highest message to examine
{
TranslateMessage(&msg); // Translates virtual key codes
DispatchMessage(&msg); // Dispatches message to window
}
return(int)msg.wParam; // Returns the value from PostQuitMessage
}
BOOL FAR PASCAL About(HWND hWnd, LPCSTR resourceName)
{
BOOL retval = DialogBox(WinApphInstance, // current instance
resourceName, // resource to use
hWnd, // parent handle
(DLGPROC)AboutDlg); // AboutDlg() instance address
return retval;
}
BOOL CALLBACK AboutDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
switch(message)
{
case WM_INITDIALOG: // message: initialize dialog box
return TRUE;
case WM_COMMAND: // message: received a command
if(wParam == IDOK // "OK" box selected?
|| wParam == IDCANCEL)
{ // System menu close command?
EndDialog(hDlg, TRUE); // Exits the dialog box
return TRUE;
}
break;
}
return FALSE; // Didn't process a message
}