home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 6.ddi / OWLDEMOS.ZIP / USECDLL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.5 KB  |  60 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <owl.h>
  6. #include "colordlg.h"
  7. #include "usecdll.h"
  8.  
  9. class TTestApp : public TApplication
  10. {
  11. public:
  12.   TTestApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  13.     LPSTR lpCmdLine, int nCmdShow)
  14.     : TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  15.   virtual void InitMainWindow();
  16. };
  17.  
  18. class TTestWindow : public TWindow
  19. {
  20. public:
  21.   TTestWindow(PTWindowsObject AParent, LPSTR ATitle);
  22.   virtual void CMColor(RTMessage Msg) = [CM_FIRST + CM_COLOR];
  23. };
  24.  
  25. TTestWindow::TTestWindow(PTWindowsObject AParent, LPSTR ATitle) :
  26.   TWindow(AParent, ATitle)
  27. {
  28.   AssignMenu("COMMANDS");
  29. }
  30.  
  31. void TTestWindow::CMColor(RTMessage)
  32. {
  33.   COLORREF TheColor;
  34.   char MsgStr[128];
  35.  
  36.   TheColor = RGB(0x00, 0x00, 0x00);
  37.   if ( GetApplication()->ExecDialog(
  38.     new TColorDialog(this, TheColor)) == IDOK )
  39.       sprintf(MsgStr,
  40.         "RGB intensities: \r\n\r\n Red - %d \r\n Green - %d \r\n Blue - %d",
  41.         GetRValue(TheColor), GetGValue(TheColor), GetBValue(TheColor));
  42.     else
  43.       strcpy(MsgStr, "Cancelled");
  44.   MessageBox(HWindow, MsgStr, Title, MB_OK);
  45. }
  46.  
  47. void TTestApp::InitMainWindow()
  48. {
  49.   MainWindow = new TTestWindow(NULL, Name);
  50. }
  51.  
  52. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  53.   LPSTR lpCmdLine, int nCmdShow)
  54. {
  55.   TTestApp TestApp("DLL Test", hInstance, hPrevInstance,
  56.     lpCmdLine, nCmdShow);
  57.   TestApp.Run();
  58.   return TestApp.Status;
  59. }
  60.