home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
rwdlg2.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-07-29
|
1KB
|
73 lines
/*
Program which uses tests simple dialog resources
*/
#include <owl\applicat.h>
#include <owl\framewin.h>
#include <owl\dialog.h>
#include "rwdlg2.h"
// declare the custom application class as
// a subclass of TApplication
class TWinApp : public TApplication
{
public:
TWinApp() : TApplication() {}
protected:
virtual void InitMainWindow();
};
// expand the functionality of TWindow by deriving class TMainWindow
class TMainWindow : public TWindow
{
public:
TMainWindow() : TWindow(0, 0, 0) {}
protected:
// handle the Calc menu
void CMCalc();
// handle confirming closing the window
virtual BOOL CanClose();
// declare the response table
DECLARE_RESPONSE_TABLE(TMainWindow);
};
DEFINE_RESPONSE_TABLE1(TMainWindow, TWindow)
EV_COMMAND(CM_CALC, CMCalc),
END_RESPONSE_TABLE;
void TMainWindow::CMCalc()
{
TDialog* pDlg = new TDialog(this, TResId(IDD_CALC_DLG));
pDlg->Execute();
}
BOOL TMainWindow::CanClose()
{
return MessageBox("Want to close this application?",
"Query", MB_YESNO | MB_ICONQUESTION) == IDYES;
}
void TWinApp::InitMainWindow()
{
MainWindow = new TFrameWindow(0,
"Dummy Dialog Box Calculator Tester",
new TMainWindow);
// load the menu resource
MainWindow->AssignMenu(TResId(EXITMENU));
}
int OwlMain(int /* argc */, char** /*argv[] */)
{
TWinApp app;
return app.Run();
}