home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c016 / 3.ddi / CORINTG1.PAK / INTEGRA1.CPP next >
Encoding:
C/C++ Source or Header  |  1993-12-09  |  3.0 KB  |  109 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 "integra1.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.  
  18.   protected:
  19.     void InitMainWindow();
  20. };
  21.  
  22. class TDocDialog : public TDialog, public TVbxEventHandler {
  23.   public:
  24.     TDocDialog(TWindow* parent, TResId name);
  25.  
  26.   protected:
  27.     void SetupWindow();
  28.     BOOL PreProcessMsg(MSG& msg);
  29.  
  30.     // OWL Aliases for VBX controls in dialog
  31.     //
  32.     TVbxCIQry* Query;
  33.  
  34.     void EvPREFETCH(VBXEVENT FAR*);
  35.     void EvPreAction(VBXEVENT FAR*);
  36.     void EvPostAction(VBXEVENT FAR*);
  37.  
  38.   DECLARE_RESPONSE_TABLE(TDocDialog);
  39. };
  40.  
  41. DEFINE_RESPONSE_TABLE2(TDocDialog, TDialog, TVbxEventHandler)
  42.   EV_VBXEVENTINDEX( IDC_CIQRY1, Event_CIQry_PREFETCH,  EvPREFETCH ),
  43.   EV_VBXEVENTINDEX( IDC_CIOP2,  Event_CIOP_PreAction,  EvPreAction ),
  44.   EV_VBXEVENTINDEX( IDC_CIOP2,  Event_CIOP_PostAction, EvPostAction ),
  45.   EV_WM_GETDLGCODE,
  46. END_RESPONSE_TABLE;
  47.  
  48. BOOL TDocDialog::PreProcessMsg(MSG& msg)
  49. {
  50.   if (msg.message == WM_KEYDOWN &&
  51.       (msg.wParam == VK_ESCAPE || msg.wParam == VK_RETURN))
  52.     return TRUE;      // ignore OK and CANCEL keys, rather than quit dialog
  53.   return TDialog::PreProcessMsg(msg);
  54. }
  55.  
  56. void TDocDialog::EvPREFETCH(VBXEVENT FAR*)
  57. {
  58. // hCursor as Long,RowNum as Long,Lparam as Long,Action as long
  59. }
  60.  
  61. void TDocDialog::EvPreAction(VBXEVENT FAR*)
  62. {
  63. //long bits;
  64. //char buf[120];
  65. //string sql;
  66. //Query->GetPropModeBitMask(bits);
  67. //Query->GetPropStatement(sql);
  68. //sql.copy(buf, sizeof(buf)-1);
  69. //wsprintf(buf, "Query Mode Bits = %lX", bits);
  70. //Parent->SetCaption(buf);
  71. //MessageBox("Received PreAction", "VBX Event", MB_OK);
  72.   // hCursor as Long,Operation as long,Lparam as long,Action as long
  73. }
  74. void TDocDialog::EvPostAction(VBXEVENT FAR*)
  75. {
  76. //MessageBox("Received PostAction", "VBX Event", MB_OK);
  77.   // hCursor as Long,ReturnCode as long,Lparam as long,Action as long
  78. }
  79.  
  80. TDocDialog::TDocDialog(TWindow* parent, TResId name)
  81.   : TDialog(parent, name)
  82. {
  83.   Query = new TVbxCIQry(this, IDC_CIQRY1);
  84. }
  85.  
  86. void TDocDialog::SetupWindow()
  87. {
  88.   TDialog::SetupWindow();
  89.   SQcGo(((TDBApp*)GetApplication())->DBHandle,0);
  90. }
  91.  
  92. void TDBApp::InitMainWindow() {
  93.   TDocDialog *DocDlg = new TDocDialog(0,TResId(IDD_DOCTORS));
  94.   MainWindow = new TFrameWindow(0, "Integra Example", DocDlg, TRUE);
  95.   MainWindow->Attr.Style &= ~(WS_MAXIMIZEBOX | WS_THICKFRAME);
  96. }
  97.  
  98. int
  99. OwlMain(int, char**)
  100. {
  101.   TBIVbxLibrary vbxLib;     // constructing this loads & inits the library
  102.   TDBApp app;
  103.   long revision;
  104.   SQcConnect(&app.DBHandle,&revision);
  105.   int result = app.Run();
  106.   SQcDisconnect(app.DBHandle);
  107.   return result;
  108. }
  109.