home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
mag&info
/
msjv7_5.zip
/
WINCPP.ARJ
/
CPP3.ARJ
/
GENERIC.CPP
next >
Wrap
C/C++ Source or Header
|
1992-09-01
|
2KB
|
66 lines
// generic.cpp RHS 4/15/92
#include"WinApp.h"
#include"generic.h" // specific to this program
class myApp : public WinApp // derive new class from WinApp
{
public:
// override virtual functions
BOOL InitInstance(void);
BOOL InitApplication(void);
};
myApp theApp; // create an instance of myApp
BOOL myApp::InitApplication(void)
{
mainWnd = new Window();
if(!mainWnd->RegisterClass(
NULL,
MainWndProc,
"GenericMenu",
"GenericWClass"))
return FALSE;
return TRUE;
}
BOOL myApp::InitInstance(void)
{
if(!mainWnd->CreateWindow(
"GenericWClass", // classname
"Generic Sample Application (C++ 3)", // text
WS_OVERLAPPEDWINDOW)) // style
return FALSE;
mainWnd->ShowWindow(); // Show the window
mainWnd->UpdateWindow(); // Sends WM_PAINT message
return TRUE; // Returns the value from PostQuitMessage
}
long FAR PASCAL MainWndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND: // message: command from application menu
if(wParam == IDM_ABOUT)
{
About(hWnd,"AboutBox");
break;
}
else // Lets Windows process it
return DefWindowProc(hWnd, message, wParam, lParam);
case WM_DESTROY: // message: window being destroyed
PostQuitMessage(0);
break;
default: // Passes it on if unproccessed
return DefWindowProc(hWnd, message, wParam, lParam);
}
return NULL;
}