6 static const TCHAR szMonitorSelWndClass
[] = TEXT("MONITORSELWNDCLASS");
8 typedef struct _MONSL_MON
13 } MONSL_MON
, *PMONSL_MON
;
15 typedef struct _MONITORSELWND
24 DWORD dwInternalFlags
;
35 PMONSL_MONINFO MonitorInfo
;
42 HBITMAP hbmDisabledPattern
;
44 } MONITORSELWND
, *PMONITORSELWND
;
47 MonSelNotify(IN PMONITORSELWND infoPtr
,
53 if (infoPtr
->hNotify
!= NULL
)
55 LPNMHDR pnmh
= (LPNMHDR
)data
;
57 pnmh
->hwndFrom
= infoPtr
->hSelf
;
58 pnmh
->idFrom
= GetWindowLongPtr(infoPtr
->hSelf
,
62 Ret
= SendMessage(infoPtr
->hNotify
,
72 MonSelNotifyMonitor(IN PMONITORSELWND infoPtr
,
75 IN OUT PMONSL_MONNMHDR pmonnmh
)
77 pmonnmh
->Index
= Index
;
81 pmonnmh
->MonitorInfo
= infoPtr
->MonitorInfo
[Index
];
85 ZeroMemory(&pmonnmh
->MonitorInfo
,
86 sizeof(pmonnmh
->MonitorInfo
));
89 return MonSelNotify(infoPtr
,
95 MonSelChangeFont(IN OUT PMONITORSELWND infoPtr
,
99 HFONT hOldFont
= infoPtr
->hFont
;
100 infoPtr
->hFont
= hFont
;
104 InvalidateRect(infoPtr
->hSelf
,
113 MonSelRectToScreen(IN PMONITORSELWND infoPtr
,
115 OUT PRECT prcOnScreen
)
118 OffsetRect(prcOnScreen
,
119 -infoPtr
->ScrollPos
.x
,
120 -infoPtr
->ScrollPos
.y
);
124 MonSelScreenToPt(IN PMONITORSELWND infoPtr
,
125 IN
const POINT
*pptOnScreen
,
128 ppt
->x
= pptOnScreen
->x
+ infoPtr
->ScrollPos
.x
;
129 ppt
->y
= pptOnScreen
->y
+ infoPtr
->ScrollPos
.y
;
133 MonSelMonInfoToRect(IN
const MONSL_MONINFO
*pMonInfo
,
136 prc
->left
= pMonInfo
->Position
.x
;
137 prc
->top
= pMonInfo
->Position
.y
;
138 prc
->right
= pMonInfo
->Position
.x
+ pMonInfo
->Size
.cx
;
139 prc
->bottom
= pMonInfo
->Position
.y
+ pMonInfo
->Size
.cy
;
143 MonSelHitTest(IN PMONITORSELWND infoPtr
,
149 if (infoPtr
->CanDisplay
)
151 MonSelScreenToPt(infoPtr
,
155 for (Index
= 0; Index
< (INT
)infoPtr
->MonitorsCount
; Index
++)
157 if (PtInRect(&infoPtr
->Monitors
[Index
].rc
,
170 MonSelUpdateExtent(IN OUT PMONITORSELWND infoPtr
)
175 /* NOTE: This routine calculates the extent of all monitor coordinates.
176 These are not control coordinates! */
177 if (infoPtr
->MonitorsCount
> 0)
179 MonSelMonInfoToRect(&infoPtr
->MonitorInfo
[0],
182 for (Index
= 1; Index
< infoPtr
->MonitorsCount
; Index
++)
184 MonSelMonInfoToRect(&infoPtr
->MonitorInfo
[Index
],
187 UnionRect(&infoPtr
->rcExtent
,
194 ZeroMemory(&infoPtr
->rcExtent
,
195 sizeof(infoPtr
->rcExtent
));
200 MonSelScaleRectRelative(IN
const RECT
*prcBaseFrom
,
201 IN
const RECT
*prcFrom
,
202 IN
const RECT
*prcBaseTo
,
205 SIZE BaseFrom
, BaseTo
, From
;
207 BaseFrom
.cx
= prcBaseFrom
->right
- prcBaseFrom
->left
;
208 BaseFrom
.cy
= prcBaseFrom
->bottom
- prcBaseFrom
->top
;
209 BaseTo
.cx
= prcBaseTo
->right
- prcBaseTo
->left
;
210 BaseTo
.cy
= prcBaseTo
->bottom
- prcBaseTo
->top
;
211 From
.cx
= prcFrom
->right
- prcFrom
->left
;
212 From
.cy
= prcFrom
->bottom
- prcFrom
->top
;
214 prcTo
->left
= prcBaseTo
->left
+ (((prcFrom
->left
- prcBaseFrom
->left
) * BaseTo
.cx
) / BaseFrom
.cx
);
215 prcTo
->top
= prcBaseTo
->top
+ (((prcFrom
->top
- prcBaseFrom
->top
) * BaseTo
.cy
) / BaseFrom
.cy
);
216 prcTo
->right
= prcTo
->left
+ ((From
.cx
* BaseTo
.cx
) / BaseFrom
.cx
);
217 prcTo
->bottom
= prcTo
->top
+ ((From
.cy
* BaseTo
.cy
) / BaseFrom
.cy
);
221 ScaleRectSizeFit(IN
const RECT
*prcContainerRect
,
222 IN OUT PRECT prcRectToScale
)
224 SIZE ContainerSize
, RectSize
;
226 ContainerSize
.cx
= prcContainerRect
->right
- prcContainerRect
->left
;
227 ContainerSize
.cy
= prcContainerRect
->bottom
- prcContainerRect
->top
;
228 RectSize
.cx
= prcRectToScale
->right
- prcRectToScale
->left
;
229 RectSize
.cy
= prcRectToScale
->bottom
- prcRectToScale
->top
;
231 if (((RectSize
.cx
* 0xFFF) / RectSize
.cy
) < ((ContainerSize
.cx
* 0xFFF) / ContainerSize
.cy
))
233 RectSize
.cx
= (RectSize
.cx
* ((ContainerSize
.cy
* 0xFFF) / RectSize
.cy
)) / 0xFFF;
234 RectSize
.cy
= ContainerSize
.cy
;
238 RectSize
.cy
= (RectSize
.cy
* ((ContainerSize
.cx
* 0xFFF) / RectSize
.cx
)) / 0xFFF;
239 RectSize
.cx
= ContainerSize
.cx
;
242 prcRectToScale
->right
= prcRectToScale
->left
+ RectSize
.cx
;
243 prcRectToScale
->bottom
= prcRectToScale
->top
+ RectSize
.cy
;
245 OffsetRect(prcRectToScale
,
246 prcContainerRect
->left
+ ((ContainerSize
.cx
- RectSize
.cx
) / 2),
247 prcContainerRect
->top
+ ((ContainerSize
.cy
- RectSize
.cy
) / 2));
251 MonSelRepaint(IN PMONITORSELWND infoPtr
)
255 MonSelRectToScreen(infoPtr
,
256 &infoPtr
->rcMonitors
,
258 InvalidateRect(infoPtr
->hSelf
,
264 MonSelRepaintMonitor(IN PMONITORSELWND infoPtr
,
269 if (Index
< infoPtr
->MonitorsCount
)
271 MonSelRectToScreen(infoPtr
,
272 &infoPtr
->Monitors
[Index
].rc
,
274 InvalidateRect(infoPtr
->hSelf
,
281 MonSelRepaintSelected(IN PMONITORSELWND infoPtr
)
283 if (infoPtr
->SelectedMonitor
>= 0)
285 MonSelRepaintMonitor(infoPtr
,
286 (DWORD
)infoPtr
->SelectedMonitor
);
291 MonSelResetMonitors(IN OUT PMONITORSELWND infoPtr
)
295 for (Index
= 0; Index
< infoPtr
->MonitorsCount
; Index
++)
297 if (infoPtr
->Monitors
[Index
].hFont
!= NULL
)
299 DeleteObject(infoPtr
->Monitors
[Index
].hFont
);
300 infoPtr
->Monitors
[Index
].hFont
= NULL
;
307 MonSelUpdateMonitorsInfo(IN OUT PMONITORSELWND infoPtr
,
310 RECT rcExtSurface
, rcExtDisplay
;
313 /* Recalculate rcExtent */
314 MonSelUpdateExtent(infoPtr
);
316 infoPtr
-> CanDisplay
= infoPtr
->MonitorsCount
!= 0 &&
317 (infoPtr
->ClientSize
.cx
> (2 * (infoPtr
->Margin
.cx
+ infoPtr
->SelectionFrame
.cx
))) &&
318 (infoPtr
->ClientSize
.cy
> (2 * (infoPtr
->Margin
.cy
+ infoPtr
->SelectionFrame
.cy
)));
320 if (infoPtr
->CanDisplay
)
322 /* Calculate the rectangle on the control in which may be painted */
323 rcExtSurface
.left
= infoPtr
->Margin
.cx
;
324 rcExtSurface
.top
= infoPtr
->Margin
.cy
;
325 rcExtSurface
.right
= rcExtSurface
.left
+ infoPtr
->ClientSize
.cx
- (2 * infoPtr
->Margin
.cx
);
326 rcExtSurface
.bottom
= rcExtSurface
.top
+ infoPtr
->ClientSize
.cy
- (2 * infoPtr
->Margin
.cy
);
328 /* Calculate the rectangle on the control that is actually painted on */
329 rcExtDisplay
.left
= rcExtDisplay
.top
= 0;
330 rcExtDisplay
.right
= infoPtr
->rcExtent
.right
- infoPtr
->rcExtent
.left
;
331 rcExtDisplay
.bottom
= infoPtr
->rcExtent
.bottom
- infoPtr
->rcExtent
.top
;
333 ScaleRectSizeFit(&rcExtSurface
,
336 infoPtr
->rcMonitors
= rcExtDisplay
;
338 /* Now that we know in which area all monitors are located,
339 calculate the monitors selection rectangles on the screen */
341 for (Index
= 0; Index
< infoPtr
->MonitorsCount
; Index
++)
343 MonSelMonInfoToRect(&infoPtr
->MonitorInfo
[Index
],
346 MonSelScaleRectRelative(&infoPtr
->rcExtent
,
348 &infoPtr
->rcMonitors
,
349 &infoPtr
->Monitors
[Index
].rc
);
352 MonSelResetMonitors(infoPtr
);
355 MonSelRepaint(infoPtr
);
359 InvalidateRect(infoPtr
->hSelf
,
366 MonSelSetMonitorsInfo(IN OUT PMONITORSELWND infoPtr
,
368 IN
const MONSL_MONINFO
*MonitorsInfo
)
373 if (infoPtr
->MonitorInfo
!= NULL
)
375 LocalFree((HLOCAL
)infoPtr
->MonitorInfo
);
376 infoPtr
->MonitorInfo
= NULL
;
378 MonSelResetMonitors(infoPtr
);
380 LocalFree((HLOCAL
)infoPtr
->Monitors
);
381 infoPtr
->Monitors
= NULL
;
383 infoPtr
->MonitorsCount
= 0;
388 infoPtr
->MonitorInfo
= (PMONSL_MONINFO
)LocalAlloc(LMEM_FIXED
,
389 dwMonitors
* sizeof(MONSL_MONINFO
));
390 if (infoPtr
->MonitorInfo
!= NULL
)
392 infoPtr
->Monitors
= (PMONSL_MON
)LocalAlloc(LMEM_FIXED
,
393 dwMonitors
* sizeof(MONSL_MON
));
394 if (infoPtr
->Monitors
!= NULL
)
396 CopyMemory(infoPtr
->MonitorInfo
,
398 dwMonitors
* sizeof(MONSL_MONINFO
));
399 ZeroMemory(infoPtr
->Monitors
,
400 dwMonitors
* sizeof(MONSL_MON
));
402 for (Index
= 0; Index
< dwMonitors
; Index
++)
404 _stprintf(infoPtr
->Monitors
[Index
].szCaption
,
409 infoPtr
->MonitorsCount
= dwMonitors
;
411 if (infoPtr
->SelectedMonitor
>= (INT
)infoPtr
->MonitorsCount
)
412 infoPtr
->SelectedMonitor
= -1;
414 if (!(infoPtr
->ControlExStyle
& MSLM_EX_ALLOWSELECTNONE
) && infoPtr
->SelectedMonitor
< 0)
415 infoPtr
->SelectedMonitor
= 0;
417 MonSelUpdateMonitorsInfo(infoPtr
,
422 LocalFree((HLOCAL
)infoPtr
->MonitorInfo
);
423 infoPtr
->MonitorInfo
= NULL
;
433 infoPtr
->SelectedMonitor
= -1;
435 if (!Ret
|| dwMonitors
== 0)
437 InvalidateRect(infoPtr
->hSelf
,
446 MonSelGetMonitorsInfo(IN PMONITORSELWND infoPtr
,
448 IN OUT PMONSL_MONINFO MonitorsInfo
)
452 if (dwMonitors
> infoPtr
->MonitorsCount
)
453 dwMonitors
= infoPtr
->MonitorsCount
;
455 CopyMemory(MonitorsInfo
,
456 infoPtr
->MonitorInfo
,
457 dwMonitors
* sizeof(MONSL_MONINFO
));
461 return infoPtr
->MonitorsCount
;
465 MonSelSetMonitorInfo(IN OUT PMONITORSELWND infoPtr
,
467 IN
const MONSL_MONINFO
*MonitorsInfo
)
469 if (Index
>= 0 && Index
< (INT
)infoPtr
->MonitorsCount
)
471 CopyMemory(&infoPtr
->MonitorInfo
[Index
],
473 sizeof(MONSL_MONINFO
));
475 MonSelUpdateMonitorsInfo(infoPtr
,
484 MonSelGetMonitorInfo(IN PMONITORSELWND infoPtr
,
486 IN OUT PMONSL_MONINFO MonitorsInfo
)
488 if (Index
>= 0 && Index
< (INT
)infoPtr
->MonitorsCount
)
490 CopyMemory(MonitorsInfo
,
491 &infoPtr
->MonitorInfo
[Index
],
492 sizeof(MONSL_MONINFO
));
500 MonSelSetCurSelMonitor(IN OUT PMONITORSELWND infoPtr
,
505 BOOL PreventSelect
= FALSE
;
508 if (Index
== -1 || Index
< (INT
)infoPtr
->MonitorsCount
)
510 if (Index
!= infoPtr
->SelectedMonitor
)
512 if ((infoPtr
->MonitorInfo
[Index
].Flags
& MSL_MIF_DISABLED
) &&
513 !(infoPtr
->ControlExStyle
& MSLM_EX_ALLOWSELECTDISABLED
))
515 PreventSelect
= TRUE
;
518 if (!PreventSelect
&& bNotify
)
520 MONSL_MONNMMONITORCHANGING nmi
;
522 nmi
.PreviousSelected
= infoPtr
->SelectedMonitor
;
523 nmi
.AllowChanging
= TRUE
;
525 MonSelNotifyMonitor(infoPtr
,
526 MSLN_MONITORCHANGING
,
530 PreventSelect
= (nmi
.AllowChanging
== FALSE
);
535 PrevSel
= infoPtr
->SelectedMonitor
;
536 infoPtr
->SelectedMonitor
= Index
;
540 MonSelRepaintMonitor(infoPtr
,
544 if (infoPtr
->SelectedMonitor
>= 0)
545 MonSelRepaintSelected(infoPtr
);
551 MonSelNotifyMonitor(infoPtr
,
566 MonSelCreate(IN OUT PMONITORSELWND infoPtr
)
568 infoPtr
->SelectionFrame
.cx
= infoPtr
->SelectionFrame
.cy
= 4;
569 infoPtr
->Margin
.cx
= infoPtr
->Margin
.cy
= 20;
570 infoPtr
->SelectedMonitor
= -1;
571 infoPtr
->ControlExStyle
= MSLM_EX_ALLOWSELECTDISABLED
;
576 MonSelDestroy(IN OUT PMONITORSELWND infoPtr
)
578 /* Free all monitors */
579 MonSelSetMonitorsInfo(infoPtr
,
583 if (infoPtr
->hbrDisabled
!= NULL
)
585 DeleteObject(infoPtr
->hbrDisabled
);
586 infoPtr
->hbrDisabled
= NULL
;
589 if (infoPtr
->hbmDisabledPattern
!= NULL
)
591 DeleteObject(infoPtr
->hbmDisabledPattern
);
592 infoPtr
->hbmDisabledPattern
= NULL
;
597 MonSelSetExtendedStyle(IN OUT PMONITORSELWND infoPtr
,
598 IN DWORD dwExtendedStyle
)
600 if (dwExtendedStyle
!= infoPtr
->ControlExStyle
)
602 infoPtr
->ControlExStyle
= dwExtendedStyle
;
604 /* Repaint the control */
605 InvalidateRect(infoPtr
->hSelf
,
614 MonSelGetExtendedStyle(IN PMONITORSELWND infoPtr
)
616 return infoPtr
->ControlExStyle
;
620 MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr
,
627 HFONT hPrevFont
, hFont
;
630 hFont
= infoPtr
->Monitors
[Index
].hFont
;
632 GetObject(infoPtr
->hFont
,
636 rcsize
.cx
= infoPtr
->Monitors
[Index
].rc
.right
- infoPtr
->Monitors
[Index
].rc
.left
-
637 (2 * infoPtr
->SelectionFrame
.cx
) - 2;
638 rcsize
.cy
= infoPtr
->Monitors
[Index
].rc
.bottom
- infoPtr
->Monitors
[Index
].rc
.top
-
639 (2 * infoPtr
->SelectionFrame
.cy
) - 2;
640 rcsize
.cy
= (rcsize
.cy
* 60) / 100;
642 len
= _tcslen(infoPtr
->Monitors
[Index
].szCaption
);
644 hPrevFont
= SelectObject(hDC
,
647 if (GetTextMetrics(hDC
,
650 lf
.lfWeight
= FW_SEMIBOLD
;
651 lf
.lfHeight
= -MulDiv(rcsize
.cy
- tm
.tmExternalLeading
,
656 hFont
= CreateFontIndirect(&lf
);
658 infoPtr
->Monitors
[Index
].hFont
= hFont
;
669 MonSelDrawDisabledRect(IN OUT PMONITORSELWND infoPtr
,
675 if (infoPtr
->hbrDisabled
== NULL
)
677 static const DWORD Pattern
[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
679 if (infoPtr
->hbmDisabledPattern
== NULL
)
681 infoPtr
->hbmDisabledPattern
= CreateBitmap(8,
688 if (infoPtr
->hbmDisabledPattern
!= NULL
)
689 infoPtr
->hbrDisabled
= CreatePatternBrush(infoPtr
->hbmDisabledPattern
);
692 if (infoPtr
->hbrDisabled
!= NULL
)
694 /* FIXME - implement */
701 MonSelPaint(IN OUT PMONITORSELWND infoPtr
,
703 IN
const RECT
*prcUpdate
)
705 COLORREF crPrevText
, crPrevText2
;
706 HFONT hFont
, hPrevFont
;
707 HBRUSH hbBk
, hbOldBk
;
713 hbBk
= GetSysColorBrush(COLOR_BACKGROUND
);
714 hpFg
= CreatePen(PS_SOLID
,
716 GetSysColor(COLOR_HIGHLIGHTTEXT
));
718 hbOldBk
= SelectObject(hDC
,
720 hpOldFg
= SelectObject(hDC
,
722 iPrevBkMode
= SetBkMode(hDC
,
724 crPrevText
= SetTextColor(hDC
,
725 GetSysColor(COLOR_HIGHLIGHTTEXT
));
727 for (Index
= 0; Index
< infoPtr
->MonitorsCount
; Index
++)
729 MonSelRectToScreen(infoPtr
,
730 &infoPtr
->Monitors
[Index
].rc
,
733 if (!IntersectRect(&rctmp
,
740 if ((INT
)Index
== infoPtr
->SelectedMonitor
)
744 (HBRUSH
)(COLOR_HIGHLIGHT
+ 1));
746 if (infoPtr
->HasFocus
&& !(infoPtr
->UIState
& UISF_HIDEFOCUS
))
748 /* NOTE: We need to switch the text color to the default, because
749 DrawFocusRect draws a solid line if the text is white! */
751 crPrevText2
= SetTextColor(hDC
,
763 -infoPtr
->SelectionFrame
.cx
,
764 -infoPtr
->SelectionFrame
.cy
);
776 hFont
= MonSelGetMonitorFont(infoPtr
,
781 hPrevFont
= SelectObject(hDC
,
785 infoPtr
->Monitors
[Index
].szCaption
,
788 DT_VCENTER
| DT_CENTER
| DT_NOPREFIX
| DT_SINGLELINE
);
794 if (infoPtr
->MonitorInfo
[Index
].Flags
& MSL_MIF_DISABLED
)
800 MonSelDrawDisabledRect(infoPtr
,
816 static LRESULT CALLBACK
817 MonitorSelWndProc(IN HWND hwnd
,
822 PMONITORSELWND infoPtr
;
825 infoPtr
= (PMONITORSELWND
)GetWindowLongPtrW(hwnd
,
828 if (infoPtr
== NULL
&& uMsg
!= WM_CREATE
)
830 goto HandleDefaultMessage
;
843 if (!GetUpdateRect(hwnd
,
853 hDC
= BeginPaint(hwnd
,
861 if (infoPtr
->CanDisplay
)
876 case WM_LBUTTONDBLCLK
:
883 pt
.x
= (LONG
)LOWORD(lParam
);
884 pt
.y
= (LONG
)HIWORD(lParam
);
886 Index
= MonSelHitTest(infoPtr
,
888 if (Index
>= 0 || (infoPtr
->ControlExStyle
& MSLM_EX_ALLOWSELECTNONE
))
890 MonSelSetCurSelMonitor(infoPtr
,
900 if (!infoPtr
->HasFocus
)
909 virtKey
= (lParam
!= 0 ? (INT
)((LPMSG
)lParam
)->wParam
: 0);
914 /* change the UI status */
915 SendMessage(GetAncestor(hwnd
,
918 MAKEWPARAM(UIS_INITIALIZE
,
925 Ret
|= DLGC_WANTARROWS
;
931 infoPtr
->HasFocus
= TRUE
;
932 MonSelRepaintSelected(infoPtr
);
938 infoPtr
->HasFocus
= FALSE
;
939 MonSelRepaintSelected(infoPtr
);
943 case WM_UPDATEUISTATE
:
945 DWORD OldUIState
= infoPtr
->UIState
;
946 switch (LOWORD(wParam
))
949 infoPtr
->UIState
|= HIWORD(wParam
);
953 infoPtr
->UIState
&= ~HIWORD(wParam
);
957 if (infoPtr
->UIState
!= OldUIState
)
958 MonSelRepaintSelected(infoPtr
);
964 Ret
= (LRESULT
)MonSelChangeFont(infoPtr
,
966 (BOOL
)LOWORD(lParam
));
972 infoPtr
->ClientSize
.cx
= LOWORD(lParam
);
973 infoPtr
->ClientSize
.cy
= HIWORD(lParam
);
975 /* Don't let MonSelUpdateMonitorsInfo repaint the control
976 because this won't work properly in case the control
978 MonSelUpdateMonitorsInfo(infoPtr
,
980 InvalidateRect(infoPtr
->hSelf
,
988 Ret
= (LRESULT
)infoPtr
->hFont
;
994 infoPtr
->Enabled
= ((BOOL
)wParam
!= FALSE
);
995 MonSelRepaint(infoPtr
);
999 case WM_STYLECHANGED
:
1001 if (wParam
== GWL_STYLE
)
1003 unsigned int OldEnabled
= infoPtr
->Enabled
;
1004 infoPtr
->Enabled
= !(((LPSTYLESTRUCT
)lParam
)->styleNew
& WS_DISABLED
);
1006 if (OldEnabled
!= infoPtr
->Enabled
)
1007 MonSelRepaint(infoPtr
);
1012 case MSLM_SETMONITORSINFO
:
1014 Ret
= MonSelSetMonitorsInfo(infoPtr
,
1016 (const MONSL_MONINFO
*)lParam
);
1020 case MSLM_GETMONITORSINFO
:
1022 Ret
= MonSelGetMonitorsInfo(infoPtr
,
1024 (PMONSL_MONINFO
)lParam
);
1028 case MSLM_GETMONITORINFOCOUNT
:
1030 Ret
= infoPtr
->MonitorsCount
;
1036 Ret
= MonSelHitTest(infoPtr
,
1037 (const POINT
*)wParam
);
1041 case MSLM_SETCURSEL
:
1043 Ret
= MonSelSetCurSelMonitor(infoPtr
,
1049 case MSLM_GETCURSEL
:
1051 Ret
= infoPtr
->SelectedMonitor
;
1055 case MSLM_SETMONITORINFO
:
1057 Ret
= MonSelSetMonitorInfo(infoPtr
,
1059 (const MONSL_MONINFO
*)lParam
);
1063 case MSLM_GETMONITORINFO
:
1065 Ret
= MonSelGetMonitorInfo(infoPtr
,
1067 (PMONSL_MONINFO
)lParam
);
1071 case MSLM_SETEXSTYLE
:
1073 Ret
= MonSelSetExtendedStyle(infoPtr
,
1078 case MSLM_GETEXSTYLE
:
1080 Ret
= MonSelGetExtendedStyle(infoPtr
);
1086 infoPtr
= (PMONITORSELWND
) HeapAlloc(GetProcessHeap(),
1088 sizeof(MONITORSELWND
));
1089 if (infoPtr
== NULL
)
1096 sizeof(MONITORSELWND
));
1097 infoPtr
->hSelf
= hwnd
;
1098 infoPtr
->hNotify
= ((LPCREATESTRUCTW
)lParam
)->hwndParent
;
1099 infoPtr
->Enabled
= !(((LPCREATESTRUCTW
)lParam
)->style
& WS_DISABLED
);
1100 infoPtr
->UIState
= SendMessage(hwnd
,
1105 SetWindowLongPtrW(hwnd
,
1109 MonSelCreate(infoPtr
);
1115 MonSelDestroy(infoPtr
);
1117 HeapFree(GetProcessHeap(),
1120 SetWindowLongPtrW(hwnd
,
1128 HandleDefaultMessage
:
1129 Ret
= DefWindowProcW(hwnd
,
1141 RegisterMonitorSelectionControl(IN HINSTANCE hInstance
)
1145 wc
.style
= CS_DBLCLKS
;
1146 wc
.lpfnWndProc
= MonitorSelWndProc
;
1147 wc
.cbWndExtra
= sizeof(PMONITORSELWND
);
1148 wc
.hInstance
= hInstance
;
1149 wc
.hCursor
= LoadCursorW(NULL
,
1151 wc
.hbrBackground
= (HBRUSH
)(COLOR_APPWORKSPACE
+ 1);
1152 wc
.lpszClassName
= szMonitorSelWndClass
;
1154 return RegisterClass(&wc
) != 0;
1158 UnregisterMonitorSelectionControl(IN HINSTANCE hInstance
)
1160 UnregisterClassW(szMonitorSelWndClass
,