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

Last change on this file since 1330 was 1058, checked in by achimha, 26 years ago

merged latest WINE 990923 changes

File size: 22.0 KB
Line 
1/* $Id: comctl32.c,v 1.10 1999-09-26 11:01:08 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// ERROR DON'T KNOW HOW TO TRANSLATE!!!
368LPSTR p;
369// LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);
370 DrawStatusTextA (hdc, lprc, p, style);
371 HeapFree (GetProcessHeap (), 0, p );
372}
373
374
375/***********************************************************************
376 * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21]
377 *
378 * Creates a status bar
379 *
380 * PARAMS
381 * style [I] window style
382 * text [I] pointer to the window text
383 * parent [I] handle to the parent window
384 * wid [I] control id of the status bar
385 *
386 * RETURNS
387 * Success: handle to the status window
388 * Failure: 0
389 */
390
391HWND WINAPI
392CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)
393{
394 return CreateWindowA(STATUSCLASSNAMEA, text, style,
395 CW_USEDEFAULT, CW_USEDEFAULT,
396 CW_USEDEFAULT, CW_USEDEFAULT,
397 parent, wid, 0, 0);
398}
399
400
401/***********************************************************************
402 * CreateStatusWindow32W [COMCTL32.22] Creates a status bar control
403 *
404 * PARAMS
405 * style [I] window style
406 * text [I] pointer to the window text
407 * parent [I] handle to the parent window
408 * wid [I] control id of the status bar
409 *
410 * RETURNS
411 * Success: handle to the status window
412 * Failure: 0
413 */
414
415HWND WINAPI
416CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)
417{
418 return CreateWindowW(STATUSCLASSNAMEW, text, style,
419 CW_USEDEFAULT, CW_USEDEFAULT,
420 CW_USEDEFAULT, CW_USEDEFAULT,
421 parent, wid, 0, 0);
422}
423
424
425/***********************************************************************
426 * CreateUpDownControl [COMCTL32.16] Creates an up-down control
427 *
428 * PARAMS
429 * style [I] window styles
430 * x [I] horizontal position of the control
431 * y [I] vertical position of the control
432 * cx [I] with of the control
433 * cy [I] height of the control
434 * parent [I] handle to the parent window
435 * id [I] the control's identifier
436 * inst [I] handle to the application's module instance
437 * buddy [I] handle to the buddy window, can be NULL
438 * maxVal [I] upper limit of the control
439 * minVal [I] lower limit of the control
440 * curVal [I] current value of the control
441 *
442 * RETURNS
443 * Success: handle to the updown control
444 * Failure: 0
445 */
446
447HWND WINAPI
448CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,
449 HWND parent, INT id, HINSTANCE inst,
450 HWND buddy, INT maxVal, INT minVal, INT curVal)
451{
452 HWND hUD =
453 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,
454 parent, id, inst, 0);
455 if (hUD) {
456 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);
457 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
458 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
459 }
460
461 return hUD;
462}
463
464/***********************************************************************
465 * InitCommonControls [COMCTL32.17]
466 *
467 * Registers the common controls.
468 *
469 * PARAMS
470 * No parameters.
471 *
472 * RETURNS
473 * No return values.
474 *
475 * NOTES
476 * This function is just a dummy.
477 * The Win95 controls are registered at the DLL's initialization.
478 * To register other controls InitCommonControlsEx() must be used.
479 */
480
481VOID WINAPI InitCommonControls(VOID)
482{
483}
484
485/***********************************************************************
486 * InitCommonControlsEx [COMCTL32.81]
487 *
488 * Registers the common controls.
489 *
490 * PARAMS
491 * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.
492 *
493 * RETURNS
494 * Success: TRUE
495 * Failure: FALSE
496 *
497 * NOTES
498 * Only the additinal common controls are registered by this function.
499 * The Win95 controls are registered at the DLL's initialization.
500 */
501
502BOOL WINAPI
503InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
504{
505 INT cCount;
506 DWORD dwMask;
507
508 if (!lpInitCtrls)
509 return FALSE;
510 if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
511 return FALSE;
512
513// TRACE(commctrl,"(0x%08lx)\n", lpInitCtrls->dwICC);
514
515 for (cCount = 0; cCount < 32; cCount++) {
516 dwMask = 1 << cCount;
517 if (!(lpInitCtrls->dwICC & dwMask))
518 continue;
519
520 switch (lpInitCtrls->dwICC & dwMask) {
521 /* dummy initialization */
522 case ICC_ANIMATE_CLASS:
523 case ICC_BAR_CLASSES:
524 case ICC_LISTVIEW_CLASSES:
525 case ICC_TREEVIEW_CLASSES:
526 case ICC_TAB_CLASSES:
527 case ICC_UPDOWN_CLASS:
528 case ICC_PROGRESS_CLASS:
529 case ICC_HOTKEY_CLASS:
530 break;
531
532 /* advanced classes - not included in Win95 */
533 case ICC_DATE_CLASSES:
534 MONTHCAL_Register ();
535 DATETIME_Register ();
536 break;
537
538 case ICC_USEREX_CLASSES:
539 COMBOEX_Register ();
540 break;
541
542 case ICC_COOL_CLASSES:
543 REBAR_Register ();
544 break;
545
546 case ICC_INTERNET_CLASSES:
547 IPADDRESS_Register ();
548 break;
549
550 case ICC_PAGESCROLLER_CLASS:
551 PAGER_Register ();
552 break;
553
554 case ICC_NATIVEFNTCTL_CLASS:
555 NATIVEFONT_Register ();
556 break;
557
558 default:
559// FIXME (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask);
560 break;
561 }
562 }
563
564 return TRUE;
565}
566
567/***********************************************************************
568 * CreateToolbarEx [COMCTL32.32] Creates a tool bar window
569 *
570 * PARAMS
571 * hwnd
572 * style
573 * wID
574 * nBitmaps
575 * hBMInst
576 * wBMID
577 * lpButtons
578 * iNumButtons
579 * dxButton
580 * dyButton
581 * dxBitmap
582 * dyBitmap
583 * uStructSize
584 *
585 * RETURNS
586 * Success: handle to the tool bar control
587 * Failure: 0
588 */
589
590HWND WINAPI
591CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
592 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
593 INT iNumButtons, INT dxButton, INT dyButton,
594 INT dxBitmap, INT dyBitmap, UINT uStructSize)
595{
596 HWND hwndTB =
597 CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style, 0, 0, 0, 0,
598 hwnd, (HMENU)wID, 0, NULL);
599 if(hwndTB) {
600 TBADDBITMAP tbab;
601
602 SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,
603 (WPARAM)uStructSize, 0);
604
605 /* set bitmap and button size */
606 /*If CreateToolbarEx receive 0, windows set default values*/
607 if (dyBitmap < 0)
608 dyBitmap = 16;
609 if (dxBitmap < 0)
610 dxBitmap = 16;
611
612 SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,
613 MAKELPARAM((WORD)dyBitmap, (WORD)dxBitmap));
614 SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,
615 MAKELPARAM((WORD)dyButton, (WORD)dxButton));
616
617
618 /* add bitmaps */
619 if (nBitmaps > 0)
620 {
621 tbab.hInst = hBMInst;
622 tbab.nID = wBMID;
623
624 SendMessageA (hwndTB, TB_ADDBITMAP,
625 (WPARAM)nBitmaps, (LPARAM)&tbab);
626 }
627 /* add buttons */
628 if(iNumButtons > 0)
629 SendMessageA (hwndTB, TB_ADDBUTTONSA,
630 (WPARAM)iNumButtons, (LPARAM)lpButtons);
631 }
632
633 return hwndTB;
634}
635
636
637/***********************************************************************
638 * CreateMappedBitmap [COMCTL32.8]
639 *
640 * PARAMS
641 * hInstance [I]
642 * idBitmap [I]
643 * wFlags [I]
644 * lpColorMap [I]
645 * iNumMaps [I]
646 *
647 * RETURNS
648 * Success: handle to the new bitmap
649 * Failure: 0
650 */
651
652HBITMAP WINAPI
653CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,
654 LPCOLORMAP lpColorMap, INT iNumMaps)
655{
656 HGLOBAL hglb;
657 HRSRC hRsrc;
658 LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
659 UINT nSize, nColorTableSize;
660 RGBQUAD *pColorTable;
661 INT iColor, i, iMaps, nWidth, nHeight;
662 HDC hdcScreen;
663 HBITMAP hbm;
664 LPCOLORMAP sysColorMap;
665 COLORREF cRef;
666 COLORMAP internalColorMap[4] =
667 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
668
669 /* initialize pointer to colortable and default color table */
670 if (lpColorMap) {
671 iMaps = iNumMaps;
672 sysColorMap = lpColorMap;
673 }
674 else {
675 internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);
676 internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);
677 internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);
678 internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);
679 iMaps = 4;
680 sysColorMap = (LPCOLORMAP)internalColorMap;
681 }
682
683 hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);
684 if (hRsrc == 0)
685 return 0;
686 hglb = LoadResource (hInstance, hRsrc);
687 if (hglb == 0)
688 return 0;
689 lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);
690 if (lpBitmap == NULL)
691 return 0;
692
693 nColorTableSize = (1 << lpBitmap->biBitCount);
694 nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
695 lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);
696 if (lpBitmapInfo == NULL)
697 return 0;
698 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
699
700 pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);
701
702 for (iColor = 0; iColor < nColorTableSize; iColor++) {
703 for (i = 0; i < iMaps; i++) {
704 cRef = RGB(pColorTable[iColor].rgbRed,
705 pColorTable[iColor].rgbGreen,
706 pColorTable[iColor].rgbBlue);
707 if ( cRef == sysColorMap[i].from) {
708#if 0
709 if (wFlags & CBS_MASKED) {
710 if (sysColorMap[i].to != COLOR_BTNTEXT)
711 pColorTable[iColor] = RGB(255, 255, 255);
712 }
713 else
714#endif
715 pColorTable[iColor].rgbBlue = GetBValue(sysColorMap[i].to);
716 pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to);
717 pColorTable[iColor].rgbRed = GetRValue(sysColorMap[i].to);
718 break;
719 }
720 }
721 }
722 nWidth = (INT)lpBitmapInfo->biWidth;
723 nHeight = (INT)lpBitmapInfo->biHeight;
724 hdcScreen = GetDC ((HWND)0);
725 hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
726 if (hbm) {
727 HDC hdcDst = CreateCompatibleDC (hdcScreen);
728 HBITMAP hbmOld = SelectObject (hdcDst, hbm);
729 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
730 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
731 StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
732 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
733 SRCCOPY);
734 SelectObject (hdcDst, hbmOld);
735 DeleteDC (hdcDst);
736 }
737 ReleaseDC ((HWND)0, hdcScreen);
738 GlobalFree ((HGLOBAL)lpBitmapInfo);
739 FreeResource (hglb);
740
741 return hbm;
742}
743
744
745/***********************************************************************
746 * CreateToolbar [COMCTL32.7] Creates a tool bar control
747 *
748 * PARAMS
749 * hwnd
750 * style
751 * wID
752 * nBitmaps
753 * hBMInst
754 * wBMID
755 * lpButtons
756 * iNumButtons
757 *
758 * RETURNS
759 * Success: handle to the tool bar control
760 * Failure: 0
761 *
762 * NOTES
763 * Do not use this functions anymore. Use CreateToolbarEx instead.
764 */
765
766HWND WINAPI
767CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,
768 HINSTANCE hBMInst, UINT wBMID,
769 LPCOLDTBBUTTON lpButtons,INT iNumButtons)
770{
771 return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,
772 hBMInst, wBMID, (LPCTBBUTTON)lpButtons,
773 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));
774}
775
776
777/***********************************************************************
778 * DllGetVersion [COMCTL32.25]
779 *
780 * Retrieves version information of the 'COMCTL32.DLL'
781 *
782 * PARAMS
783 * pdvi [O] pointer to version information structure.
784 *
785 * RETURNS
786 * Success: S_OK
787 * Failure: E_INVALIDARG
788 *
789 * NOTES
790 * Returns version of a comctl32.dll from IE4.01 SP1.
791 */
792
793HRESULT WINAPI
794COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)
795{
796 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
797// WARN (commctrl, "wrong DLLVERSIONINFO size from app");
798 return E_INVALIDARG;
799 }
800
801 pdvi->dwMajorVersion = 4;
802 pdvi->dwMinorVersion = 72;
803 pdvi->dwBuildNumber = 3110;
804 pdvi->dwPlatformID = 1;
805
806// TRACE (commctrl, "%lu.%lu.%lu.%lu\n",
807// pdvi->dwMajorVersion, pdvi->dwMinorVersion,
808// pdvi->dwBuildNumber, pdvi->dwPlatformID);
809
810 return S_OK;
811}
812
Note: See TracBrowser for help on using the repository browser.