home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / LogWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-20  |  1.9 KB  |  58 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : logwindow.h                                                         //
  12. //  Description: Text-based logging window                                           //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. // must be dynamically allocated to maintain the window, delete itself in WM_NCDESTROY message
  17.  
  18. class KLogWindow : KWindow
  19. {
  20.     HINSTANCE m_hInst;
  21.     HWND      m_hEditWnd;
  22.     HICON      m_hIcon;
  23.  
  24.     virtual LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  25.  
  26.     void GetWndClassEx(WNDCLASSEX & wc)
  27.     {
  28.         KWindow::GetWndClassEx(wc);
  29.  
  30.         wc.hIcon = m_hIcon;
  31.     }
  32.  
  33. public:
  34.     KLogWindow()
  35.     {
  36.         m_hInst    = NULL;
  37.         m_hEditWnd = NULL;
  38.         m_hIcon    = NULL;
  39.     }
  40.  
  41.     virtual ~ KLogWindow()
  42.     {
  43.     }
  44.     
  45.     void ShowWindow(bool bShow)
  46.     {
  47.         if ( bShow )
  48.             ::ShowWindow(m_hWnd, SW_RESTORE | SW_SHOWNORMAL);
  49.         else
  50.             ::ShowWindow(m_hWnd, SW_HIDE | SW_MINIMIZE);
  51.     }
  52.  
  53.     void Create(HINSTANCE hInst, const TCHAR * pTitle, HICON hIcon=NULL);
  54.     
  55.     void Log(const char * format, ...);
  56.     void DumpRegion(const char * mess, HRGN hRgn, bool detail, int p1=0);
  57. };
  58.