home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c016 / 3.ddi / CORINTG2.PAK / INTEGRA2.CPP next >
Encoding:
C/C++ Source or Header  |  1993-12-08  |  2.5 KB  |  100 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1993 by Borland International
  3. //----------------------------------------------------------------------------
  4. #include <owl\owlpch.h>
  5. #include <owl\applicat.h>
  6. #include <owl\dialog.h>
  7. #include <owl\framewin.h>
  8. #include <owl\vbxctl.h>
  9. #include "integra2.rc"
  10. #include "..\..\INCLUDE\sqcmain.h"
  11. #include "..\..\INCLUDE\sqc1.h"
  12.  
  13. class TDBApp : public TApplication {
  14.   public:
  15.     TDBApp() : TApplication() {}
  16.     long DBHandle;
  17.   protected:
  18.     void InitMainWindow();
  19.     BOOL ProcessAppMsg(MSG& msg);
  20. };
  21.  
  22. class TPatDialog : public TDialog, public TVbxEventHandler {
  23.   public:
  24.     TPatDialog(TWindow* parent, TResId name) : TDialog(parent, name) {}
  25.  
  26.   protected:
  27.     void SetupWindow();
  28.     void CleanupWindow();
  29.  
  30.   DECLARE_RESPONSE_TABLE(TPatDialog);
  31. };
  32.  
  33. DEFINE_RESPONSE_TABLE2(TPatDialog, TDialog, TVbxEventHandler)
  34. END_RESPONSE_TABLE;
  35.  
  36. void TPatDialog::SetupWindow()
  37. {
  38.   TDialog::SetupWindow();
  39. }
  40.  
  41. void TPatDialog::CleanupWindow()
  42. {
  43.   ::PostQuitMessage(0);
  44. }
  45.  
  46. class TDocDialog : public TDialog, public TVbxEventHandler {
  47.   public:
  48.     TDocDialog(TWindow* parent, TResId name) : TDialog(parent, name) {}
  49.  
  50.   protected:
  51.     void SetupWindow();
  52.     void CleanupWindow();
  53.     TPatDialog* PatDlg;
  54.   DECLARE_RESPONSE_TABLE(TDocDialog);
  55. };
  56.  
  57. DEFINE_RESPONSE_TABLE2(TDocDialog, TDialog, TVbxEventHandler)
  58. END_RESPONSE_TABLE;
  59.  
  60. void TDocDialog::SetupWindow()
  61. {
  62.   TDialog::SetupWindow();
  63.   PatDlg = new TPatDialog(0,TResId(IDD_PATIENTS));
  64.   PatDlg->Create();
  65.   TDBApp* app = (TDBApp*)GetApplication();
  66.   SQcGo(app->DBHandle,0);
  67. }
  68.  
  69. void TDocDialog::CleanupWindow()
  70. {
  71.   PatDlg->Destroy();
  72.   delete PatDlg;
  73. }
  74.  
  75. void TDBApp::InitMainWindow() {
  76.   TDocDialog *DocDlg = new TDocDialog(0,TResId(IDD_DOCTORS));
  77.   MainWindow = new TFrameWindow(0, "Integra Example", DocDlg, TRUE);
  78.   MainWindow->Attr.Style &= ~(WS_MAXIMIZEBOX | WS_THICKFRAME);
  79. }
  80.  
  81. BOOL TDBApp::ProcessAppMsg(MSG& msg)
  82. {
  83.   if (msg.message == WM_KEYDOWN &&
  84.       (msg.wParam == VK_ESCAPE || msg.wParam == VK_RETURN))
  85.     return TRUE;      // ignore OK and CANCEL keys, rather than quit dialog
  86.   return TApplication::ProcessAppMsg(msg);
  87. }
  88.  
  89. int
  90. OwlMain(int, char**)
  91. {
  92.   TBIVbxLibrary vbxLib;     // constructing this loads & inits the library
  93.   TDBApp app;
  94.   long revision;
  95.   SQcConnect(&app.DBHandle,&revision);
  96.   int result = app.Run();
  97.   SQcDisconnect(app.DBHandle);
  98.   return result;
  99. }
  100.