Leaked source code of windows server 2003
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.

101 lines
2.6 KiB

  1. #ifndef WIN32_LEAN_AND_MEAN
  2. #define WIN32_LEAN_AND_MEAN
  3. #endif
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include "dbg.h"
  7. #include "cexbtn.h"
  8. // Safe String
  9. #define STRSAFE_NO_DEPRECATE
  10. #include "strsafe.h"
  11. //////////////////////////////////////////////////////////////////
  12. // Function : EXButton_CreateWindow
  13. // Type : HWND
  14. // Purpose : Opened API.
  15. // : Create Extended Button.
  16. // Args :
  17. // : HINSTANCE hInst
  18. // : HWND hwndParent
  19. // : DWORD dwStyle EXBS_XXXXX combination.
  20. // : INT wID Window ID
  21. // : INT xPos
  22. // : INT yPos
  23. // : INT width
  24. // : INT height
  25. // Return :
  26. // DATE : 970905
  27. //////////////////////////////////////////////////////////////////
  28. #ifndef UNDER_CE
  29. #define SZCLASSNAME "MSIME_EXB"
  30. #else // UNDER_CE
  31. #define SZCLASSNAME TEXT("MSIME_EXB")
  32. #endif // UNDER_CE
  33. #ifdef UNDER_CE // In Windows CE, all window classes are process global.
  34. static LPCTSTR MakeClassName(HINSTANCE hInst, LPTSTR lpszBuf)
  35. {
  36. // make module unique name
  37. TCHAR szFileName[MAX_PATH];
  38. GetModuleFileName(hInst, szFileName, MAX_PATH);
  39. LPTSTR lpszFName = _tcsrchr(szFileName, TEXT('\\'));
  40. if(lpszFName) *lpszFName = TEXT('_');
  41. StringCchCopy(lpszBuf, MAX_PATH, SZCLASSNAME);
  42. StringCchCat(lpszBuf, MAX_PATH, lpszFName);
  43. return lpszBuf;
  44. }
  45. BOOL EXButton_UnregisterClass(HINSTANCE hInst)
  46. {
  47. TCHAR szClassName[MAX_PATH];
  48. return UnregisterClass(MakeClassName(hInst, szClassName), hInst);
  49. }
  50. #endif // UNDER_CE
  51. HWND EXButton_CreateWindow(HINSTANCE hInst,
  52. HWND hwndParent,
  53. DWORD dwStyle,
  54. INT wID,
  55. INT xPos,
  56. INT yPos,
  57. INT width,
  58. INT height)
  59. {
  60. DBG_INIT();
  61. LPCEXButton lpEXB = new CEXButton(hInst, hwndParent, dwStyle, wID);
  62. HWND hwnd;
  63. if(!lpEXB) {
  64. return NULL;
  65. }
  66. #ifndef UNDER_CE // In Windows CE, all window classes are process global.
  67. lpEXB->RegisterWinClass(SZCLASSNAME);
  68. hwnd = CreateWindowEx(0,
  69. SZCLASSNAME,
  70. #else // UNDER_CE
  71. TCHAR szClassName[MAX_PATH];
  72. MakeClassName(hInst, szClassName);
  73. lpEXB->RegisterWinClass(szClassName);
  74. hwnd = CreateWindowEx(0,
  75. szClassName,
  76. #endif // UNDER_CE
  77. #ifndef UNDER_CE
  78. "",
  79. #else // UNDER_CE
  80. TEXT(""),
  81. #endif // UNDER_CE
  82. WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
  83. xPos, yPos,
  84. width,
  85. height,
  86. hwndParent,
  87. #ifdef _WIN64
  88. (HMENU)(INT_PTR)wID,
  89. #else
  90. (HMENU)wID,
  91. #endif
  92. hInst,
  93. (LPVOID)lpEXB);
  94. return hwnd;
  95. }