home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / OCXDLG.PAK / OCXDLGAP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  2.4 KB  |  96 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   10.11  $
  6. //
  7. // Sample illustrating the use of OCXes in dialogs - Implements TOcxDlgApp
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_OLEFRAME_H)
  11. # include <owl/oleframe.h>
  12. #endif
  13. #if !defined(OWL_OLEFACTO_H)
  14. # include <owl/olefacto.h>
  15. #endif
  16. #if !defined(OCF_OCAPP_H)
  17. # include <ocf/ocapp.h>
  18. #endif
  19. #include "ocxdlgap.h"
  20. #include "ocxdlg.h" 
  21. #include "ocxdlgap.rh"     
  22.  
  23. //============================================================================
  24. // Create Application Dictionary
  25. DEFINE_APP_DICTIONARY(AppDictionary);
  26.  
  27. static TPointer<TOcRegistrar> Registrar;
  28.  
  29. BEGIN_REGISTRATION(OcxDialogAppReg)
  30.   REGDATA(clsid,     "{2EC13601-3BB4-11CF-A26F-0000C058612D}")
  31.   REGDATA(appname,     "OcxDlg Container")
  32.   REGDATA(description,     "OcxDlg Container Application")
  33. END_REGISTRATION
  34.  
  35. //
  36. //
  37. TOcxDlgApp::TOcxDlgApp() 
  38.            :TApplication(::OcxDialogAppReg["appname"], ::Module, &::AppDictionary)
  39. {
  40. }
  41.  
  42. //
  43. //
  44. //
  45. void TOcxDlgApp::InitMainWindow()
  46. {
  47.   nCmdShow = SW_HIDE;
  48.  
  49.   TOleFrame* frame = new TOleFrame(GetName(), 0, false);
  50.  
  51.   // Override the default window style for the main window.
  52.   //
  53.   frame->ModifyStyle(WS_THICKFRAME, WS_BORDER|WS_CAPTION|WS_CLIPCHILDREN|
  54.                                     WS_MINIMIZEBOX|WS_SYSMENU|WS_VISIBLE);
  55.  
  56.   // Assign ICON w/ this application.
  57.   //
  58.   frame->SetIcon(this, IDI_SDIAPPLICATION);
  59.   frame->SetIconSm(this, IDI_SDIAPPLICATION);
  60.  
  61.   SetMainWindow(frame);
  62.  
  63.   // Windows 3-D controls.
  64.   //
  65.   EnableCtl3d(true);
  66.   EnableBWCC();
  67. }
  68.  
  69. // Application intialization.
  70. //
  71. void TOcxDlgApp::InitInstance()
  72. {
  73.   TApplication::InitInstance();
  74.  
  75.   // Create and set Client Window
  76.   //
  77.   GetMainWindow()->SetClientWindow(new TMyOcxDialog(0));   
  78. }
  79.  
  80. //
  81. //
  82. int OwlMain(int , char* [])
  83. {
  84.   try {
  85.     // Create Application registration object
  86.     //
  87.     ::Registrar = new TOcRegistrar(::OcxDialogAppReg,
  88.                                    TOleFactory<TOcxDlgApp>(),
  89.                                    TApplication::GetCmdLine());
  90.     return ::Registrar->Run();
  91.   }
  92.   catch (xmsg& x) {
  93.     return ::HandleGlobalException(x, "Exception");
  94.   }
  95. }
  96.