home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / oledb / tablecopy / winmain.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-12  |  3.7 KB  |  121 lines

  1. //-----------------------------------------------------------------------------
  2. // Microsoft OLE DB TABLECOPY Sample
  3. // Copyright (C) 1995-1998 Microsoft Corporation
  4. //
  5. // @doc
  6. //
  7. // @module WINMAIN.H
  8. //
  9. //-----------------------------------------------------------------------------
  10.  
  11. #ifndef _WINMAIN_H_
  12. #define _WINMAIN_H_
  13.  
  14.  
  15. ///////////////////////////////////////////////////////////////
  16. // Defines
  17. //
  18. ///////////////////////////////////////////////////////////////
  19.  
  20. //We want type checking on Window Handles
  21. #define STRICT
  22.  
  23.  
  24. ///////////////////////////////////////////////////////////////
  25. // Includes
  26. //
  27. ///////////////////////////////////////////////////////////////
  28. #include <windows.h>
  29. #include <windowsx.h>
  30. #include <commctrl.h>    //InitCommonControls
  31.  
  32. #include <stddef.h>
  33. #include <stdio.h>
  34. #include <limits.h>
  35. #include <wchar.h>
  36.  
  37. #include "resource.h"
  38.  
  39.  
  40.  
  41. ////////////////////////////////////////////////////////////////////////////
  42. // Windows Defines
  43. //
  44. ////////////////////////////////////////////////////////////////////////////
  45. #define CHECK_MEMORY(pv)    if(!pv) { OutOfMemory(NULL); goto CLEANUP; }
  46.  
  47. //Dialog Box procedures want to know if you handled the MSG
  48. //or not.  If you do, thenit just returns, if not then it calls
  49. //the default windialog procedure to try and handle it
  50. const BOOL HANDLED_MSG     = TRUE;
  51. const BOOL UNHANDLED_MSG = FALSE;
  52. #define LVM_ERR (-1)
  53.  
  54. ////////////////////////////////////////////////////////////////////////////
  55. // Windows functions
  56. //
  57. ////////////////////////////////////////////////////////////////////////////
  58. void Busy(BOOL bValue = TRUE);
  59. void OutOfMemory(HWND hwnd);
  60.  
  61. INT wMessageBox(HWND hDlg, UINT uiStyle, WCHAR* pwszTitle, WCHAR* pwszFmt, ...);
  62. LRESULT wSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, WCHAR* pwszName);
  63.  
  64. void wSetDlgItemText(HWND hWnd, INT DlgItem, WCHAR* pwszFmt, ...);
  65. UINT wGetDlgItemText(HWND hWnd, INT DlgItem, WCHAR* pwsz, INT nMaxSize);
  66.  
  67. BOOL CenterDialog(HWND hDlg);
  68. void SyncSibling(HWND hwndLstChg,HWND hwndLstSrc);
  69.  
  70. BOOL GetEditBoxValue(HWND hEditWnd, ULONG ulMin, ULONG ulMax, ULONG* pulCount);
  71.  
  72.  
  73. /////////////////////////////////////////////////////////////////////
  74. // ListView Helpers
  75. //
  76. /////////////////////////////////////////////////////////////////////
  77. LONG LV_InsertColumn(HWND hWnd, LONG iColumn, CHAR* szName);
  78. LONG LV_InsertItem(HWND hWnd, LONG iItem, LONG iSubItem, CHAR* szName, LONG iParam = 0, LONG iIMage = NULL);
  79. LONG LV_SetItemState(HWND hWnd, LONG iItem, LONG iSubItem, LONG lState, LONG lStateMask);
  80. LONG LV_SetItemText(HWND hWnd, LONG iItem, LONG iSubItem, CHAR* szName);
  81. LONG LV_FindItem(HWND hWnd, CHAR* szName, LONG iStart);
  82.  
  83.  
  84. /////////////////////////////////////////////////////////////////////
  85. // TreeView Helpers
  86. //
  87. /////////////////////////////////////////////////////////////////////
  88. HTREEITEM TV_InsertItem(HWND hWnd, HTREEITEM hParent, HTREEITEM hInsAfter, CHAR* szName, LONG iParam = 0, LONG iImage = 0, LONG iSelectedImage = 0);
  89.  
  90.  
  91. /////////////////////////////////////////////////////////////////////
  92. // Memory debugging code
  93. //
  94. /////////////////////////////////////////////////////////////////////
  95. int InternalAssert(char* pszExp, char* pszFile, UINT iLine);
  96. void InternalTrace(CHAR* pszExp, ...);
  97. void InternalTrace(WCHAR* pwszExp, ...);
  98.  
  99. #undef ASSERT
  100. #undef TRACE
  101.  
  102. #ifdef _DEBUG
  103. #if     defined(_M_IX86)
  104. #define _DbgBreak() __asm { int 3 }
  105. #else
  106. #define _DbgBreak() DebugBreak()
  107. #endif
  108. #define ASSERT(expr) \
  109.         do { if (!(expr) && \
  110.                 (1 == InternalAssert(#expr, __FILE__, __LINE__))) \
  111.              _DbgBreak(); } while (0)
  112.  
  113. #define TRACE    InternalTrace
  114. #else  //_DEBUG
  115. #define ASSERT(exp)
  116. #define TRACE    if(0) InternalTrace
  117. #endif //_DEBUG
  118.  
  119.  
  120. #endif //_WINMAIN_H_
  121.