source: trunk/src/comctl32/comctl32.c@ 1036

Last change on this file since 1036 was 925, checked in by cbratschi, 26 years ago

ListView wasn't registered

File size: 21.3 KB
Line 
1/* $Id: comctl32.c,v 1.9 1999-09-13 18:49:02 cbratschi Exp $ */
2/*
3 * Win32 common controls implementation
4 *
5 * Copyright (C) 1999 Achim Hasenmueller
6 *
7 * Based on the work of the WINE group (www.winehq.com)
8 *
9 *
10 * Project Odin Software License can be found in LICENSE.TXT
11 *
12 */
13
14#include "comctl32.h"
15#include "winerror.h"
16#include "progress.h"
17#include "comboex.h"
18#include "animate.h"
19#include "datetime.h"
20#include "flatsb.h"
21#include "hotkey.h"
22#include "ipaddress.h"
23#include "monthcal.h"
24#include "nativefont.h"
25#include "pager.h"
26#include "tab.h"
27#include "status.h"
28#include "header.h"
29#include "updown.h"
30#include "rebar.h"
31#include "trackbar.h"
32#include "tooltips.h"
33#include "toolbar.h"
34#include "treeview.h"
35#include "listview.h"
36
37HANDLE COMCTL32_hHeap = (HANDLE)NULL;
38HMODULE COMCTL32_hModule = 0;
39LPSTR COMCTL32_aSubclass = (LPSTR)NULL;
40
41void CDECL RegisterCOMCTL32WindowClasses(unsigned long hinstDLL)
42{
43 /* create private heap */
44 COMCTL32_hHeap = HeapCreate(0, 0x10000, 0);
45 /* add global subclassing atom (used by 'tooltip' and 'updown') */
46 COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
47 /* This will be wrong for any other process attching in this address-space! */
48 COMCTL32_hModule = (HMODULE)hinstDLL;
49
50 /* register controls */
51 PROGRESS_Register();
52 COMBOEX_Register();
53 ANIMATE_Register();
54 DATETIME_Register();
55 FLATSB_Register();
56 HOTKEY_Register();
57 IPADDRESS_Register();
58 MONTHCAL_Register();
59 NATIVEFONT_Register();
60 PAGER_Register();
61 TAB_Register();
62 STATUS_Register();
63 HEADER_Register();
64 UPDOWN_Register();
65 REBAR_Register();
66 TRACKBAR_Register();
67 TOOLTIPS_Register();
68 TOOLBAR_Register();
69 TREEVIEW_Register();
70 LISTVIEW_Register();
71}
72
73void CDECL UnregisterCOMCTL32WindowClasses(void)
74{
75 /* unregister controls */
76 PROGRESS_Unregister();
77 COMBOEX_Unregister();
78 ANIMATE_Unregister();
79 DATETIME_Unregister();
80 FLATSB_Unregister();
81 HOTKEY_Unregister();
82 IPADDRESS_Unregister();
83 MONTHCAL_Unregister();
84 NATIVEFONT_Unregister();
85 PAGER_Unregister();
86 TAB_Unregister();
87 STATUS_Unregister();
88 HEADER_Unregister();
89 UPDOWN_Unregister();
90 REBAR_Unregister();
91 TRACKBAR_Unregister();
92 TOOLTIPS_Unregister();
93 TOOLBAR_Unregister();
94 TREEVIEW_Unregister();
95 LISTVIEW_Unregister();
96
97 /* destroy private heap */
98 HeapDestroy(COMCTL32_hHeap);
99 COMCTL32_hHeap = (HANDLE)NULL;
100}
101
102/***********************************************************************
103 * MenuHelp [COMCTL32.2]
104 *
105 * PARAMS
106 * uMsg [I] message (WM_MENUSELECT) (see NOTES)
107 * wParam [I] wParam of the message uMsg
108 * lParam [I] lParam of the message uMsg
109 * hMainMenu [I] handle to the application's main menu
110 * hInst [I] handle to the module that contains string resources
111 * hwndStatus [I] handle to the status bar window
112 * lpwIDs [I] pointer to an array of intergers (see NOTES)
113 *
114 * RETURNS
115 * No return value
116 *
117 * NOTES
118 * The official documentation is incomplete!
119 * This is the correct documentation:
120 *
121 * uMsg:
122 * MenuHelp() does NOT handle WM_COMMAND messages! It only handes
123 * WM_MENUSELECT messages.
124 *
125 * lpwIDs:
126 * (will be written ...)
127 */
128
129VOID WINAPI
130MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu,
131 HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs)
132{
133 UINT uMenuID = 0;
134
135 if (!IsWindow (hwndStatus))
136 return;
137
138 switch (uMsg) {
139 case WM_MENUSELECT:
140// TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n",
141// wParam, lParam);
142
143 if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) {
144 /* menu was closed */
145// TRACE (commctrl, "menu was closed!\n");
146 SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0);
147 }
148 else {
149 /* menu item was selected */
150 if (HIWORD(wParam) & MF_POPUP)
151 uMenuID = (UINT)*(lpwIDs+1);
152 else
153 uMenuID = (UINT)LOWORD(wParam);
154// TRACE (commctrl, "uMenuID = %u\n", uMenuID);
155
156 if (uMenuID) {
157 CHAR szText[256];
158
159 if (!LoadStringA (hInst, uMenuID, szText, 256))
160 szText[0] = '\0';
161
162 SendMessageA (hwndStatus, SB_SETTEXTA,
163 255 | SBT_NOBORDERS, (LPARAM)szText);
164 SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0);
165 }
166 }
167 break;
168
169 default:
170// FIXME (commctrl, "Invalid Message 0x%x!\n", uMsg);
171 break;
172 }
173}
174
175/***********************************************************************
176 * ShowHideMenuCtl [COMCTL32.3]
177 *
178 * Shows or hides controls and updates the corresponding menu item.
179 *
180 * PARAMS
181 * hwnd [I] handle to the client window.
182 * uFlags [I] menu command id.
183 * lpInfo [I] pointer to an array of integers. (See NOTES.)
184 *
185 * RETURNS
186 * Success: TRUE
187 * Failure: FALSE
188 *
189 * NOTES
190 * The official documentation is incomplete!
191 * This is the correct documentation:
192 *
193 * hwnd
194 * Handle to the window that contains the menu and controls.
195 *
196 * uFlags
197 * Identifier of the menu item to receive or loose a check mark.
198 *
199 * lpInfo
200 * The array of integers contains pairs of values. BOTH values of
201 * the first pair must be the handles to the application's main menu.
202 * Each subsequent pair consists of a menu id and control id.
203 */
204
205BOOL WINAPI
206ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)
207{
208 LPINT lpMenuId;
209
210// TRACE (commctrl, "%x, %x, %p\n", hwnd, uFlags, lpInfo);
211
212 if (lpInfo == NULL)
213 return FALSE;
214
215 if (!(lpInfo[0]) || !(lpInfo[1]))
216 return FALSE;
217
218 /* search for control */
219 lpMenuId = &lpInfo[2];
220 while (*lpMenuId != uFlags)
221 lpMenuId += 2;
222
223 if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
224 /* uncheck menu item */
225 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
226
227 /* hide control */
228 lpMenuId++;
229 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
230 SWP_HIDEWINDOW);
231 }
232 else {
233 /* check menu item */
234 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
235
236 /* show control */
237 lpMenuId++;
238 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
239 SWP_SHOWWINDOW);
240 }
241
242 return TRUE;
243}
244
245/***********************************************************************
246 * GetEffectiveClientRect [COMCTL32.4]
247 *
248 * PARAMS
249 * hwnd [I] handle to the client window.
250 * lpRect [O] pointer to the rectangle of the client window
251 * lpInfo [I] pointer to an array of integers (see NOTES)
252 *
253 * RETURNS
254 * No return value.
255 *
256 * NOTES
257 * The official documentation is incomplete!
258 * This is the correct documentation:
259 *
260 * lpInfo
261 * (will be written...)
262 */
263
264VOID WINAPI
265GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)
266{
267 RECT rcCtrl;
268 INT *lpRun;
269 HWND hwndCtrl;
270
271// TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n",
272// (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);
273
274 GetClientRect (hwnd, lpRect);
275 lpRun = lpInfo;
276
277 do {
278 lpRun += 2;
279 if (*lpRun == 0)
280 return;
281 lpRun++;
282 hwndCtrl = GetDlgItem (hwnd, *lpRun);
283 if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
284// TRACE (commctrl, "control id 0x%x\n", *lpRun);
285 GetWindowRect (hwndCtrl, &rcCtrl);
286 MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
287 SubtractRect (lpRect, lpRect, &rcCtrl);
288 }
289 lpRun++;
290 } while (*lpRun);
291}
292
293/***********************************************************************
294 * DrawStatusText32A [COMCTL32.5][COMCTL32.27]
295 *
296 * Draws text with borders, like in a status bar.
297 *
298 * PARAMS
299 * hdc [I] handle to the window's display context
300 * lprc [I] pointer to a rectangle
301 * text [I] pointer to the text
302 * style [I] drawing style
303 *
304 * RETURNS
305 * No return value.
306 *
307 * NOTES
308 * The style variable can have one of the following values:
309 * (will be written ...)
310 */
311
312VOID WINAPI
313DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)
314{
315 RECT r = *lprc;
316 UINT border = BDR_SUNKENOUTER;
317
318 if (style & SBT_POPOUT)
319 border = BDR_RAISEDOUTER;
320 else if (style & SBT_NOBORDERS)
321 border = 0;
322
323 DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
324
325 /* now draw text */
326 if (text) {
327 int oldbkmode = SetBkMode (hdc, TRANSPARENT);
328 r.left += 3;
329 DrawTextA (hdc, text, lstrlenA(text),
330 &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);
331 if (oldbkmode != TRANSPARENT)
332 SetBkMode(hdc, oldbkmode);
333 }
334}
335
336
337/***********************************************************************
338 * DrawStatusText32W [COMCTL32.28]
339 *
340 * Draws text with borders, like in a status bar.
341 *
342 * PARAMS
343 * hdc [I] handle to the window's display context
344 * lprc [I] pointer to a rectangle
345 * text [I] pointer to the text
346 * style [I] drawing style
347 *
348 * RETURNS
349 * No return value.
350 */
351
352VOID WINAPI
353DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)
354{
355// ERROR DON'T KNOW HOW TO TRANSLATE!!!
356LPSTR p;
357// LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
358 DrawStatusTextA (hdc, lprc, p, style);
359 HeapFree (GetProcessHeap (), 0, p );
360}
361
362
363/***********************************************************************
364 * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21]
365 *
366 * Creates a status bar
367 *
368 * PARAMS
369 * style [I] window style
370 * text [I] pointer to the window text
371 * parent [I] handle to the parent window
372 * wid [I] control id of the status bar
373 *
374 * RETURNS
375 * Success: handle to the status window
376 * Failure: 0
377 */
378
379HWND WINAPI
380CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
381{
382 return CreateWindowA(STATUSCLASSNAMEA, text, style,
383 CW_USEDEFAULT, CW_USEDEFAULT,
384 CW_USEDEFAULT, CW_USEDEFAULT,
385 parent, wid, 0, 0);
386}
387
388
389/***********************************************************************
390 * CreateStatusWindow32W [COMCTL32.22] Creates a status bar control
391 *
392 * PARAMS
393 * style [I] window style
394 * text [I] pointer to the window text
395 * parent [I] handle to the parent window
396 * wid [I] control id of the status bar
397 *
398 * RETURNS
399 * Success: handle to the status window
400 * Failure: 0
401 */
402
403HWND WINAPI
404CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
405{
406 return CreateWindowW(STATUSCLASSNAMEW, text, style,
407 CW_USEDEFAULT, CW_USEDEFAULT,
408 CW_USEDEFAULT, CW_USEDEFAULT,
409 parent, wid, 0, 0);
410}
411
412
413/***********************************************************************
414 * CreateUpDownControl [COMCTL32.16] Creates an up-down control
415 *
416 * PARAMS
417 * style [I] window styles
418 * x [I] horizontal position of the control
419 * y [I] vertical position of the control
420 * cx [I] with of the control
421 * cy [I] height of the control
422 * parent [I] handle to the parent window
423 * id [I] the control's identifier
424 * inst [I] handle to the application's module instance
425 * buddy [I] handle to the buddy window, can be NULL
426 * maxVal [I] upper limit of the control
427 * minVal [I] lower limit of the control
428 * curVal [I] current value of the control
429 *
430 * RETURNS
431 * Success: handle to the updown control
432 * Failure: 0
433 */
434
435HWND WINAPI
436CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
437 HWND parent, INT id, HINSTANCE inst,
438 HWND buddy, INT maxVal, INT minVal, INT curVal)
439{
440 HWND hUD =
441 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
442 parent, id, inst, 0);
443 if (hUD) {
444 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
445 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
446 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
447 }
448
449 return hUD;
450}
451
452/***********************************************************************
453 * InitCommonControls [COMCTL32.17]
454 *
455 * Registers the common controls.
456 *
457 * PARAMS
458 * No parameters.
459 *
460 * RETURNS
461 * No return values.
462 *
463 * NOTES
464 * This function is just a dummy.
465 * The Win95 controls are registered at the DLL's initialization.
466 * To register other controls InitCommonControlsEx() must be used.
467 */
468
469VOID WINAPI InitCommonControls(VOID)
470{
471}
472
473/***********************************************************************
474 * InitCommonControlsEx [COMCTL32.81]
475 *
476 * Registers the common controls.
477 *
478 * PARAMS
479 * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
480 *
481 * RETURNS
482 * Success: TRUE
483 * Failure: FALSE
484 *
485 * NOTES
486 * Only the additinal common controls are registered by this function.
487 * The Win95 controls are registered at the DLL's initialization.
488 */
489
490BOOL WINAPI
491InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
492{
493 INT cCount;
494 DWORD dwMask;
495
496 if (!lpInitCtrls)
497 return FALSE;
498 if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
499 return FALSE;
500
501// TRACE(commctrl,"(0x%08lx)\n", lpInitCtrls->dwICC);
502
503 for (cCount = 0; cCount < 32; cCount++) {
504 dwMask = 1 << cCount;
505 if (!(lpInitCtrls->dwICC & dwMask))
506 continue;
507
508 switch (lpInitCtrls->dwICC & dwMask) {
509 /* dummy initialization */
510 case ICC_ANIMATE_CLASS:
511 case ICC_BAR_CLASSES:
512 case ICC_LISTVIEW_CLASSES:
513 case ICC_TREEVIEW_CLASSES:
514 case ICC_TAB_CLASSES:
515 case ICC_UPDOWN_CLASS:
516 case ICC_PROGRESS_CLASS:
517 case ICC_HOTKEY_CLASS:
518 break;
519
520 /* advanced classes - not included in Win95 */
521 case ICC_DATE_CLASSES:
522 MONTHCAL_Register ();
523 DATETIME_Register ();
524 break;
525
526 case ICC_USEREX_CLASSES:
527 COMBOEX_Register ();
528 break;
529
530 case ICC_COOL_CLASSES:
531 REBAR_Register ();
532 break;
533
534 case ICC_INTERNET_CLASSES:
535 IPADDRESS_Register ();
536 break;
537
538 case ICC_PAGESCROLLER_CLASS:
539 PAGER_Register ();
540 break;
541
542 case ICC_NATIVEFNTCTL_CLASS:
543 NATIVEFONT_Register ();
544 break;
545
546 default:
547// FIXME (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask);
548 break;
549 }
550 }
551
552 return TRUE;
553}
554
555/***********************************************************************
556 * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
557 *
558 * PARAMS
559 * hwnd
560 * style
561 * wID
562 * nBitmaps
563 * hBMInst
564 * wBMID
565 * lpButtons
566 * iNumButtons
567 * dxButton
568 * dyButton
569 * dxBitmap
570 * dyBitmap
571 * uStructSize
572 *
573 * RETURNS
574 * Success: handle to the tool bar control
575 * Failure: 0
576 */
577
578HWND WINAPI
579CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
580 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
581 INT iNumButtons, INT dxButton, INT dyButton,
582 INT dxBitmap, INT dyBitmap, UINT uStructSize)
583{
584 HWND hwndTB =
585 CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style, 0, 0, 0, 0,
586 hwnd, (HMENU)wID, 0, NULL);
587 if(hwndTB) {
588 TBADDBITMAP tbab;
589
590 SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
591 (WPARAM)uStructSize, 0);
592
593 /* set bitmap and button size */
594 /*If CreateToolbarEx receive 0, windows set default values*/
595 if (dyBitmap < 0)
596 dyBitmap = 16;
597 if (dxBitmap < 0)
598 dxBitmap = 16;
599
600 SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
601 MAKELPARAM((WORD)dyBitmap, (WORD)dxBitmap));
602 SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
603 MAKELPARAM((WORD)dyButton, (WORD)dxButton));
604
605
606 /* add bitmaps */
607 if (nBitmaps > 0)
608 {
609 tbab.hInst = hBMInst;
610 tbab.nID = wBMID;
611
612 SendMessageA (hwndTB, TB_ADDBITMAP,
613 (WPARAM)nBitmaps, (LPARAM)&tbab);
614 }
615 /* add buttons */
616 if(iNumButtons > 0)
617 SendMessageA (hwndTB, TB_ADDBUTTONSA,
618 (WPARAM)iNumButtons, (LPARAM)lpButtons);
619 }
620
621 return hwndTB;
622}
623
624
625/***********************************************************************
626 * CreateMappedBitmap [COMCTL32.8]
627 *
628 * PARAMS
629 * hInstance [I]
630 * idBitmap [I]
631 * wFlags [I]
632 * lpColorMap [I]
633 * iNumMaps [I]
634 *
635 * RETURNS
636 * Success: handle to the new bitmap
637 * Failure: 0
638 */
639
640HBITMAP WINAPI
641CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
642 LPCOLORMAP lpColorMap, INT iNumMaps)
643{
644 HGLOBAL hglb;
645 HRSRC hRsrc;
646 LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
647 UINT nSize, nColorTableSize;
648 DWORD *pColorTable;
649 INT iColor, i, iMaps, nWidth, nHeight;
650 HDC hdcScreen;
651 HBITMAP hbm;
652 LPCOLORMAP sysColorMap;
653 COLORMAP internalColorMap[4] =
654 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
655
656 /* initialize pointer to colortable and default color table */
657 if (lpColorMap) {
658 iMaps = iNumMaps;
659 sysColorMap = lpColorMap;
660 }
661 else {
662 internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
663 internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
664 internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
665 internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
666 iMaps = 4;
667 sysColorMap = (LPCOLORMAP)internalColorMap;
668 }
669
670 hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
671 if (hRsrc == 0)
672 return 0;
673 hglb = LoadResource (hInstance, hRsrc);
674 if (hglb == 0)
675 return 0;
676 lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
677 if (lpBitmap == NULL)
678 return 0;
679
680 nColorTableSize = (1 << lpBitmap->biBitCount);
681 nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
682 lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
683 if (lpBitmapInfo == NULL)
684 return 0;
685 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
686
687 pColorTable = (DWORD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
688
689 for (iColor = 0; iColor < nColorTableSize; iColor++) {
690 for (i = 0; i < iMaps; i++) {
691 if (pColorTable[iColor] == sysColorMap[i].from) {
692#if 0
693 if (wFlags & CBS_MASKED) {
694 if (sysColorMap[i].to != COLOR_BTNTEXT)
695 pColorTable[iColor] = RGB(255, 255, 255);
696 }
697 else
698#endif
699 pColorTable[iColor] = sysColorMap[i].to;
700 break;
701 }
702 }
703 }
704
705 nWidth = (INT)lpBitmapInfo->biWidth;
706 nHeight = (INT)lpBitmapInfo->biHeight;
707 hdcScreen = GetDC ((HWND)0);
708 hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
709 if (hbm) {
710 HDC hdcDst = CreateCompatibleDC (hdcScreen);
711 HBITMAP hbmOld = SelectObject (hdcDst, hbm);
712 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
713 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
714 StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
715 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
716 SRCCOPY);
717 SelectObject (hdcDst, hbmOld);
718 DeleteDC (hdcDst);
719 }
720 ReleaseDC ((HWND)0, hdcScreen);
721 GlobalFree ((HGLOBAL)lpBitmapInfo);
722 FreeResource (hglb);
723
724 return hbm;
725}
726
727
728/***********************************************************************
729 * CreateToolbar [COMCTL32.7] Creates a tool bar control
730 *
731 * PARAMS
732 * hwnd
733 * style
734 * wID
735 * nBitmaps
736 * hBMInst
737 * wBMID
738 * lpButtons
739 * iNumButtons
740 *
741 * RETURNS
742 * Success: handle to the tool bar control
743 * Failure: 0
744 *
745 * NOTES
746 * Do not use this functions anymore. Use CreateToolbarEx instead.
747 */
748
749HWND WINAPI
750CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
751 HINSTANCE hBMInst, UINT wBMID,
752 LPCOLDTBBUTTON lpButtons,INT iNumButtons)
753{
754 return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
755 hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
756 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
757}
758
759
760/***********************************************************************
761 * DllGetVersion [COMCTL32.25]
762 *
763 * Retrieves version information of the 'COMCTL32.DLL'
764 *
765 * PARAMS
766 * pdvi [O] pointer to version information structure.
767 *
768 * RETURNS
769 * Success: S_OK
770 * Failure: E_INVALIDARG
771 *
772 * NOTES
773 * Returns version of a comctl32.dll from IE4.01 SP1.
774 */
775
776HRESULT WINAPI
777COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
778{
779 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
780// WARN (commctrl, "wrong DLLVERSIONINFO size from app");
781 return E_INVALIDARG;
782 }
783
784 pdvi->dwMajorVersion = 4;
785 pdvi->dwMinorVersion = 72;
786 pdvi->dwBuildNumber = 3110;
787 pdvi->dwPlatformID = 1;
788
789// TRACE (commctrl, "%lu.%lu.%lu.%lu\n",
790// pdvi->dwMajorVersion, pdvi->dwMinorVersion,
791// pdvi->dwBuildNumber, pdvi->dwPlatformID);
792
793 return S_OK;
794}
795
Note: See TracBrowser for help on using the repository browser.