Change the AddBitmap function. Implement flat toolbar. Change
[wine/hacks.git] / dlls / comctl32 / commctrl.c
blobf02a9c4329b21dc5ab313f30714c6a7eee41129d
1 /*
2 * Common controls functions
4 * Copyright 1997 Dimitrie O. Paun
5 * Copyright 1998 Eric Kohl
7 */
9 #include "winbase.h"
10 #include "heap.h"
11 #include "commctrl.h"
12 #include "animate.h"
13 #include "comboex.h"
14 #include "datetime.h"
15 #include "flatsb.h"
16 #include "header.h"
17 #include "hotkey.h"
18 #include "ipaddress.h"
19 #include "listview.h"
20 #include "monthcal.h"
21 #include "nativefont.h"
22 #include "pager.h"
23 #include "progress.h"
24 #include "propsheet.h"
25 #include "rebar.h"
26 #include "status.h"
27 #include "tab.h"
28 #include "toolbar.h"
29 #include "tooltips.h"
30 #include "trackbar.h"
31 #include "treeview.h"
32 #include "updown.h"
33 #include "debug.h"
34 #include "winerror.h"
37 HANDLE COMCTL32_hHeap = (HANDLE)NULL;
38 DWORD COMCTL32_dwProcessesAttached = 0;
39 LPSTR COMCTL32_aSubclass = (LPSTR)NULL;
42 /***********************************************************************
43 * COMCTL32_LibMain [Internal] Initializes the internal 'COMCTL32.DLL'.
45 * PARAMS
46 * hinstDLL [I] handle to the 'dlls' instance
47 * fdwReason [I]
48 * lpvReserved [I] reserverd, must be NULL
50 * RETURNS
51 * Success: TRUE
52 * Failure: FALSE
55 BOOL WINAPI
56 COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
58 TRACE (commctrl, "%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
60 switch (fdwReason) {
61 case DLL_PROCESS_ATTACH:
62 if (COMCTL32_dwProcessesAttached == 0) {
63 /* create private heap */
64 COMCTL32_hHeap = HeapCreate (0, 0x10000, 0);
65 TRACE (commctrl, "Heap created: 0x%x\n", COMCTL32_hHeap);
67 /* add global subclassing atom (used by 'tooltip' and 'updown') */
68 COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
69 TRACE (commctrl, "Subclassing atom added: %p\n",
70 COMCTL32_aSubclass);
72 /* register all Win95 common control classes */
73 ANIMATE_Register ();
74 FLATSB_Register ();
75 HEADER_Register ();
76 HOTKEY_Register ();
77 LISTVIEW_Register ();
78 PROGRESS_Register ();
79 PROPSHEET_Register ();
80 STATUS_Register ();
81 TAB_Register ();
82 TOOLBAR_Register ();
83 TOOLTIPS_Register ();
84 TRACKBAR_Register ();
85 TREEVIEW_Register ();
86 UPDOWN_Register ();
88 COMCTL32_dwProcessesAttached++;
89 break;
91 case DLL_PROCESS_DETACH:
92 COMCTL32_dwProcessesAttached--;
93 if (COMCTL32_dwProcessesAttached == 0) {
94 /* unregister all common control classes */
95 ANIMATE_Unregister ();
96 COMBOEX_Unregister ();
97 DATETIME_Unregister ();
98 FLATSB_Unregister ();
99 HEADER_Unregister ();
100 HOTKEY_Unregister ();
101 IPADDRESS_Unregister ();
102 LISTVIEW_Unregister ();
103 MONTHCAL_Unregister ();
104 NATIVEFONT_Unregister ();
105 PAGER_Unregister ();
106 PROGRESS_Unregister ();
107 PROPSHEET_UnRegister ();
108 REBAR_Unregister ();
109 STATUS_Unregister ();
110 TAB_Unregister ();
111 TOOLBAR_Unregister ();
112 TOOLTIPS_Unregister ();
113 TRACKBAR_Unregister ();
114 TREEVIEW_Unregister ();
115 UPDOWN_Unregister ();
117 /* delete global subclassing atom */
118 GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass));
119 TRACE (commctrl, "Subclassing atom deleted: %p\n",
120 COMCTL32_aSubclass);
121 COMCTL32_aSubclass = (LPSTR)NULL;
123 /* destroy private heap */
124 HeapDestroy (COMCTL32_hHeap);
125 TRACE (commctrl, "Heap destroyed: 0x%x\n", COMCTL32_hHeap);
126 COMCTL32_hHeap = (HANDLE)NULL;
128 break;
131 return TRUE;
135 /***********************************************************************
136 * MenuHelp [COMCTL32.2]
138 * PARAMS
139 * uMsg [I] message (WM_MENUSELECT) (see NOTES)
140 * wParam [I] wParam of the message uMsg
141 * lParam [I] lParam of the message uMsg
142 * hMainMenu [I] handle to the application's main menu
143 * hInst [I] handle to the module that contains string resources
144 * hwndStatus [I] handle to the status bar window
145 * lpwIDs [I] pointer to an array of intergers (see NOTES)
147 * RETURNS
148 * No return value
150 * NOTES
151 * The official documentation is incomplete!
152 * This is the correct documentation:
154 * uMsg:
155 * MenuHelp() does NOT handle WM_COMMAND messages! It only handes
156 * WM_MENUSELECT messages.
158 * lpwIDs:
159 * (will be written ...)
162 VOID WINAPI
163 MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
164 HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)
166 UINT uMenuID = 0;
168 if (!IsWindow (hwndStatus))
169 return;
171 switch (uMsg) {
172 case WM_MENUSELECT:
173 TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
174 wParam, lParam);
176 if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
177 /* menu was closed */
178 TRACE (commctrl, "menu was closed!\n");
179 SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
181 else {
182 /* menu item was selected */
183 if (HIWORD(wParam) & MF_POPUP)
184 uMenuID = (UINT)*(lpwIDs+1);
185 else
186 uMenuID = (UINT)LOWORD(wParam);
187 TRACE (commctrl, "uMenuID = %u\n", uMenuID);
189 if (uMenuID) {
190 CHAR szText[256];
192 if (!LoadStringA (hInst, uMenuID, szText, 256))
193 szText[0] = '\0';
195 SendMessageA (hwndStatus, SB_SETTEXTA,
196 255 | SBT_NOBORDERS, (LPARAM)szText);
197 SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
200 break;
202 default:
203 FIXME (commctrl, "Invalid Message 0x%x!\n", uMsg);
204 break;
209 /***********************************************************************
210 * ShowHideMenuCtl [COMCTL32.3]
212 * Shows or hides controls and updates the corresponding menu item.
214 * PARAMS
215 * hwnd [I] handle to the client window.
216 * uFlags [I] menu command id.
217 * lpInfo [I] pointer to an array of integers. (See NOTES.)
219 * RETURNS
220 * Success: TRUE
221 * Failure: FALSE
223 * NOTES
224 * The official documentation is incomplete!
225 * This is the correct documentation:
227 * hwnd
228 * Handle to the window that contains the menu and controls.
230 * uFlags
231 * Identifier of the menu item to receive or loose a check mark.
233 * lpInfo
234 * The array of integers contains pairs of values. BOTH values of
235 * the first pair must be the handles to the application's main menu.
236 * Each subsequent pair consists of a menu id and control id.
239 BOOL WINAPI
240 ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)
242 LPINT lpMenuId;
244 TRACE (commctrl, "%x, %x, %p\n", hwnd, uFlags, lpInfo);
246 if (lpInfo == NULL)
247 return FALSE;
249 if (!(lpInfo[0]) || !(lpInfo[1]))
250 return FALSE;
252 /* search for control */
253 lpMenuId = &lpInfo[2];
254 while (*lpMenuId != uFlags)
255 lpMenuId += 2;
257 if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
258 /* uncheck menu item */
259 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
261 /* hide control */
262 lpMenuId++;
263 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
264 SWP_HIDEWINDOW);
266 else {
267 /* check menu item */
268 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
270 /* show control */
271 lpMenuId++;
272 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
273 SWP_SHOWWINDOW);
276 return TRUE;
280 /***********************************************************************
281 * GetEffectiveClientRect [COMCTL32.4]
283 * PARAMS
284 * hwnd [I] handle to the client window.
285 * lpRect [O] pointer to the rectangle of the client window
286 * lpInfo [I] pointer to an array of integers (see NOTES)
288 * RETURNS
289 * No return value.
291 * NOTES
292 * The official documentation is incomplete!
293 * This is the correct documentation:
295 * lpInfo
296 * (will be written...)
299 VOID WINAPI
300 GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
302 RECT rcCtrl;
303 INT *lpRun;
304 HWND hwndCtrl;
306 TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n",
307 (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);
309 GetClientRect (hwnd, lpRect);
310 lpRun = lpInfo;
312 do {
313 lpRun += 2;
314 if (*lpRun == 0)
315 return;
316 lpRun++;
317 hwndCtrl = GetDlgItem (hwnd, *lpRun);
318 if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
319 TRACE (commctrl, "control id 0x%x\n", *lpRun);
320 GetWindowRect (hwndCtrl, &rcCtrl);
321 MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
322 SubtractRect (lpRect, lpRect, &rcCtrl);
324 lpRun++;
325 } while (*lpRun);
329 /***********************************************************************
330 * DrawStatusText32A [COMCTL32.5][COMCTL32.27]
332 * Draws text with borders, like in a status bar.
334 * PARAMS
335 * hdc [I] handle to the window's display context
336 * lprc [I] pointer to a rectangle
337 * text [I] pointer to the text
338 * style [I] drawing style
340 * RETURNS
341 * No return value.
343 * NOTES
344 * The style variable can have one of the following values:
345 * (will be written ...)
348 VOID WINAPI
349 DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
351 RECT r = *lprc;
352 UINT border = BDR_SUNKENOUTER;
354 if (style == SBT_POPOUT)
355 border = BDR_RAISEDOUTER;
356 else if (style == SBT_NOBORDERS)
357 border = 0;
359 DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
361 /* now draw text */
362 if (text) {
363 int oldbkmode = SetBkMode (hdc, TRANSPARENT);
364 r.left += 3;
365 DrawTextA (hdc, text, lstrlenA(text),
366 &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);
367 if (oldbkmode != TRANSPARENT)
368 SetBkMode(hdc, oldbkmode);
373 /***********************************************************************
374 * DrawStatusText32W [COMCTL32.28]
376 * Draws text with borders, like in a status bar.
378 * PARAMS
379 * hdc [I] handle to the window's display context
380 * lprc [I] pointer to a rectangle
381 * text [I] pointer to the text
382 * style [I] drawing style
384 * RETURNS
385 * No return value.
388 VOID WINAPI
389 DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
391 LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
392 DrawStatusTextA (hdc, lprc, p, style);
393 HeapFree (GetProcessHeap (), 0, p );
397 /***********************************************************************
398 * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21]
400 * Creates a status bar
402 * PARAMS
403 * style [I] window style
404 * text [I] pointer to the window text
405 * parent [I] handle to the parent window
406 * wid [I] control id of the status bar
408 * RETURNS
409 * Success: handle to the status window
410 * Failure: 0
413 HWND WINAPI
414 CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
416 return CreateWindowA(STATUSCLASSNAMEA, text, style,
417 CW_USEDEFAULT, CW_USEDEFAULT,
418 CW_USEDEFAULT, CW_USEDEFAULT,
419 parent, wid, 0, 0);
423 /***********************************************************************
424 * CreateStatusWindow32W [COMCTL32.22] Creates a status bar control
426 * PARAMS
427 * style [I] window style
428 * text [I] pointer to the window text
429 * parent [I] handle to the parent window
430 * wid [I] control id of the status bar
432 * RETURNS
433 * Success: handle to the status window
434 * Failure: 0
437 HWND WINAPI
438 CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
440 return CreateWindowW(STATUSCLASSNAMEW, text, style,
441 CW_USEDEFAULT, CW_USEDEFAULT,
442 CW_USEDEFAULT, CW_USEDEFAULT,
443 parent, wid, 0, 0);
447 /***********************************************************************
448 * CreateUpDownControl [COMCTL32.16] Creates an up-down control
450 * PARAMS
451 * style [I] window styles
452 * x [I] horizontal position of the control
453 * y [I] vertical position of the control
454 * cx [I] with of the control
455 * cy [I] height of the control
456 * parent [I] handle to the parent window
457 * id [I] the control's identifier
458 * inst [I] handle to the application's module instance
459 * buddy [I] handle to the buddy window, can be NULL
460 * maxVal [I] upper limit of the control
461 * minVal [I] lower limit of the control
462 * curVal [I] current value of the control
464 * RETURNS
465 * Success: handle to the updown control
466 * Failure: 0
469 HWND WINAPI
470 CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
471 HWND parent, INT id, HINSTANCE inst,
472 HWND buddy, INT maxVal, INT minVal, INT curVal)
474 HWND hUD =
475 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
476 parent, id, inst, 0);
477 if (hUD) {
478 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
479 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
480 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
483 return hUD;
487 /***********************************************************************
488 * InitCommonControls [COMCTL32.17]
490 * Registers the common controls.
492 * PARAMS
493 * No parameters.
495 * RETURNS
496 * No return values.
498 * NOTES
499 * This function is just a dummy.
500 * The Win95 controls are registered at the DLL's initialization.
501 * To register other controls InitCommonControlsEx() must be used.
504 VOID WINAPI
505 InitCommonControls (VOID)
510 /***********************************************************************
511 * InitCommonControlsEx [COMCTL32.81]
513 * Registers the common controls.
515 * PARAMS
516 * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
518 * RETURNS
519 * Success: TRUE
520 * Failure: FALSE
522 * NOTES
523 * Only the additinal common controls are registered by this function.
524 * The Win95 controls are registered at the DLL's initialization.
527 BOOL WINAPI
528 InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
530 INT cCount;
531 DWORD dwMask;
533 if (!lpInitCtrls)
534 return FALSE;
535 if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
536 return FALSE;
538 TRACE(commctrl,"(0x%08lx)\n", lpInitCtrls->dwICC);
540 for (cCount = 0; cCount < 32; cCount++) {
541 dwMask = 1 << cCount;
542 if (!(lpInitCtrls->dwICC & dwMask))
543 continue;
545 switch (lpInitCtrls->dwICC & dwMask) {
546 /* dummy initialization */
547 case ICC_ANIMATE_CLASS:
548 case ICC_BAR_CLASSES:
549 case ICC_LISTVIEW_CLASSES:
550 case ICC_TREEVIEW_CLASSES:
551 case ICC_TAB_CLASSES:
552 case ICC_UPDOWN_CLASS:
553 case ICC_PROGRESS_CLASS:
554 case ICC_HOTKEY_CLASS:
555 break;
557 /* advanced classes - not included in Win95 */
558 case ICC_DATE_CLASSES:
559 MONTHCAL_Register ();
560 DATETIME_Register ();
561 break;
563 case ICC_USEREX_CLASSES:
564 COMBOEX_Register ();
565 break;
567 case ICC_COOL_CLASSES:
568 REBAR_Register ();
569 break;
571 case ICC_INTERNET_CLASSES:
572 IPADDRESS_Register ();
573 break;
575 case ICC_PAGESCROLLER_CLASS:
576 PAGER_Register ();
577 break;
579 case ICC_NATIVEFNTCTL_CLASS:
580 NATIVEFONT_Register ();
581 break;
583 default:
584 FIXME (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask);
585 break;
589 return TRUE;
593 /***********************************************************************
594 * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
596 * PARAMS
597 * hwnd
598 * style
599 * wID
600 * nBitmaps
601 * hBMInst
602 * wBMID
603 * lpButtons
604 * iNumButtons
605 * dxButton
606 * dyButton
607 * dxBitmap
608 * dyBitmap
609 * uStructSize
611 * RETURNS
612 * Success: handle to the tool bar control
613 * Failure: 0
616 HWND WINAPI
617 CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
618 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
619 INT iNumButtons, INT dxButton, INT dyButton,
620 INT dxBitmap, INT dyBitmap, UINT uStructSize)
622 HWND hwndTB =
623 CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style, 0, 0, 0, 0,
624 hwnd, (HMENU)wID, 0, NULL);
625 if(hwndTB) {
626 TBADDBITMAP tbab;
628 SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
629 (WPARAM)uStructSize, 0);
631 /* set bitmap and button size */
632 /*If CreateToolbarEx receive 0, windows set default values*/
633 if (dyBitmap < 0)
634 dyBitmap = 16;
635 if (dxBitmap < 0)
636 dxBitmap = 16;
638 SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
639 MAKELPARAM((WORD)dyBitmap, (WORD)dxBitmap));
640 SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
641 MAKELPARAM((WORD)dyButton, (WORD)dxButton));
644 /* add bitmaps */
645 if (nBitmaps > 0)
647 tbab.hInst = hBMInst;
648 tbab.nID = wBMID;
650 SendMessageA (hwndTB, TB_ADDBITMAP,
651 (WPARAM)nBitmaps, (LPARAM)&tbab);
653 /* add buttons */
654 if(iNumButtons > 0)
655 SendMessageA (hwndTB, TB_ADDBUTTONSA,
656 (WPARAM)iNumButtons, (LPARAM)lpButtons);
659 return hwndTB;
663 /***********************************************************************
664 * CreateMappedBitmap [COMCTL32.8]
666 * PARAMS
667 * hInstance [I]
668 * idBitmap [I]
669 * wFlags [I]
670 * lpColorMap [I]
671 * iNumMaps [I]
673 * RETURNS
674 * Success: handle to the new bitmap
675 * Failure: 0
678 HBITMAP WINAPI
679 CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
680 LPCOLORMAP lpColorMap, INT iNumMaps)
682 HGLOBAL hglb;
683 HRSRC hRsrc;
684 LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
685 UINT nSize, nColorTableSize;
686 DWORD *pColorTable;
687 INT iColor, i, iMaps, nWidth, nHeight;
688 HDC hdcScreen;
689 HBITMAP hbm;
690 LPCOLORMAP sysColorMap;
691 COLORMAP internalColorMap[4] =
692 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
694 /* initialize pointer to colortable and default color table */
695 if (lpColorMap) {
696 iMaps = iNumMaps;
697 sysColorMap = lpColorMap;
699 else {
700 internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
701 internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
702 internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
703 internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
704 iMaps = 4;
705 sysColorMap = (LPCOLORMAP)internalColorMap;
708 hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
709 if (hRsrc == 0)
710 return 0;
711 hglb = LoadResource (hInstance, hRsrc);
712 if (hglb == 0)
713 return 0;
714 lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
715 if (lpBitmap == NULL)
716 return 0;
718 nColorTableSize = (1 << lpBitmap->biBitCount);
719 nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
720 lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
721 if (lpBitmapInfo == NULL)
722 return 0;
723 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
725 pColorTable = (DWORD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
727 for (iColor = 0; iColor < nColorTableSize; iColor++) {
728 for (i = 0; i < iMaps; i++) {
729 if (pColorTable[iColor] == sysColorMap[i].from) {
730 #if 0
731 if (wFlags & CBS_MASKED) {
732 if (sysColorMap[i].to != COLOR_BTNTEXT)
733 pColorTable[iColor] = RGB(255, 255, 255);
735 else
736 #endif
737 pColorTable[iColor] = sysColorMap[i].to;
738 break;
743 nWidth = (INT)lpBitmapInfo->biWidth;
744 nHeight = (INT)lpBitmapInfo->biHeight;
745 hdcScreen = GetDC ((HWND)0);
746 hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
747 if (hbm) {
748 HDC hdcDst = CreateCompatibleDC (hdcScreen);
749 HBITMAP hbmOld = SelectObject (hdcDst, hbm);
750 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
751 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
752 StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
753 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
754 SRCCOPY);
755 SelectObject (hdcDst, hbmOld);
756 DeleteDC (hdcDst);
758 ReleaseDC ((HWND)0, hdcScreen);
759 GlobalFree ((HGLOBAL)lpBitmapInfo);
760 FreeResource (hglb);
762 return hbm;
766 /***********************************************************************
767 * CreateToolbar [COMCTL32.7] Creates a tool bar control
769 * PARAMS
770 * hwnd
771 * style
772 * wID
773 * nBitmaps
774 * hBMInst
775 * wBMID
776 * lpButtons
777 * iNumButtons
779 * RETURNS
780 * Success: handle to the tool bar control
781 * Failure: 0
783 * NOTES
784 * Do not use this functions anymore. Use CreateToolbarEx instead.
787 HWND WINAPI
788 CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
789 HINSTANCE hBMInst, UINT wBMID,
790 LPCOLDTBBUTTON lpButtons,INT iNumButtons)
792 return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
793 hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
794 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
798 /***********************************************************************
799 * DllGetVersion [COMCTL32.25]
801 * Retrieves version information of the 'COMCTL32.DLL'
803 * PARAMS
804 * pdvi [O] pointer to version information structure.
806 * RETURNS
807 * Success: S_OK
808 * Failure: E_INVALIDARG
810 * NOTES
811 * Returns version of a comctl32.dll from IE4.01 SP1.
814 HRESULT WINAPI
815 COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
817 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
818 WARN (commctrl, "wrong DLLVERSIONINFO size from app");
819 return E_INVALIDARG;
822 pdvi->dwMajorVersion = 4;
823 pdvi->dwMinorVersion = 72;
824 pdvi->dwBuildNumber = 3110;
825 pdvi->dwPlatformID = 1;
827 TRACE (commctrl, "%lu.%lu.%lu.%lu\n",
828 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
829 pdvi->dwBuildNumber, pdvi->dwPlatformID);
831 return S_OK;