|
|
1.1 root 1: #define NOMINMAX
2: #include <windows.h>
3:
4: #include <stdlib.h> // For 'abs'
5:
1.1.1.2 ! root 6: #if !defined (APIENTRY)
! 7: #define APIENTRY FAR PASCAL
! 8: #endif
1.1 root 9:
10: HWND hwndTools, hwndToolText, hwndToolCombo, hwndToolButton, hwndMain;
11: HFONT hfontTools=0;
12: TEXTMETRIC tmToolFont;
1.1.1.2 ! root 13: int dyTools = 0, cxToolBorder, cyToolBorder, cntToolCtrls = 0, dyCombo;
! 14: int xCurrent = 10;
1.1 root 15: HBRUSH hbrBtnFace=0, hbrWindow=0;
16: HANDLE hInst=0;
17:
18: #define MAXCTRLS 25
19: #define TC_SPACE 0
20: #define TC_LABEL 1
21: #define TC_COMBO 2
22: #define TC_BUTTON 3
23: typedef struct _tagTools {
24: HWND hwnd;
25: WORD wType;
1.1.1.2 ! root 26: int iWidth, iHeight;
1.1 root 27: HICON hIcon;
28: } Tools;
29: Tools toolCtrl[MAXCTRLS];
30:
31: LONG APIENTRY ToolsProc (HWND, UINT, UINT, LONG);
32: LONG APIENTRY MyComboProc (HWND, UINT, UINT, LONG);
33:
34: BOOL InitToolBar (HANDLE hInstance)
35: {
36: WNDCLASS wndclass;
37:
38: hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
39: hbrWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
40:
41: wndclass.style = CS_HREDRAW | CS_VREDRAW;
42: wndclass.lpfnWndProc = (WNDPROC)ToolsProc;
43: wndclass.cbClsExtra = 0;
44: wndclass.cbWndExtra = 0;
45: wndclass.hInstance = hInstance;
46: wndclass.hIcon = NULL;
47: wndclass.hbrBackground = hbrBtnFace;
48: wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
49: wndclass.lpszMenuName = NULL;
50: wndclass.lpszClassName = "SamplerTools";
51:
52: if (!RegisterClass (&wndclass))
53: return FALSE;
54: }
55:
1.1.1.2 ! root 56: BOOL CreateToolBar (HWND hwnd, HANDLE hInstance, int iId)
1.1 root 57: {
58: HWND hwndTmp;
59: RECT rect;
60:
1.1.1.2 ! root 61: #if defined (WIN32)
1.1 root 62: hInst = (HANDLE)GetWindowLong (hwnd, GWL_HINSTANCE);
1.1.1.2 ! root 63: #else
1.1 root 64: hInst = GetWindowWord (hwnd, GWW_HINSTANCE);
65: #endif
66:
67: if (hbrBtnFace==0) {
68: hbrBtnFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
69: }
70: if (hbrWindow==0) {
71: hbrWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
72: }
73:
74:
75: cxToolBorder = GetSystemMetrics (SM_CXBORDER);
76: cyToolBorder = GetSystemMetrics (SM_CYBORDER);
77:
78: hwndTools = CreateWindow ("SamplerTools", "SamplerTools",
79: WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER | WS_VISIBLE,
80: 0, 0, 0, 0,
81: hwnd, (HMENU)iId, hInst, NULL);
82: if (!hwndTools) {
83: return FALSE;
84: }
85:
86: /* Lets find out how big a combo box is... */
87: hwndTmp = CreateWindow ("COMBOBOX", "Combo",
1.1.1.2 ! root 88: WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST,
1.1 root 89: 0, 0, 0, 0,
1.1.1.2 ! root 90: hwndTools, NULL, hInst, NULL);
1.1 root 91: if (hwndTmp) {
92: SendMessage (hwndTmp, WM_SETFONT, (UINT)hfontTools, MAKELONG (TRUE, 0));
93: GetClientRect (hwndTmp, &rect);
94: dyCombo = rect.bottom - rect.top;
95: DestroyWindow (hwndTmp);
96: } else {
97: dyCombo = 30; // Just for a default value
98: }
99:
100: hwndMain = hwnd; // So we can pass WM_CONTROL messages back to the master parent
101:
102: return TRUE;
1.1.1.2 ! root 103:
! 104: hInstance; // unreferenced formal parameter
1.1 root 105: }
106:
107: int ToolBarHeight (HWND hwnd)
108: {
109: RECT rect;
110: GetClientRect (hwndTools, &rect);
111: return rect.bottom-rect.top;
112:
1.1.1.2 ! root 113: hwnd; //unreferenced formal parameter
1.1 root 114: }
115:
116: BOOL AdjustToolBar (HWND hwnd)
117: {
118: RECT rect;
119:
120: GetClientRect (hwnd, &rect);
121: MoveWindow (hwndTools,
122: rect.left-cxToolBorder,
123: rect.top - cyToolBorder,
124: rect.right - rect.left + (cxToolBorder*2),
125: dyTools,
126: TRUE);
127: return TRUE;
128: }
129:
1.1.1.2 ! root 130: void UpdatePositions (void)
1.1 root 131: {
1.1.1.2 ! root 132: int i, x, y, dx, dy, cnt;
1.1 root 133:
134: x = 10;
135: for (i=0; i<cntToolCtrls; i++) {
136: switch (toolCtrl[i].wType) {
137: case TC_SPACE:
138: dx = toolCtrl[i].iWidth;
139: break;
140: case TC_LABEL:
141: dy = toolCtrl[i].iHeight;
142: y = (dyTools/2) - (dy/2) - 1;
143: dx = toolCtrl[i].iWidth;
144: break;
145: case TC_COMBO:
146: dy = toolCtrl[i].iHeight;
147: y = (dyTools/2) - (dy/2) - 1;
148: dx = toolCtrl[i].iWidth;
1.1.1.2 ! root 149: cnt = (int)SendMessage (toolCtrl[i].hwnd, CB_GETCOUNT, (UINT)0, (LONG)0);
1.1 root 150: if (cnt > 5) cnt = 5;
151: dy = dy * cnt;
152: break;
153: case TC_BUTTON:
154: dy = toolCtrl[i].iHeight;
155: y = (dyTools/2) - (dy/2) - 1;
156: dx = toolCtrl[i].iWidth;
157: break;
158: default:
159: dy = toolCtrl[i].iHeight;
160: y = (dyTools/2) - (dy/2) - 1;
161: dx = toolCtrl[i].iWidth;
162: break;
163: }
164: if (toolCtrl[i].wType != TC_SPACE) {
165: MoveWindow (toolCtrl[i].hwnd, x, y, dx, dy, FALSE);
166: }
167: x += dx;
168: }
1.1.1.2 ! root 169: if (hwndTools) {
! 170: UpdateWindow (hwndTools);
1.1 root 171: }
172: }
173:
1.1.1.2 ! root 174: BOOL AddToolSpace (int iWidth, int iHeight)
1.1 root 175: {
176: if (cntToolCtrls >= MAXCTRLS) return FALSE;
177: toolCtrl[cntToolCtrls].hwnd = 0;
178: toolCtrl[cntToolCtrls].wType = TC_SPACE;
179: toolCtrl[cntToolCtrls].iWidth = iWidth;
180: toolCtrl[cntToolCtrls].iHeight = iHeight;
181: if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
182: dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
183: }
1.1.1.2 ! root 184: UpdatePositions();
1.1 root 185: cntToolCtrls++;
186: return TRUE;
187: }
188:
1.1.1.2 ! root 189: HWND AddToolLabel (HANDLE hInst, int iId, LPSTR szLabel, int iWidth, DWORD dwStyle)
1.1 root 190: {
191: HDC hdc;
192:
193: if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array
194:
195: toolCtrl[cntToolCtrls].hwnd = CreateWindow ("STATIC", szLabel,
1.1.1.2 ! root 196: WS_CHILD | WS_VISIBLE | dwStyle,
1.1 root 197: 0, 0, 0, 0,
1.1.1.2 ! root 198: hwndTools, (HMENU)iId, hInst, NULL);
1.1 root 199:
200: if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason
201:
202: SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT)hfontTools, MAKELONG (TRUE, 0));
203: toolCtrl[cntToolCtrls].wType = TC_LABEL;
204:
205: hdc = GetDC (hwndTools);
206: if (iWidth < 0) {
207: toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
208: } else if (iWidth == 0) {
1.1.1.2 ! root 209: #if defined (WIN32)
1.1 root 210: SIZE size;
211: GetTextExtentPoint (hdc, szLabel, lstrlen(szLabel), &size);
212: toolCtrl[cntToolCtrls].iWidth = size.cx;
213: #else
214: toolCtrl[cntToolCtrls].iWidth = LOWORD(GetTextExtent (hdc, szLabel, lstrlen(szLabel)));
215: #endif
216: } else {
217: toolCtrl[cntToolCtrls].iWidth = iWidth;
218: }
219: toolCtrl[cntToolCtrls].iHeight = tmToolFont.tmHeight;
220:
221: if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
222: dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
223: }
224:
225: ReleaseDC (hwndTools, hdc);
1.1.1.2 ! root 226: UpdatePositions();
1.1 root 227: return toolCtrl[cntToolCtrls++].hwnd;
228: }
229:
1.1.1.2 ! root 230: HWND AddToolCombo (HANDLE hInst, int iId, int iWidth, DWORD dwStyle)
1.1 root 231: {
232:
233: if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array
234:
235: if (dwStyle==0) dwStyle = CBS_DROPDOWNLIST;
236: toolCtrl[cntToolCtrls].hwnd = CreateWindow ("COMBOBOX", "",
1.1.1.2 ! root 237: WS_CHILD | WS_VISIBLE | dwStyle,
1.1 root 238: 0, 0, 0, 0,
239: hwndTools, (HMENU)iId, hInst, NULL);
240:
241: if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason
242:
243: SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT)hfontTools, MAKELONG (TRUE, 0));
244: toolCtrl[cntToolCtrls].wType = TC_COMBO;
245:
246: if (iWidth < 0) {
247: toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
248: } else if (iWidth == 0) {
249: toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * 15; // just a default width
250: } else {
251: toolCtrl[cntToolCtrls].iWidth = iWidth;
252: }
253: toolCtrl[cntToolCtrls].iHeight = dyCombo;
254:
255: if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
256: dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
257: }
258:
1.1.1.2 ! root 259: UpdatePositions();
1.1 root 260: return toolCtrl[cntToolCtrls++].hwnd;
261: }
262:
263:
1.1.1.2 ! root 264: HWND AddToolButton (HANDLE hInst, int iId, LPSTR szLabel, int iWidth, int iHeight, DWORD dwStyle)
1.1 root 265: {
266: HDC hdc;
267:
268: if (cntToolCtrls >= MAXCTRLS) return (HWND)0; // No room left in our fixed array
269:
270: if (dwStyle == 0) dwStyle = BS_PUSHBUTTON;
271: toolCtrl[cntToolCtrls].hwnd = CreateWindow ("BUTTON", szLabel,
1.1.1.2 ! root 272: WS_CHILD | WS_VISIBLE | dwStyle,
1.1 root 273: 0, 0, 0, 0,
1.1.1.2 ! root 274: hwndTools, (HMENU)iId, hInst, NULL);
1.1 root 275:
276: if (!toolCtrl[cntToolCtrls].hwnd) return (HWND)0; // CreateWindow failed for some reason
277:
278: SendMessage (toolCtrl[cntToolCtrls].hwnd, WM_SETFONT, (UINT)hfontTools, MAKELONG (TRUE, 0));
279: toolCtrl[cntToolCtrls].wType = TC_BUTTON;
280:
281: hdc = GetDC (hwndTools);
282: SelectObject (hdc, hfontTools);
283: if (iWidth < 0) {
284: toolCtrl[cntToolCtrls].iWidth = tmToolFont.tmAveCharWidth * abs(iWidth);
285: toolCtrl[cntToolCtrls].iWidth += (6*cxToolBorder);
286: } else if (iWidth == 0) {
1.1.1.2 ! root 287: #if defined (WIN32)
1.1 root 288: SIZE size;
289: GetTextExtentPoint (hdc, szLabel, lstrlen(szLabel), &size);
290: toolCtrl[cntToolCtrls].iWidth = size.cx;
1.1.1.2 ! root 291: #else
1.1 root 292: toolCtrl[cntToolCtrls].iWidth = LOWORD(GetTextExtent (hdc, szLabel, lstrlen(szLabel)));
293: #endif
294: toolCtrl[cntToolCtrls].iWidth += (6*cxToolBorder);
295: } else {
296: toolCtrl[cntToolCtrls].iWidth = iWidth;
297: }
298: if (iHeight < 0) {
299: toolCtrl[cntToolCtrls].iHeight = tmToolFont.tmHeight;
300: toolCtrl[cntToolCtrls].iHeight += (6*cyToolBorder);
301: } else if (iHeight==0) {
302: toolCtrl[cntToolCtrls].iHeight = dyTools - (6*cyToolBorder);
303: } else {
304: toolCtrl[cntToolCtrls].iHeight = iHeight;
305: }
306:
307: if ((toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder)) > dyTools) {
308: dyTools = (toolCtrl[cntToolCtrls].iHeight + (6*cyToolBorder));
309: }
310:
311: if (dwStyle & BS_OWNERDRAW) {
312: toolCtrl[cntToolCtrls].hIcon = LoadIcon (hInst, szLabel);
313: } else {
314: toolCtrl[cntToolCtrls].hIcon = NULL;
315: }
316:
317: ReleaseDC (hwndTools, hdc);
1.1.1.2 ! root 318: UpdatePositions();
1.1 root 319: return toolCtrl[cntToolCtrls++].hwnd;
320: }
321:
322:
323: BOOL DestroyToolBar (void)
324: {
325: return DeleteObject (hbrBtnFace);
326: }
327:
328: void DrawButton (HDC hdc, RECT rect, BOOL bDown, HICON hIcon)
329: {
330: HBRUSH hBrush, hbrFrame, hbrFace, hbrHilite, hbrShadow;
331: RECT border;
1.1.1.2 ! root 332: int i;
1.1 root 333:
334: hbrFrame = CreateSolidBrush(GetSysColor(COLOR_WINDOWFRAME));
335: hbrFace = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
336: hbrHilite = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
337: hbrShadow = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
338:
339: FillRect (hdc, &rect, hbrFace);
340:
341: if (hIcon) {
342: if (bDown) {
343: DrawIcon (hdc, rect.left + (4*cyToolBorder), rect.top + (4*cyToolBorder), hIcon);
344: } else {
345: DrawIcon (hdc, rect.left + (3*cyToolBorder), rect.top + (3*cyToolBorder), hIcon);
346: }
347: }
348:
349: hBrush = hbrFrame;
350: border = rect; border.bottom = border.top + cyToolBorder;
351: FillRect (hdc, &border, hBrush);
352: border = rect; border.right = border.left + cxToolBorder;
353: FillRect (hdc, &border, hBrush);
354: border = rect; border.top = border.bottom - cyToolBorder;
355: FillRect (hdc, &border, hBrush);
356: border = rect; border.left = border.right - cxToolBorder;
357: FillRect (hdc, &border, hBrush);
358:
359: for (i= 0; i<2; i++) {
360: InflateRect (&rect, -cxToolBorder, -cyToolBorder);
361: hBrush = (bDown?hbrShadow:hbrHilite);
362: border = rect; border.bottom = border.top + cyToolBorder;
363: FillRect (hdc, &border, hBrush);
364: border = rect; border.right = border.left + cxToolBorder;
365: FillRect (hdc, &border, hBrush);
366: if (!bDown) {
367: hBrush = hbrShadow;
368: border = rect; border.top = border.bottom - cyToolBorder;
369: FillRect (hdc, &border, hBrush);
370: border = rect; border.left = border.right - cxToolBorder;
371: FillRect (hdc, &border, hBrush);
372: }
373: }
374:
375: DeleteObject (hbrFrame);
376: DeleteObject (hbrFace);
377: DeleteObject (hbrHilite);
378: DeleteObject (hbrShadow);
379:
380: }
381:
382:
383: LONG APIENTRY ToolsProc (HWND hwnd, UINT msg, UINT wParam, LONG lParam)
384: {
385: HDC hdc;
386: PAINTSTRUCT ps;
1.1.1.2 ! root 387: int iType, idCtrl, msgCtrl, i;
1.1 root 388: RECT rect, border;
389: COLORREF clrColor;
390: HWND hwndCtl;
391: LONG lStyle;
392: HBRUSH hBrush;
393: LPDRAWITEMSTRUCT lpdi;
394: HICON hIcon;
1.1.1.2 ! root 395: LOGFONT lfTmp ={0,0,0,0,0,0,0,0,0,0,0,0,0,NULL};
1.1 root 396:
397: switch (msg) {
1.1.1.2 ! root 398: case WM_CREATE:
! 399: lfTmp.lfHeight = 14;
! 400: lfTmp.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
! 401: hfontTools = CreateFontIndirect (&lfTmp);
! 402: if (!hfontTools) {
! 403: MessageBox (GetFocus(),
! 404: "Unable to get an unnamed variable pitch swiss font",
! 405: "Tool Bar CreateFont Error",
! 406: MB_OK);
! 407: hfontTools = CreateFont(14, 0, 0, 0, 0, 0, 0, 0,
! 408: 0, 0, 0, 0,
! 409: VARIABLE_PITCH | FF_SWISS, "Arial");
! 410: }
1.1 root 411:
1.1.1.2 ! root 412: if (!hfontTools) {
1.1 root 413: MessageBox (GetFocus(), "Failed To Create Font", "StatusProc", MB_OK);
414: }
1.1.1.2 ! root 415: hdc = GetDC (hwnd);
! 416: SelectObject (hdc, hfontTools);
1.1 root 417: GetTextMetrics (hdc, &tmToolFont);
1.1.1.2 ! root 418: ReleaseDC (hwnd, hdc);
1.1 root 419: return DefWindowProc (hwnd, msg, wParam, lParam);
420:
1.1.1.2 ! root 421: case WM_DESTROY:
! 422: if (hfontTools) {
! 423: DeleteObject (hfontTools);
! 424: }
! 425: break;
! 426:
1.1 root 427: case WM_SIZE:
1.1.1.2 ! root 428: UpdatePositions();
1.1 root 429: break;
430:
1.1.1.2 ! root 431: #if defined (WIN32)
1.1 root 432: case WM_CTLCOLORLISTBOX:
433: case WM_CTLCOLOREDIT:
434: case WM_CTLCOLORSTATIC:
435: case WM_CTLCOLORBTN:
436: case WM_CTLCOLORDLG:
437: case WM_CTLCOLORMSGBOX:
438: case WM_CTLCOLORSCROLLBAR:
439: iType = msg - WM_CTLCOLORMSGBOX;
440: hdc = (HDC)wParam;
441: hwndCtl = (HWND)lParam;
1.1.1.2 ! root 442: #else
1.1 root 443: case WM_CTLCOLOR:
444: hdc = wParam;
445: hwndCtl = LOWORD(lParam);
446: iType = HIWORD (lParam);
447: #endif
448: switch (iType) {
449: case CTLCOLOR_EDIT: //Edit control
450: clrColor = GetSysColor (COLOR_BTNFACE);
451: hBrush = hbrWindow;
452: break;
453:
454: case CTLCOLOR_LISTBOX: //List-box control
455: lStyle = GetWindowLong (hwndCtl, GWL_STYLE);
456: if (lStyle & CBS_SIMPLE) {
457: clrColor = GetSysColor (COLOR_WINDOW);
458: hBrush = hbrWindow;
459: } else {
460: clrColor = GetSysColor (COLOR_BTNFACE);
461: hBrush = hbrBtnFace;
462: }
463: break;
464:
465: case CTLCOLOR_STATIC:
466: clrColor = GetSysColor (COLOR_BTNFACE);
467: hBrush = hbrBtnFace;
468: break;
469:
470: case CTLCOLOR_BTN:
471: clrColor = GetSysColor (COLOR_BTNFACE);
472: hBrush = hbrBtnFace;
473: break;
474:
475: case CTLCOLOR_SCROLLBAR:
476: case CTLCOLOR_DLG:
477: case CTLCOLOR_MSGBOX:
478: default:
1.1.1.2 ! root 479: return DefWindowProc (hwnd, msg, wParam, lParam);
1.1 root 480: }
481: SetBkColor(hdc, clrColor);
482: return (LONG)hBrush;
483:
484: case WM_PAINT:
485: hdc = BeginPaint (hwnd, &ps);
486: GetClientRect (hwnd, &rect);
487:
488: /* Shade the top of the bar white */
489: hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
490: border = rect;
491: border.bottom = border.top + cyToolBorder;
492: FillRect (hdc, &border, hBrush);
493: DeleteObject (hBrush);
494:
495: /* Shade the bottom of the bar dark gray */
496: hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
497: border = rect;
498: border.top = border.bottom - cyToolBorder;
499: FillRect (hdc, &border, hBrush);
500: DeleteObject (hBrush);
501:
502: EndPaint (hwnd, &ps);
503:
504: return DefWindowProc (hwnd, msg, wParam, lParam);
505:
506: case WM_DRAWITEM: // Indicates that an owner-draw control needs to be redrawn.
507: lpdi = (LPDRAWITEMSTRUCT)lParam;
508: switch (lpdi->itemAction) {
509: // handle normal drawing of button, but check if its selected or focus
510: case ODA_SELECT:
511: case ODA_DRAWENTIRE:
512: // handle button pressed down select state -- button down bitmap
513: // text is right & down 2 pixels
514: hIcon = NULL;
515: for (i=0; i< cntToolCtrls; i++) {
516: if (toolCtrl[i].hwnd == lpdi->hwndItem) {
517: hIcon = toolCtrl[i].hIcon;
518: }
519: }
520: if (lpdi->itemState & ODS_SELECTED) {
521: DrawButton (lpdi->hDC,lpdi->rcItem, TRUE, hIcon);
522: } else { // not selected -- button up; text is in normal position
523: DrawButton (lpdi->hDC,lpdi->rcItem, FALSE, hIcon);
524: }
525: return TRUE;
526: }
527: break;
528:
529: case WM_COMMAND:
1.1.1.2 ! root 530: #if defined (WIN32)
1.1 root 531: idCtrl = LOWORD(wParam);
532: msgCtrl = HIWORD(wParam);
533: hwndCtl = (HWND)lParam;
1.1.1.2 ! root 534: #else
1.1 root 535: idCtrl = wParam;
536: msgCtrl = HIWORD (lParam);
537: hwndCtl = LOWORD (lParam);
538: #endif
539:
540: if (GetWindowLong (hwndCtl, GWL_STYLE) & BS_OWNERDRAW) {
541: if (msgCtrl == BN_DOUBLECLICKED) {
542: PostMessage (hwndCtl, WM_LBUTTONDOWN, 0, 0);
543: return TRUE;
544: }
545: }
546: PostMessage (hwndMain, msg, wParam, lParam);
547: return DefWindowProc (hwnd, msg, wParam, lParam);
548:
549:
550: default:
551: return DefWindowProc (hwnd, msg, wParam, lParam);
552: }
553: return 0L;
554: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.