home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
dialog1.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-26
|
1KB
|
64 lines
#include <windows.h>
#include <owl\applicat.h>
#include <owl\dialog.h>
#include <owl\framewin.h>
#include <owl\window.h>
#include <owl\window.rh>
class TMyWindow : public TWindow
{
public:
TMyWindow(TWindow *parent = 0);
virtual BOOL CanClose();
protected:
void CmExit();
DECLARE_RESPONSE_TABLE(TMyWindow);
};
DEFINE_RESPONSE_TABLE1(TMyWindow, TWindow)
EV_COMMAND(CM_EXIT, CmExit),
END_RESPONSE_TABLE;
TMyWindow::TMyWindow(TWindow *parent)
: TWindow(parent)
{
}
BOOL TMyWindow::CanClose()
{
static BOOL bFlag = FALSE;
bFlag = !bFlag;
if (bFlag)
return TDialog(this, "ModernEnglish").Execute() == IDOK;
else
return TDialog(this, "OldeEnglish").Execute() == IDOK;
}
void TMyWindow::CmExit()
{
SendMessage(WM_CLOSE);
}
class TDialogApp : public TApplication
{
public:
TDialogApp() : TApplication()
{ nCmdShow = SW_SHOWMAXIMIZED; }
void InitMainWindow()
{
SetMainWindow(new TFrameWindow( 0,
"Simple Dialog Box Tester Application",
new TMyWindow ));
GetMainWindow()->AssignMenu("EXITMENU");
}
};
int OwlMain(int, char *[])
{
return TDialogApp().Run();
}