home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************/
- /* BWCIMMED.cpp by Bob Bourbonnais */
- /* released to the public domain 2/02/92 */
- /* This program shows how to switch to different */
- /* routines based on the button pressed using */
- /* Dynamic Dispatched Virtual Tables, DDVT */
- /* It also shows how to use BC_GETCHECK to show */
- /* the ON/OFF status of check boxes */
- /**********************************************************************/
- #include <owl.h>
- #include <dialog.h>
- #include "bwcc.h" // needed for BWCC
- #include "BWCIMMED.H" // equates for checkboxes
-
- class TMyDialog : public TDialog
- {
- public:
- TMyDialog(LPSTR lpDialogName) // constructor calls
- : TDialog(NULL,lpDialogName) // base class constructor
- {
- BWCCGetVersion(); // activate Borland Windows Custom Controls
- }
- virtual void HandleRadar12(RTMessage Msg) // these DDVT toggles
- = [ID_FIRST + IDB_RADAR12]; // activate immediately
- virtual void HandleConfabulator12(RTMessage Msg) // like regular
- = [ID_FIRST + IDB_CONFABULATOR12]; // buttons
-
- virtual void DefChildProc(RTMessage Msg); // default button handler
- };
-
- void TMyDialog::HandleRadar12(RTMessage)
- {
- if (SendDlgItemMsg(IDB_RADAR12,BM_GETCHECK,0,0)) // find out the ON/OFF
- { // status of the checkbox
- MessageBeep(0); // if we turned it on
- BWCCMessageBox(HWindow,"Radar Unit 12 Activated", // beep and display
- "ACTIVATION!",MB_OK); // message box
- }
- else // if we turned it off
- {
- MessageBeep(0); // beep and display a
- BWCCMessageBox(HWindow,"Radar Unit 12 OFF", // different message
- "SHUTDOWN!",MB_OK);
- }
- }
-
- void TMyDialog::HandleConfabulator12(RTMessage) // Same for second
- { // Item
- if (SendDlgItemMsg(IDB_CONFABULATOR12,BM_GETCHECK,0,0))
- {
- MessageBeep(0);
- BWCCMessageBox(HWindow,"Confabulator on Unit 12 Activated",
- "ACTIVATION!",MB_OK);
- }
- else
- {
- MessageBeep(0);
- BWCCMessageBox(HWindow,"Confabulator on Unit 12 OFF",
- "SHUTDOWN!",MB_OK);
- }
- }
-
- void TMyDialog::DefChildProc(RTMessage Msg) // default button handler
- {
- MessageBeep(0); // make sound and display
- BWCCMessageBox(HWindow,"Not Implemented", // a BWCC message box
- "Feature",MB_OK);
- TDialog::DefChildProc(Msg); // pass messages along
- } // to base class handler
-
- class TDialog1App : public TApplication // Application Class to contain
- { // the application
- public:
- TDialog1App(LPSTR lpName, HANDLE hInstance, // constructor calls the
- HANDLE hPrevInstance, // base class constructor
- LPSTR lpCmdLine, int nCmdShow)
- :TApplication(lpName, hInstance,
- hPrevInstance,
- lpCmdLine, nCmdShow) {};
-
- virtual void InitMainWindow(); // overrides base class InitMainWindow
- };
-
- void TDialog1App::InitMainWindow() // to initialize a dialog box
- { // as the main window
- MainWindow = new TMyDialog("MAINWINDOWDIALOG");
- }
-
- int PASCAL WinMain(HANDLE hInstance, // main entry point from
- HANDLE hPrevInstance, // windows to this program
- LPSTR lpCmdLine , int nCmdShow)
- {
- TDialog1App Dialog1("Dialog Tester",hInstance, // create instance of
- hPrevInstance, // the dialog application
- lpCmdLine,nCmdShow);
- Dialog1.Run(); // run it
- return (Dialog1.Status); // exit
- }
- /**********************************************************************/
-