1 #pragma once 2 3 /* Control extended styles */ 4 #define MSLM_EX_ALLOWSELECTNONE 0x1 5 #define MSLM_EX_ALLOWSELECTDISABLED 0x2 6 #define MSLM_EX_HIDENUMBERONSINGLE 0x4 7 #define MSLM_EX_HIDENUMBERS 0x8 8 #define MSLM_EX_SELECTONRIGHTCLICK 0x10 9 #define MSLM_EX_SELECTBYNUMKEY 0x20 10 #define MSLM_EX_SELECTBYARROWKEY 0x40 11 12 /* MONSL_MONINFO Flags */ 13 #define MSL_MIF_DISABLED 0x1 14 15 typedef struct _MONSL_MONINFO 16 { 17 POINT Position; 18 SIZE Size; 19 DWORD Flags; /* MSL_MIF_* */ 20 LPARAM lParam; 21 } MONSL_MONINFO, *PMONSL_MONINFO; 22 23 typedef struct _MONSL_MONNMHDR 24 { 25 NMHDR hdr; 26 INT Index; 27 /* NOTE: MonitorInfo is only valid if Index >= 0 */ 28 MONSL_MONINFO MonitorInfo; 29 } MONSL_MONNMHDR, *PMONSL_MONNMHDR; 30 31 typedef struct _MONSL_MONNMBUTTONCLICKED 32 { 33 /* Used with MSLN_MONITORCHANGING */ 34 MONSL_MONNMHDR hdr; 35 POINT pt; 36 } MONSL_MONNMBUTTONCLICKED, *PMONSL_MONNMBUTTONCLICKED; 37 38 typedef struct _MONSL_MONNMMONITORCHANGING 39 { 40 /* Used with MSLN_MONITORCHANGING */ 41 MONSL_MONNMHDR hdr; 42 INT PreviousSelected; 43 BOOL AllowChanging; 44 } MONSL_MONNMMONITORCHANGING, *PMONSL_MONNMMONITORCHANGING; 45 46 /* 47 * MSLN_MONITORCHANGING 48 * This notification code is sent through WM_NOTIFY before another monitor 49 * can be selected. This notification is not sent in response to a 50 * MSLM_SETCURSEL message. 51 * 52 * lParam: PMONSL_MONNMMONITORCHANGING 53 * Change AllowChanging to FALSE to prevent the new monitor to 54 * be selected. 55 */ 56 #define MSLN_MONITORCHANGING 101 57 58 /* 59 * MSLN_MONITORCHANGED 60 * This notification code is sent through WM_NOTIFY after a new monitor 61 * was selected. This notification is not sent in response to a 62 * MSLM_SETCURSEL message. 63 * 64 * lParam: PMONSL_MONNMHDR 65 */ 66 #define MSLN_MONITORCHANGED 102 67 68 /* 69 * MSLN_RBUTTONUP 70 * This notification code is sent through WM_NOTIFY after the user did a 71 * right click on the control. If the control's extended style 72 * MSLM_EX_SELECTONRIGHTCLICK is set and the user clicked on a monitor, 73 * that monitor is selected and relevant notifications are sent before 74 * this notification is sent. 75 * 76 * lParam: PMONSL_MONNMBUTTONCLICKED 77 */ 78 #define MSLN_RBUTTONUP 103 79 80 /* 81 * MSLM_SETMONITORSINFO 82 * wParam: DWORD 83 * Count of MONSL_MONINFO structures provided as lParam. 84 * lParam: PMONSL_MONINFO 85 * Array of wParam MONSL_MONINFO structures. 86 * 87 * Returns non-zero value if successful. 88 */ 89 #define MSLM_SETMONITORSINFO (WM_USER + 0x10) 90 91 /* 92 * MSLM_GETMONITORSINFO 93 * wParam: DWORD 94 * Length of MONSL_MONINFO array buffer provided in lParam. 95 * lParam: PMONSL_MONINFO 96 * Array of wParam MONSL_MONINFO structures 97 * 98 * Returns number of structures copied. 99 */ 100 #define MSLM_GETMONITORSINFO (WM_USER + 0x11) 101 102 /* 103 * MSLM_GETMONITORINFOCOUNT 104 * wParam: Ignored. 105 * lParam: Ignored. 106 * 107 * Returns number of monitors. 108 */ 109 #define MSLM_GETMONITORINFOCOUNT (WM_USER + 0x12) 110 111 /* 112 * MSLM_HITTEST 113 * wParam: PPOINT 114 * Pointer to a POINT structure specifying the coordinates 115 * relative to the client area of the control. 116 * lParam: Ignored. 117 * 118 * Returns the index of the monitor at this point, or -1. 119 */ 120 #define MSLM_HITTEST (WM_USER + 0x13) 121 122 /* 123 * MSLM_SETCURSEL 124 * wParam: INT 125 * Selects the monitor with this index. Pass -1 to clear the selection. 126 * lParam: Ignored. 127 * 128 * Returns a non-zero value if successful. 129 */ 130 #define MSLM_SETCURSEL (WM_USER + 0x14) 131 132 /* 133 * MSLM_GETCURSEL 134 * wParam: Ignored. 135 * lParam: Ignored. 136 * 137 * Returns the index of the selected monitor, or -1 if none is currently selected. 138 */ 139 #define MSLM_GETCURSEL (WM_USER + 0x15) 140 141 /* 142 * MSLM_SETMONITORINFO 143 * wParam: INT 144 * Index of the monitor information that is queried. 145 * lParam: PMONSL_MONINFO 146 * Pointer to a MONSL_MONINFO structures. 147 * 148 * Returns non-zero value if successful. 149 */ 150 #define MSLM_SETMONITORINFO (WM_USER + 0x16) 151 152 /* 153 * MSLM_GETMONITORINFO 154 * wParam: INT 155 * Index of the monitor information to be changed. 156 * lParam: PMONSL_MONINFO 157 * Pointer to a MONSL_MONINFO structures. 158 * 159 * Returns non-zero value if successful. 160 */ 161 #define MSLM_GETMONITORINFO (WM_USER + 0x17) 162 163 /* 164 * MSLM_SETEXSTYLE 165 * wParam: Ignored. 166 * lParam: DWORD 167 * Can be a combination of the following flags: 168 * * MSLM_EX_ALLOWSELECTNONE 169 * Allow deselecting a monitor by clicking into 170 * unused areas of the control. 171 * * MSLM_EX_ALLOWSELECTDISABLED 172 * Allow selecting disabled monitors. 173 * * MSLM_EX_HIDENUMBERONSINGLE 174 * Hides the monitor number if the control only 175 * displays one monitor. 176 * * MSLM_EX_HIDENUMBERS 177 * Does not show monitor numbers. 178 * * MSLM_EX_SELECTONRIGHTCLICK 179 * Selects a monitor when the user right clicks 180 * on it. 181 * * MSLM_EX_SELECTBYNUMKEY 182 * Allows selecting a monitor by using the keys 183 * '1' to '9'. 184 * * MSLM_EX_SELECTBYARROWKEY 185 * Allows selecting a monitor using the arrow keys. 186 * 187 * Returns non-zero value if successful. 188 */ 189 #define MSLM_SETEXSTYLE (WM_USER + 0x18) 190 191 /* 192 * MSLM_GETEXSTYLE 193 * wParam: Ignored. 194 * lParam: Ignored 195 * 196 * Returns the control's extended style flags. 197 */ 198 #define MSLM_GETEXSTYLE (WM_USER + 0x19) 199 200 /* 201 * MSLM_GETMONITORRECT 202 * wParam: INT 203 * Index of the monitor whose display rectangle is queried. 204 * lParam: PRECT 205 * Pointer to a RECT structure that receives the rectangle 206 * in coordinates relative to the control's client area. 207 * 208 * Returns a positive value if the rectangle is visible. 209 * Returns zero if the rectangle is invisible. 210 * Returns a negative value if the index is not valid. 211 */ 212 #define MSLM_GETMONITORRECT (WM_USER + 0x20) 213 214 BOOL RegisterMonitorSelectionControl(IN HINSTANCE hInstance); 215 VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance); 216