New stubs.
[wine/multimedia.git] / dlls / comctl32 / commctrl.c
blobf579b6cbfdb5577620772019eee77c83e45cd28e
1 /*
2 * Common controls functions
4 * Copyright 1997 Dimitrie O. Paun
5 * Copyright 1998 Eric Kohl
7 */
9 #include "win.h"
10 #include "heap.h"
11 #include "commctrl.h"
12 #include "animate.h"
13 #include "comboex.h"
14 #include "datetime.h"
15 #include "header.h"
16 #include "hotkey.h"
17 #include "ipaddress.h"
18 #include "listview.h"
19 #include "monthcal.h"
20 #include "nativefont.h"
21 #include "pager.h"
22 #include "progress.h"
23 #include "rebar.h"
24 #include "status.h"
25 #include "tab.h"
26 #include "toolbar.h"
27 #include "tooltips.h"
28 #include "trackbar.h"
29 #include "treeview.h"
30 #include "updown.h"
31 #include "winversion.h"
32 #include "debug.h"
33 #include "winerror.h"
36 HANDLE32 COMCTL32_hHeap = (HANDLE32)NULL;
37 DWORD COMCTL32_dwProcessesAttached = 0;
38 LPSTR COMCTL32_aSubclass = (LPSTR)NULL;
41 /***********************************************************************
42 * COMCTL32_LibMain [Internal] Initializes the internal 'COMCTL32.DLL'.
44 * PARAMS
45 * hinstDLL [I] handle to the 'dlls' instance
46 * fdwReason [I]
47 * lpvReserved [I] reserverd, must be NULL
49 * RETURNS
50 * Success: TRUE
51 * Failure: FALSE
54 BOOL32 WINAPI
55 COMCTL32_LibMain (HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
57 TRACE (commctrl, "%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
59 switch (fdwReason) {
60 case DLL_PROCESS_ATTACH:
61 if (COMCTL32_dwProcessesAttached == 0) {
62 /* create private heap */
63 COMCTL32_hHeap = HeapCreate (0, 0x10000, 0);
64 TRACE (commctrl, "Heap created: 0x%x\n", COMCTL32_hHeap);
66 /* add global subclassing atom (used by 'tooltip' and 'updown') */
67 COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtom32A ("CC32SubclassInfo");
68 TRACE (commctrl, "Subclassing atom added: %p\n",
69 COMCTL32_aSubclass);
71 /* register all Win95 common control classes */
72 ANIMATE_Register ();
73 HEADER_Register ();
74 HOTKEY_Register ();
75 LISTVIEW_Register ();
76 PROGRESS_Register ();
77 STATUS_Register ();
78 TAB_Register ();
79 TOOLBAR_Register ();
80 TOOLTIPS_Register ();
81 TRACKBAR_Register ();
82 TREEVIEW_Register ();
83 UPDOWN_Register ();
85 COMCTL32_dwProcessesAttached++;
86 break;
88 case DLL_PROCESS_DETACH:
89 COMCTL32_dwProcessesAttached--;
90 if (COMCTL32_dwProcessesAttached == 0) {
91 /* unregister all common control classes */
92 ANIMATE_Unregister ();
93 COMBOEX_Unregister ();
94 DATETIME_Unregister ();
95 HEADER_Unregister ();
96 HOTKEY_Unregister ();
97 IPADDRESS_Unregister ();
98 LISTVIEW_Unregister ();
99 MONTHCAL_Unregister ();
100 NATIVEFONT_Unregister ();
101 PAGER_Unregister ();
102 PROGRESS_Unregister ();
103 REBAR_Unregister ();
104 STATUS_Unregister ();
105 TAB_Unregister ();
106 TOOLBAR_Unregister ();
107 TOOLTIPS_Unregister ();
108 TRACKBAR_Unregister ();
109 TREEVIEW_Unregister ();
110 UPDOWN_Unregister ();
112 /* delete global subclassing atom */
113 GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass));
114 TRACE (commctrl, "Subclassing atom deleted: %p\n",
115 COMCTL32_aSubclass);
116 COMCTL32_aSubclass = (LPSTR)NULL;
118 /* destroy private heap */
119 HeapDestroy (COMCTL32_hHeap);
120 TRACE (commctrl, "Heap destroyed: 0x%x\n", COMCTL32_hHeap);
121 COMCTL32_hHeap = (HANDLE32)NULL;
123 break;
126 return TRUE;
130 /***********************************************************************
131 * MenuHelp [COMCTL32.2]
133 * PARAMS
134 * uMsg [I]
135 * wParam [I]
136 * lParam [I]
137 * hMainMenu [I] handle to the applications main menu
138 * hInst [I]
139 * hwndStatus [I] handle to the status bar window
140 * lpwIDs [I] pointer to an array of intergers (see NOTES)
142 * RETURNS
143 * No return value
145 * NOTES
146 * The official documentation is incomplete!
149 VOID WINAPI
150 MenuHelp (UINT32 uMsg, WPARAM32 wParam, LPARAM lParam, HMENU32 hMainMenu,
151 HINSTANCE32 hInst, HWND32 hwndStatus, LPUINT32 lpwIDs)
153 UINT32 uMenuID = 0;
155 if (!IsWindow32 (hwndStatus))
156 return;
158 switch (uMsg) {
159 case WM_MENUSELECT:
160 TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
161 wParam, lParam);
163 if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
164 /* menu was closed */
165 TRACE (commctrl, "menu was closed!\n");
166 SendMessage32A (hwndStatus, SB_SIMPLE, FALSE, 0);
168 else {
169 /* menu item was selected */
170 if (HIWORD(wParam) & MF_POPUP)
171 uMenuID = (UINT32)*(lpwIDs+1);
172 else
173 uMenuID = (UINT32)LOWORD(wParam);
174 TRACE (commctrl, "uMenuID = %u\n", uMenuID);
176 if (uMenuID) {
177 CHAR szText[256];
179 if (!LoadString32A (hInst, uMenuID, szText, 256))
180 szText[0] = '\0';
182 SendMessage32A (hwndStatus, SB_SETTEXT32A,
183 255 | SBT_NOBORDERS, (LPARAM)szText);
184 SendMessage32A (hwndStatus, SB_SIMPLE, TRUE, 0);
187 break;
189 default:
190 FIXME (commctrl, "Invalid Message 0x%x!\n", uMsg);
191 break;
196 /***********************************************************************
197 * ShowHideMenuCtl [COMCTL32.3]
199 * Shows or hides controls and updates the corresponding menu item.
201 * PARAMS
202 * hwnd [I] handle to the client window.
203 * uFlags [I] menu command id.
204 * lpInfo [I] pointer to an array of integers. (See NOTES.)
206 * RETURNS
207 * Success: TRUE
208 * Failure: FALSE
210 * NOTES
211 * The official documentation is incomplete! This has been fixed.
213 * lpInfo
214 * The array of integers contains pairs of values. BOTH values of
215 * the first pair must be the handles to application's main menu.
216 * Each subsequent pair consists of a menu id and control id.
219 BOOL32 WINAPI
220 ShowHideMenuCtl (HWND32 hwnd, UINT32 uFlags, LPINT32 lpInfo)
222 LPINT32 lpMenuId;
224 TRACE (commctrl, "%x, %x, %p\n", hwnd, uFlags, lpInfo);
226 if (lpInfo == NULL)
227 return FALSE;
229 if (!(lpInfo[0]) || !(lpInfo[1]))
230 return FALSE;
232 /* search for control */
233 lpMenuId = &lpInfo[2];
234 while (*lpMenuId != uFlags)
235 lpMenuId += 2;
237 if (GetMenuState32 (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
238 /* uncheck menu item */
239 CheckMenuItem32 (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
241 /* hide control */
242 lpMenuId++;
243 SetWindowPos32 (GetDlgItem32 (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
244 SWP_HIDEWINDOW);
246 else {
247 /* check menu item */
248 CheckMenuItem32 (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
250 /* show control */
251 lpMenuId++;
252 SetWindowPos32 (GetDlgItem32 (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
253 SWP_SHOWWINDOW);
256 return TRUE;
260 /***********************************************************************
261 * GetEffectiveClientRect [COMCTL32.4]
263 * PARAMS
264 * hwnd [I] handle to the client window.
265 * lpRect [O] pointer to the rectangle of the client window
266 * lpInfo [I] pointer to an array of integers
268 * RETURNS
269 * No return value.
271 * NOTES
272 * The official documentation is incomplete!
275 VOID WINAPI
276 GetEffectiveClientRect (HWND32 hwnd, LPRECT32 lpRect, LPINT32 lpInfo)
278 RECT32 rcCtrl;
279 INT32 *lpRun;
280 HWND32 hwndCtrl;
282 TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n",
283 (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);
285 GetClientRect32 (hwnd, lpRect);
286 lpRun = lpInfo;
288 do {
289 lpRun += 2;
290 if (*lpRun == 0)
291 return;
292 lpRun++;
293 hwndCtrl = GetDlgItem32 (hwnd, *lpRun);
294 if (GetWindowLong32A (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
295 TRACE (commctrl, "control id 0x%x\n", *lpRun);
296 GetWindowRect32 (hwndCtrl, &rcCtrl);
297 MapWindowPoints32 ((HWND32)0, hwnd, (LPPOINT32)&rcCtrl, 2);
298 SubtractRect32 (lpRect, lpRect, &rcCtrl);
300 lpRun++;
301 } while (*lpRun);
305 /***********************************************************************
306 * DrawStatusText32A [COMCTL32.5]
308 * Draws text with borders, like in a status bar.
310 * PARAMS
311 * hdc [I] handle to the window's display context
312 * lprc [I] pointer to a rectangle
313 * text [I] pointer to the text
314 * style [I]
316 * RETURNS
317 * No return value.
320 VOID WINAPI
321 DrawStatusText32A (HDC32 hdc, LPRECT32 lprc, LPCSTR text, UINT32 style)
323 RECT32 r = *lprc;
324 UINT32 border = BDR_SUNKENOUTER;
326 if (style == SBT_POPOUT)
327 border = BDR_RAISEDOUTER;
328 else if (style == SBT_NOBORDERS)
329 border = 0;
331 DrawEdge32 (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
333 /* now draw text */
334 if (text) {
335 int oldbkmode = SetBkMode32 (hdc, TRANSPARENT);
336 r.left += 3;
337 DrawText32A (hdc, text, lstrlen32A(text),
338 &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);
339 if (oldbkmode != TRANSPARENT)
340 SetBkMode32(hdc, oldbkmode);
345 /***********************************************************************
346 * DrawStatusText32W [COMCTL32.28]
348 * Draws text with borders, like in a status bar.
350 * PARAMS
351 * hdc [I] handle to the window's display context
352 * lprc [I] pointer to a rectangle
353 * text [I] pointer to the text
354 * style [I]
356 * RETURNS
357 * No return value.
360 VOID WINAPI
361 DrawStatusText32W (HDC32 hdc, LPRECT32 lprc, LPCWSTR text, UINT32 style)
363 LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
364 DrawStatusText32A (hdc, lprc, p, style);
365 HeapFree (GetProcessHeap (), 0, p );
369 /***********************************************************************
370 * DrawStatusText32AW [COMCTL32.27]
372 * Draws text with borders, like in a status bar.
374 * PARAMS
375 * hdc [I] handle to the window's display context
376 * lprc [I] pointer to a rectangle
377 * text [I] pointer to the text
378 * style [I]
380 * RETURNS
381 * No return value.
383 * NOTES
384 * Calls DrawStatusText32A() or DrawStatusText32W().
387 VOID WINAPI
388 DrawStatusText32AW (HDC32 hdc, LPRECT32 lprc, LPVOID text, UINT32 style)
390 if (VERSION_OsIsUnicode())
391 DrawStatusText32W (hdc, lprc, (LPCWSTR)text, style);
392 DrawStatusText32A (hdc, lprc, (LPCSTR)text, style);
396 /***********************************************************************
397 * CreateStatusWindow32A [COMCTL32.6]
399 * Creates a status bar
401 * PARAMS
402 * style [I]
403 * text [I]
404 * parent [I] handle to the parent window
405 * wid [I] control id of the status bar
407 * RETURNS
408 * Success: handle to the control
409 * Failure: 0
412 HWND32 WINAPI
413 CreateStatusWindow32A (INT32 style, LPCSTR text, HWND32 parent, UINT32 wid)
415 return CreateWindow32A(STATUSCLASSNAME32A, text, style,
416 CW_USEDEFAULT32, CW_USEDEFAULT32,
417 CW_USEDEFAULT32, CW_USEDEFAULT32,
418 parent, wid, 0, 0);
422 /***********************************************************************
423 * CreateStatusWindow32W [COMCTL32.22] Creates a status bar control
425 * PARAMS
426 * style [I]
427 * text [I]
428 * parent [I] handle to the parent window
429 * wid [I] control id of the status bar
431 * RETURNS
432 * Success: handle to the control
433 * Failure: 0
436 HWND32 WINAPI
437 CreateStatusWindow32W (INT32 style, LPCWSTR text, HWND32 parent, UINT32 wid)
439 return CreateWindow32W(STATUSCLASSNAME32W, text, style,
440 CW_USEDEFAULT32, CW_USEDEFAULT32,
441 CW_USEDEFAULT32, CW_USEDEFAULT32,
442 parent, wid, 0, 0);
446 /***********************************************************************
447 * CreateStatusWindow32AW [COMCTL32.21] Creates a status bar control
449 * PARAMS
450 * style [I]
451 * text [I]
452 * parent [I] handle to the parent window
453 * wid [I] control id of the status bar
455 * RETURNS
456 * Success: handle to the control
457 * Failure: 0
460 HWND32 WINAPI
461 CreateStatusWindow32AW (INT32 style, LPVOID text, HWND32 parent, UINT32 wid)
463 if (VERSION_OsIsUnicode())
464 return CreateStatusWindow32W (style, (LPCWSTR)text, parent, wid);
465 return CreateStatusWindow32A (style, (LPCSTR)text, parent, wid);
469 /***********************************************************************
470 * CreateUpDownControl [COMCTL32.16] Creates an Up-Down control
472 * PARAMS
473 * style
476 * cx
477 * cy
478 * parent
479 * id
480 * inst
481 * buddy
482 * maxVal [I]
483 * minVal [I]
484 * curVal [I]
486 * RETURNS
487 * Success: handle to the control
488 * Failure: 0
491 HWND32 WINAPI
492 CreateUpDownControl (DWORD style, INT32 x, INT32 y, INT32 cx, INT32 cy,
493 HWND32 parent, INT32 id, HINSTANCE32 inst,
494 HWND32 buddy, INT32 maxVal, INT32 minVal, INT32 curVal)
496 HWND32 hUD =
497 CreateWindow32A (UPDOWN_CLASS32A, 0, style, x, y, cx, cy,
498 parent, id, inst, 0);
499 if (hUD) {
500 SendMessage32A (hUD, UDM_SETBUDDY, buddy, 0);
501 SendMessage32A (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
502 SendMessage32A (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
505 return hUD;
509 /***********************************************************************
510 * InitCommonControls [COMCTL32.17]
512 * Registers the common controls.
514 * PARAMS
515 * No parameters.
517 * RETURNS
518 * No return values.
520 * NOTES
521 * This function is just a dummy.
522 * The Win95 controls are registered at the DLL's initialization.
523 * To register other controls InitCommonControlsEx must be used.
526 VOID WINAPI
527 InitCommonControls (VOID)
532 /***********************************************************************
533 * InitCommonControlsEx [COMCTL32.81]
535 * Registers the common controls.
537 * PARAMS
538 * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
540 * RETURNS
541 * Success: TRUE
542 * Failure: FALSE
544 * NOTES
545 * Only the additinal common controls are registered by this function.
546 * The Win95 controls are registered at the DLL's initialization.
549 BOOL32 WINAPI
550 InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
552 INT32 cCount;
553 DWORD dwMask;
555 if (!lpInitCtrls)
556 return FALSE;
557 if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
558 return FALSE;
560 TRACE(commctrl,"(0x%08lx)\n", lpInitCtrls->dwICC);
562 for (cCount = 0; cCount < 32; cCount++) {
563 dwMask = 1 << cCount;
564 if (!(lpInitCtrls->dwICC & dwMask))
565 continue;
567 switch (lpInitCtrls->dwICC & dwMask) {
568 /* dummy initialization */
569 case ICC_ANIMATE_CLASS:
570 case ICC_BAR_CLASSES:
571 case ICC_LISTVIEW_CLASSES:
572 case ICC_TREEVIEW_CLASSES:
573 case ICC_TAB_CLASSES:
574 case ICC_UPDOWN_CLASS:
575 case ICC_PROGRESS_CLASS:
576 case ICC_HOTKEY_CLASS:
577 break;
579 /* advanced classes - not included in Win95 */
580 case ICC_DATE_CLASSES:
581 MONTHCAL_Register ();
582 DATETIME_Register ();
583 break;
585 case ICC_USEREX_CLASSES:
586 COMBOEX_Register ();
587 break;
589 case ICC_COOL_CLASSES:
590 REBAR_Register ();
591 break;
593 case ICC_INTERNET_CLASSES:
594 IPADDRESS_Register ();
595 break;
597 case ICC_PAGESCROLLER_CLASS:
598 PAGER_Register ();
599 break;
601 case ICC_NATIVEFNTCTL_CLASS:
602 NATIVEFONT_Register ();
603 break;
605 default:
606 FIXME (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask);
607 break;
611 return TRUE;
615 /***********************************************************************
616 * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
618 * PARAMS
619 * hwnd
620 * style
621 * wID
622 * nBitmaps
623 * hBMInst
624 * wBMID
625 * lpButtons
626 * iNumButtons
627 * dxButton
628 * dyButton
629 * dxBitmap
630 * dyBitmap
631 * uStructSize
633 * RETURNS
634 * Success: handle to the tool bar control
635 * Failure: 0
638 HWND32 WINAPI
639 CreateToolbarEx (HWND32 hwnd, DWORD style, UINT32 wID, INT32 nBitmaps,
640 HINSTANCE32 hBMInst, UINT32 wBMID, LPCTBBUTTON lpButtons,
641 INT32 iNumButtons, INT32 dxButton, INT32 dyButton,
642 INT32 dxBitmap, INT32 dyBitmap, UINT32 uStructSize)
644 HWND32 hwndTB =
645 CreateWindowEx32A (0, TOOLBARCLASSNAME32A, "", style, 0, 0, 0, 0,
646 hwnd, (HMENU32)wID, 0, NULL);
647 if(hwndTB) {
648 TBADDBITMAP tbab;
650 SendMessage32A (hwndTB, TB_BUTTONSTRUCTSIZE,
651 (WPARAM32)uStructSize, 0);
653 /* set bitmap and button size */
654 if (hBMInst == HINST_COMMCTRL) {
655 if (wBMID & 1) {
656 SendMessage32A (hwndTB, TB_SETBITMAPSIZE, 0,
657 MAKELPARAM(26, 25));
658 SendMessage32A (hwndTB, TB_SETBUTTONSIZE, 0,
659 MAKELPARAM(33, 32));
661 else {
662 SendMessage32A (hwndTB, TB_SETBITMAPSIZE, 0,
663 MAKELPARAM(16, 15));
664 SendMessage32A (hwndTB, TB_SETBUTTONSIZE, 0,
665 MAKELPARAM(23, 22));
668 else {
669 SendMessage32A (hwndTB, TB_SETBITMAPSIZE, 0,
670 MAKELPARAM((WORD)dyBitmap, (WORD)dxBitmap));
671 SendMessage32A (hwndTB, TB_SETBUTTONSIZE, 0,
672 MAKELPARAM((WORD)dyButton, (WORD)dxButton));
675 /* add bitmaps */
676 tbab.hInst = hBMInst;
677 tbab.nID = wBMID;
678 SendMessage32A (hwndTB, TB_ADDBITMAP,
679 (WPARAM32)nBitmaps, (LPARAM)&tbab);
681 /* add buttons */
682 SendMessage32A (hwndTB, TB_ADDBUTTONS32A,
683 (WPARAM32)iNumButtons, (LPARAM)lpButtons);
686 return hwndTB;
690 /***********************************************************************
691 * CreateMappedBitmap [COMCTL32.8]
693 * PARAMS
694 * hInstance
695 * idBitmap
696 * wFlags
697 * lpColorMap
698 * iNumMaps
700 * RETURNS
701 * Success: bitmap handle
702 * Failure: 0
705 HBITMAP32 WINAPI
706 CreateMappedBitmap (HINSTANCE32 hInstance, INT32 idBitmap, UINT32 wFlags,
707 LPCOLORMAP lpColorMap, INT32 iNumMaps)
709 HGLOBAL32 hglb;
710 HRSRC32 hRsrc;
711 LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
712 UINT32 nSize, nColorTableSize;
713 DWORD *pColorTable;
714 INT32 iColor, i, iMaps, nWidth, nHeight;
715 HDC32 hdcScreen;
716 HBITMAP32 hbm;
717 LPCOLORMAP sysColorMap;
718 COLORMAP internalColorMap[4] =
719 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
721 /* initialize pointer to colortable and default color table */
722 if (lpColorMap) {
723 iMaps = iNumMaps;
724 sysColorMap = lpColorMap;
726 else {
727 internalColorMap[0].to = GetSysColor32 (COLOR_BTNTEXT);
728 internalColorMap[1].to = GetSysColor32 (COLOR_BTNSHADOW);
729 internalColorMap[2].to = GetSysColor32 (COLOR_BTNFACE);
730 internalColorMap[3].to = GetSysColor32 (COLOR_BTNHIGHLIGHT);
731 iMaps = 4;
732 sysColorMap = (LPCOLORMAP)internalColorMap;
735 hRsrc = FindResource32A (hInstance, (LPSTR)idBitmap, RT_BITMAP32A);
736 if (hRsrc == 0)
737 return 0;
738 hglb = LoadResource32 (hInstance, hRsrc);
739 if (hglb == 0)
740 return 0;
741 lpBitmap = (LPBITMAPINFOHEADER)LockResource32 (hglb);
742 if (lpBitmap == NULL)
743 return 0;
745 nColorTableSize = (1 << lpBitmap->biBitCount);
746 nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
747 lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc32 (GMEM_FIXED, nSize);
748 if (lpBitmapInfo == NULL)
749 return 0;
750 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
752 pColorTable = (DWORD*)(((LPBYTE)lpBitmapInfo)+(UINT32)lpBitmapInfo->biSize);
754 for (iColor = 0; iColor < nColorTableSize; iColor++) {
755 for (i = 0; i < iMaps; i++) {
756 if (pColorTable[iColor] == sysColorMap[i].from) {
757 #if 0
758 if (wFlags & CBS_MASKED) {
759 if (sysColorMap[i].to != COLOR_BTNTEXT)
760 pColorTable[iColor] = RGB(255, 255, 255);
762 else
763 #endif
764 pColorTable[iColor] = sysColorMap[i].to;
765 break;
770 nWidth = (INT32)lpBitmapInfo->biWidth;
771 nHeight = (INT32)lpBitmapInfo->biHeight;
772 hdcScreen = GetDC32 ((HWND32)0);
773 hbm = CreateCompatibleBitmap32 (hdcScreen, nWidth, nHeight);
774 if (hbm) {
775 HDC32 hdcDst = CreateCompatibleDC32 (hdcScreen);
776 HBITMAP32 hbmOld = SelectObject32 (hdcDst, hbm);
777 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
778 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
779 StretchDIBits32 (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
780 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
781 SRCCOPY);
782 SelectObject32 (hdcDst, hbmOld);
783 DeleteDC32 (hdcDst);
785 ReleaseDC32 ((HWND32)0, hdcScreen);
786 GlobalFree32 ((HGLOBAL32)lpBitmapInfo);
787 FreeResource32 (hglb);
789 return hbm;
793 /***********************************************************************
794 * CreateToolbar [COMCTL32.7] Creates a tool bar control
796 * PARAMS
797 * hwnd
798 * style
799 * wID
800 * nBitmaps
801 * hBMInst
802 * wBMID
803 * lpButtons
804 * iNumButtons
806 * RETURNS
807 * Success: handle to the tool bar control
808 * Failure: 0
810 * NOTES
811 * Do not use this functions anymore. Use CreateToolbarEx instead.
814 HWND32 WINAPI
815 CreateToolbar (HWND32 hwnd, DWORD style, UINT32 wID, INT32 nBitmaps,
816 HINSTANCE32 hBMInst, UINT32 wBMID,
817 LPCOLDTBBUTTON lpButtons,INT32 iNumButtons)
819 return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
820 hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
821 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
825 /***********************************************************************
826 * DllGetVersion [COMCTL32.25]
828 * Retrieves version information of the 'COMCTL32.DLL'
830 * PARAMS
831 * pdvi [O] pointer to version information structure.
833 * RETURNS
834 * Success: S_OK
835 * Failure: E_INVALIDARG
837 * NOTES
838 * Returns version of a comctl32.dll from IE4.01 SP1.
841 HRESULT WINAPI
842 COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
844 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
845 WARN (commctrl, "wrong DLLVERSIONINFO size from app");
846 return E_INVALIDARG;
849 pdvi->dwMajorVersion = 4;
850 pdvi->dwMinorVersion = 72;
851 pdvi->dwBuildNumber = 3110;
852 pdvi->dwPlatformID = 1;
854 TRACE (commctrl, "%lu.%lu.%lu.%lu\n",
855 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
856 pdvi->dwBuildNumber, pdvi->dwPlatformID);
858 return S_OK;