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.

103 lines
5.9 KiB

  1. // bjw Win16 <-> Win32 compatibility macros
  2. #include <direct.h> // dwb KtoA
  3. #include <stdlib.h> // dwb KtoA
  4. #include <io.h> // dwb KtoA
  5. #include <memory.h> // dwb KtoA
  6. #include <string.h> // dwb KtoA
  7. #ifdef OLDCODE
  8. typedef UINT WPARAM; // dwb KtoA
  9. #define MAINENTRY APIENTRY
  10. // bjw Win16 <-> Win32 compatibility macros
  11. #define MAINENTRY APIENTRY
  12. #define huge FAR
  13. #define WINAPI APIENTRY
  14. #define GET_WM_COMMAND_ID(wParam, lParam) ((WORD) (wParam))
  15. #define GET_WM_COMMAND_HWND(wParam, lParam) ((HWND) lParam)
  16. #define GET_WM_COMMAND_CMD(wParam, lParam) ((WORD) HIWORD(wParam))
  17. #define PACK_WM_COMMAND_WPARAM(w1, w2) ((UINT) MAKELONG(w1, 2))
  18. #define MAKE_MOUSE_POINT(l) (*((POINTS FAR *)&(l)))
  19. #define MDI_CREATE(hwnd, long) ((HWND) SendMessage(hwnd, WM_MDICREATE, (UINT) 0, (LONG)long))
  20. #define GET_MDI_ACTIVE(hwnd, w, l) ((HWND) SendMessage(hwnd, WM_MDIGETACTIVE, (UINT) 0, 0L))
  21. #define MDI_SETMENU(hwnd, a, b) ((HMENU) SendMessage(hwnd, WM_MDISETMENU, (UINT) a, (LONG) b))
  22. #define MDI_TILE(hwnd) ((LONG) SendMessage(hwnd, WM_MDITILE, (UINT) 0, 0L))
  23. #define GET_WM_CTLCOLOR_HWND(w, l) ((HWND) l)
  24. #define DLGDIRSELECT(hwnd, lpsz, ncnt, nid) ((BOOL)DlgDirSelectEx(hwnd, lpsz, ncnt, nid))
  25. #define DIRSELECTCB(hwnd, lpsz, ncnt, nid) ((BOOL)DlgDirSelectComboBoxEx(hwnd, lpsz, ncnt, nid))
  26. #define GET_HMODULE(hwnd) ((HMODULE) GetWindowLong(hwnd, GWL_HINSTANCE))
  27. #define GET_HWNDPARENT(hwnd) ((HWND) GetWindowLong(hwnd, GWL_HWNDPARENT))
  28. #define GET_ID(hwnd) ((UINT) GetWindowLong(hwnd, GWL_ID))
  29. #define GET_WW(hwnd, ndx) ((UINT) GetWindowLong(hwnd, ndx))
  30. #define SET_WW(hwnd, ndx, val) ((UINT) SetWindowLong(hwnd, ndx, (LONG) val));
  31. #define MOVE_TO(hdc, x, y) ((BOOL) MoveToEx(hdc, x, y, NULL))
  32. #define MoveTo(hdc, x, y) ((BOOL) MoveToEx(hdc, x, y, NULL))
  33. #define GET_CLASS_HCURSOR(hwnd) ((HCURSOR) GetClassLong(hwnd, GCL_HCURSOR))
  34. #define GET_CLASS_HICON(hwnd) ((HCURSOR) GetClassLong(hwnd, GCL_HICON))
  35. #define SET_CLASS_HCURSOR(hwnd, h) ((HCURSOR) SetClassLong(hwnd, GCL_HCURSOR, (LONG) h))
  36. #define SET_CLASS_HICON(hwnd, h) ((HCURSOR) SetClassLong(hwnd, GCL_HICON, (LONG) h))
  37. #define GET_WM_MENUSELECT_ID(w, l) ((WORD) w)
  38. #define GET_WM_MENUSELECT_CMD(w, l) ((WORD) HIWORD(l))
  39. #define GET_WM_MENUSELECT_HMENU(w, l) ((HMENU) l)
  40. #define GET_WM_ACTIVATE_HWND(w, l) ((HWND) l)
  41. #define SET_BRUSH_ORG(hdc, x, y) ((BOOL) SetBrushOrg(hdc, x, y, NULL))
  42. #define GET_WM_HSCROLL_POSITION(w, l) ((WORD) HIWORD(w)) // dwb KtoA for 16-bit: #define GET_WM_HSCROLL_POSITION(w, l) ((WORD) LOWORD(l))
  43. #define GET_WM_VSCROLL_POSITION(w, l) ((WORD) HIWORD(w)) // dwb KtoA for 16-bit: #define GET_WM_VSCROLL_POSITION(w, l) ((WORD) LOWORD(l))
  44. #define SET_WINDOW_EXT(hdc, x, y) ((BOOL) SetWindowExtEx(hdc, x, y, NULL))
  45. #define SetWindowExt(hdc, x, y) ((BOOL) SetWindowExtEx(hdc, x, y, NULL))
  46. #define SET_WINDOW_ORG(hdc, x, y) ((BOOL) SetWindowOrgEx(hdc, x, y, NULL))
  47. #define SetWindowOrg(hdc, x, y) ((BOOL) SetWindowOrgEx(hdc, x, y, NULL))
  48. #define SET_VIEWPORT_EXT(hdc, x, y) ((BOOL) SetViewportExtEx(hdc, x, y, NULL))
  49. #define SetViewportExt(hdc, x, y) ((BOOL) SetViewportExtEx(hdc, x, y, NULL))
  50. #define SET_VIEWPORT_ORG(hdc, x, y) ((BOOL) SetViewportOrgEx(hdc, x, y, NULL))
  51. #define SetViewportOrg(hdc, x, y) ((BOOL) SetViewportOrgEx(hdc, x, y, NULL))
  52. LONG FSE_filelength(int hFile);
  53. #define ODS(s) OutputDebugString(s); OutputDebugString("\n");
  54. #endif // oldcode
  55. // x86 asembly replacements
  56. #define lmovmem(s, d, l) memcpy(d, s, l)
  57. #define lsetmem(s, b, l) memset(s, b, l)
  58. #ifdef OLDCODE
  59. //--------------------------------------------------------------------------
  60. //-- obsolete functions
  61. //--------------------------------------------------------------------------
  62. #define CloseSound()
  63. #define CountVoiceNotes(n) ((int) 0)
  64. #define GetWinFlags() ((DWORD) 0)
  65. #define OpenSound() ((int) 0)
  66. #define SetVoiceAccent(n1,n2,n3,n4,n5) ((int) 0)
  67. #define SetVoiceNote(n1, n2, n3, n4) ((int) 0)
  68. #define StartSound() ((int) 0)
  69. #define StopSound() ((int) 0)
  70. #define LockData() (0)
  71. #define UnlockData() (0)
  72. #define AccessResource() (0)
  73. #define SetResourceHandler() (0)
  74. //--------------------------------------------------------------------------
  75. //-- comm functions that need to be replaced by Windows NT comm functions
  76. //--------------------------------------------------------------------------
  77. #define CloseComm() (0)
  78. #define FlushComm() (0)
  79. #define GetCommError() (0)
  80. #define OpenComm() (0)
  81. #define ReadComm() (0)
  82. #define SetCommEventMask() (0)
  83. #define WriteComm() (0)
  84. //--------------------------------------------------------------------------
  85. //-- FSE functions not portable to NT
  86. //--------------------------------------------------------------------------
  87. #endif