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

Last change on this file since 2012 was 1730, checked in by achimha, 26 years ago

added HEAP_strdupAtoW/WtoA calls that were commented out

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