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

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