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 "cddbtn.h"
  8. // Safe String
  9. #define STRSAFE_NO_DEPRECATE
  10. #include "strsafe.h"
  11. //////////////////////////////////////////////////////////////////
  12. // Function : DDButton_CreateWindow
  13. // Type : HWND
  14. // Purpose : Opened API.
  15. // : Create Drop Down Button.
  16. // Args :
  17. // : HINSTANCE hInst
  18. // : HWND hwndParent
  19. // : DWORD dwStyle DDBS_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_DDB"
  30. #else // UNDER_CE
  31. #define SZCLASSNAME TEXT("MSIME_DDB")
  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 DDButton_UnregisterClass(HINSTANCE hInst)
  46. {
  47. TCHAR szClassName[MAX_PATH];
  48. return UnregisterClass(MakeClassName(hInst, szClassName), hInst);
  49. }
  50. #endif // UNDER_CE
  51. HWND DDButton_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. LPCDDButton lpDDB = new CDDButton(hInst, hwndParent, dwStyle, wID);
  61. HWND hwnd;
  62. if(!lpDDB) {
  63. return NULL;
  64. }
  65. #ifndef UNDER_CE // In Windows CE, all window classes are process global.
  66. lpDDB->RegisterWinClass(SZCLASSNAME);
  67. hwnd = CreateWindowEx(0,
  68. SZCLASSNAME,
  69. #else // UNDER_CE
  70. TCHAR szClassName[MAX_PATH];
  71. MakeClassName(hInst, szClassName);
  72. lpDDB->RegisterWinClass(szClassName);
  73. hwnd = CreateWindowEx(0,
  74. szClassName,
  75. #endif // UNDER_CE
  76. #ifndef UNDER_CE
  77. "",
  78. #else // UNDER_CE
  79. TEXT(""),
  80. #endif // UNDER_CE
  81. WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
  82. xPos, yPos,
  83. width,
  84. height,
  85. hwndParent,
  86. #ifdef _WIN64
  87. (HMENU)(INT_PTR)wID,
  88. #else
  89. (HMENU)wID,
  90. #endif
  91. hInst,
  92. (LPVOID)lpDDB);
  93. return hwnd;
  94. }