Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
5.4 KiB

  1. #ifndef __VSTANDARD_H
  2. #define __VSTANDARD_H
  3. // This is the standard include file for the Virtual Windows Class Library (VWCL)
  4. // This header replaces the older VWCL.H and is used only to define basic functionality,
  5. // and implies nothing about the application being written. In fact, the application can
  6. // be C++ or a mix of C and C++. Previous releases of VWCL (Prior to December 1997) used
  7. // the preprocessor extensively to include or excluse code. VWCL grew to such a size that
  8. // this method proved extremely hard to maintain. The new method requires the users of VWCL
  9. // to include manually the classes they need. Those classes, should they require others, will
  10. // include those other headers as needed. This makes the code more maintainable, and also has
  11. // the benefit of better code re-use and builds smaller and tighter application by only including
  12. // required code. There are still some basic preprocessor command that can or should be defined:
  13. // VWCL_NO_GLOBAL_APP_OBJECT - Causes vWindowAppCore.cpp to not implement a global application object
  14. // VWCL_NO_REGISTER_CLASSES - Causes VApplication::Initialize() not to register VWindow and VMainWindow classes
  15. // VWCL_WRAP_WINDOWS_ONLY - Causes VWindow(s) to wrap HWND's only, not subclass them
  16. // VWCL_INIT_COMMON_CONTROLS - Causes VApplication::Initialize() to call InitCommonControls()
  17. // VWCL_INIT_OLE - Causes VApplication::Initialize() to call OleInitialize()/OleUninitialize()
  18. // VWCL_EXPORT_DLL - Define this when building a DLL version of class library
  19. // A shared VWCL DLL can only be loaded once per process. VWCL has
  20. // no state or resource management functions, so multiple DLL's that
  21. // use VWCL dynamically linked into one EXE would fail to locate resources
  22. // outside of the calling programs resources. A call to VGetApp()->Initialize()
  23. // from these DLL's would corrupt the EXE's global VApplication object.
  24. // VWCL_IMPORT_DLL - Define this when using VWCL from a DLL (importing)
  25. // Force strict type checking
  26. #ifndef STRICT
  27. #define STRICT
  28. #endif
  29. // Include standard Windows header
  30. #include <windows.h>
  31. // Include Windows extensions header
  32. #include <windowsx.h>
  33. // Support debug build assertions
  34. #include <assert.h>
  35. // Support TCHAR generic text mapping
  36. #include <tchar.h>
  37. // OutputDebugString wrapper
  38. #ifdef _DEBUG
  39. #ifndef ODS
  40. #define ODS(string)OutputDebugString(string);
  41. #endif
  42. #else
  43. #ifndef ODS
  44. #define ODS(string)
  45. #endif
  46. #endif
  47. // Macro compiles to assert(expression) in debug build, and just expression in release build
  48. #ifndef VERIFY
  49. #ifdef _DEBUG
  50. #define VERIFY(expression) assert(expression)
  51. #else
  52. #define VERIFY(expression) expression
  53. #endif
  54. #endif
  55. // Not all compilers define this macro
  56. #ifndef MAKEWORD
  57. #define MAKEWORD(a, b)((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
  58. #endif
  59. // Not all compilers define this
  60. #ifndef LPBOOL
  61. #define LPBOOL BOOL FAR*
  62. #endif
  63. // Determine how classes and functions are exported, imported, or nothing
  64. #ifdef VWCL_EXPORT_DLL
  65. #define VWCL_API _declspec(dllexport)
  66. #else
  67. #ifdef VWCL_IMPORT_DLL
  68. #define VWCL_API _declspec(dllimport)
  69. #else
  70. #define VWCL_API
  71. #endif
  72. #endif
  73. // VWCL implements these in vWindowAppCore.cpp. Non-VWCL apps do not need to implement
  74. #ifdef __cplusplus
  75. class VApplication;
  76. class VWindow;
  77. VApplication* VGetApp();
  78. #ifndef VWCL_WRAP_WINDOWS_ONLY
  79. VWCL_API BOOL VTranslateDialogMessage(LPMSG lpMsg);
  80. typedef struct tagVWCL_WINDOW_MAP
  81. {
  82. HWND hWnd;
  83. VWindow* pWindow;
  84. } VWCL_WINDOW_MAP;
  85. typedef VWCL_WINDOW_MAP FAR* LPVWCL_WINDOW_MAP;
  86. static LPCTSTR VMAINWINDOWCLASS = _T("VMainWindow");
  87. static LPCTSTR VWINDOWCLASS = _T("VWindow");
  88. #endif
  89. #endif
  90. // For argc and argv support
  91. #ifdef __cplusplus
  92. extern "C" __declspec(dllimport) int argc;
  93. extern "C" __declspec(dllimport) char** argv;
  94. #else
  95. static int argc;
  96. static char** argv;
  97. #endif
  98. #define argc __argc
  99. #define argv __argv
  100. // Standard C style Global VWCL API's
  101. #ifdef __cplusplus
  102. extern "C" {
  103. #endif
  104. // If building a standard GUI VWCL application, these functions will already be implemented
  105. // for you in vWindowAppCore.cpp. However, if you are picking an choosing classes from VWCL
  106. // to use in another application, you may have to implement these C style functions because
  107. // those classes that require these will have to have them to compile and link properly
  108. // Return a static string buffer to the applications title, or name
  109. LPCTSTR VGetAppTitle();
  110. // Return the show command (ShowWindow() SW_xxx constant passed on command line)
  111. int VGetCommandShow();
  112. // Return the global instance handle of the application or DLL
  113. HINSTANCE VGetInstanceHandle();
  114. // Return the instance handle where resources are held
  115. HINSTANCE VGetResourceHandle();
  116. // GDI Support Routines implemented in vGDIGlobal.c
  117. VWCL_API void VMapCoords (HDC hDC, LPSIZEL lpSizeL, BOOL bToPixels);
  118. VWCL_API void VPixelsToHIMETRIC (LPSIZEL lpSizeL, HDC hDC);
  119. VWCL_API void VPixelsFromHIMETRIC (LPSIZEL lpSizeL, HDC hDC);
  120. // OLE Support Routines implemented in vOLEGlobal.c
  121. // Given a C string, allocate a new string with CoTaskMemAlloc() and copy string
  122. VWCL_API BOOL VCoStringFromString(LPTSTR* lppszCoString, LPCTSTR lpszString);
  123. // Debugging Support Routines implemented in vDebugGlobal.c
  124. // Show the result from GetLastError() as a message box, or ODS if a console application
  125. VWCL_API int VShowLastErrorMessage(HWND hWndParent);
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif // __VSTANDARD_H