ReactOS  0.4.15-dev-4871-g4471ee4
settings.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Display Control Panel
4  * FILE: dll/cpl/desk/settings.c
5  * PURPOSE: Settings property page
6  *
7  * PROGRAMMERS: Trevor McCort (lycan359@gmail.com)
8  * HervĂ© Poussineau (hpoussin@reactos.org)
9  */
10 
11 #include "desk.h"
12 
13 typedef struct _SETTINGS_DATA
14 {
21 
22 typedef struct _TIMEOUTDATA
23 {
28 
29 static VOID
30 UpdateDisplay(IN HWND hwndDlg, PSETTINGS_DATA pData, IN BOOL bUpdateThumb)
31 {
32  TCHAR Buffer[64];
33  TCHAR Pixel[64];
34  DWORD index;
35  HWND hwndMonSel;
37 
38  LoadString(hApplet, IDS_PIXEL, Pixel, sizeof(Pixel) / sizeof(TCHAR));
39  _stprintf(Buffer, Pixel, pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth, pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight, Pixel);
41 
42  for (index = 0; index < pData->CurrentDisplayDevice->ResolutionsCount; index++)
43  {
44  if (pData->CurrentDisplayDevice->Resolutions[index].dmPelsWidth == pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth &&
45  pData->CurrentDisplayDevice->Resolutions[index].dmPelsHeight == pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight)
46  {
47  if (bUpdateThumb)
49  break;
50  }
51  }
52  if (LoadString(hApplet, (2900 + pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR)))
54 
55  hwndMonSel = GetDlgItem(hwndDlg, IDC_SETTINGS_MONSEL);
56  index = (INT)SendMessage(hwndMonSel, MSLM_GETCURSEL, 0, 0);
57  if (index != (DWORD)-1 && SendMessage(hwndMonSel, MSLM_GETMONITORINFO, index, (LPARAM)&info))
58  {
59  info.Size.cx = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
60  info.Size.cy = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
62  }
63 }
64 
65 static int
66 CompareSettings(PSETTINGS_ENTRY Entry, DWORD dmPelsWidth, DWORD dmPelsHeight,
67  DWORD dmBitsPerPel, DWORD dmDisplayFrequency)
68 {
69  if (Entry->dmPelsWidth == dmPelsWidth &&
70  Entry->dmPelsHeight == dmPelsHeight &&
71  Entry->dmBitsPerPel == dmBitsPerPel &&
72  Entry->dmDisplayFrequency == dmDisplayFrequency)
73  {
74  return 0;
75  }
76  else
77  if ((Entry->dmPelsWidth < dmPelsWidth) ||
78  (Entry->dmPelsWidth == dmPelsWidth && Entry->dmPelsHeight < dmPelsHeight) ||
79  (Entry->dmPelsWidth == dmPelsWidth && Entry->dmPelsHeight == dmPelsHeight &&
80  Entry->dmBitsPerPel < dmBitsPerPel))
81  {
82  return 1;
83  }
84  return -1;
85 }
86 
87 static PSETTINGS_ENTRY
88 GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTINGS_ENTRY* CurrentSettings)
89 {
91  DWORD NbSettings = 0;
92  DWORD iMode = 0;
93  DWORD dwFlags = 0;
95  HDC hDC;
96  PSETTINGS_ENTRY Current;
97  DWORD bpp, xres, yres;
98  DWORD curDispFreq;
99 
100  /* Get current settings */
101  *CurrentSettings = NULL;
105  xres = GetDeviceCaps(hDC, HORZRES);
106  yres = GetDeviceCaps(hDC, VERTRES);
107  DeleteDC(hDC);
108 
109  /* List all settings */
110  devmode.dmSize = (WORD)sizeof(devmode);
112 
113  if (!EnumDisplaySettingsEx(DeviceName, ENUM_CURRENT_SETTINGS, &devmode, dwFlags))
114  return NULL;
115 
116  curDispFreq = devmode.dmDisplayFrequency;
117 
118  while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
119  {
120  iMode++;
121 
122  if (devmode.dmPelsWidth < 640 ||
123  devmode.dmPelsHeight < 480 ||
124  devmode.dmDisplayFrequency != curDispFreq ||
125  (devmode.dmBitsPerPel != 4 &&
126  devmode.dmBitsPerPel != 8 &&
127  devmode.dmBitsPerPel != 16 &&
128  devmode.dmBitsPerPel != 24 &&
129  devmode.dmBitsPerPel != 32))
130  {
131  continue;
132  }
133 
134  Current = HeapAlloc(GetProcessHeap(), 0, sizeof(SETTINGS_ENTRY));
135  if (Current != NULL)
136  {
137  /* Sort resolutions by increasing height, and BPP */
138  PSETTINGS_ENTRY Previous = NULL;
139  PSETTINGS_ENTRY Next = Settings;
140  Current->dmPelsWidth = devmode.dmPelsWidth;
141  Current->dmPelsHeight = devmode.dmPelsHeight;
142  Current->dmBitsPerPel = devmode.dmBitsPerPel;
144  while (Next != NULL &&
148  {
149  Previous = Next;
150  Next = Next->Flink;
151  }
152  Current->Blink = Previous;
153  Current->Flink = Next;
154  if (Previous == NULL)
155  Settings = Current;
156  else
157  Previous->Flink = Current;
158  if (Next != NULL)
159  Next->Blink = Current;
160  if (devmode.dmPelsWidth == xres && devmode.dmPelsHeight == yres && devmode.dmBitsPerPel == bpp)
161  {
162  *CurrentSettings = Current;
163  }
164  NbSettings++;
165  }
166  }
167 
168  *pSettingsCount = NbSettings;
169  return Settings;
170 }
171 
172 static BOOL
174 {
175  PDISPLAY_DEVICE_ENTRY newEntry = NULL;
177  LPTSTR name = NULL;
178  LPTSTR key = NULL;
179  LPTSTR devid = NULL;
180  SIZE_T descriptionSize, nameSize, keySize, devidSize;
181  PSETTINGS_ENTRY Current;
182  DWORD ResolutionsCount = 1;
183  DWORD i;
184 
186  if (!newEntry) goto ByeBye;
187 
188  newEntry->Settings = GetPossibleSettings(DisplayDevice->DeviceName, &newEntry->SettingsCount, &newEntry->CurrentSettings);
189  if (!newEntry->Settings) goto ByeBye;
190 
195 
196  /* Count different resolutions */
197  for (Current = newEntry->Settings; Current != NULL; Current = Current->Flink)
198  {
199  if (Current->Flink != NULL &&
200  ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) ||
201  (Current->dmPelsHeight != Current->Flink->dmPelsHeight)))
202  {
203  ResolutionsCount++;
204  }
205  }
206 
207  newEntry->Resolutions = HeapAlloc(GetProcessHeap(), 0, ResolutionsCount * sizeof(RESOLUTION_INFO));
208  if (!newEntry->Resolutions) goto ByeBye;
209 
210  newEntry->ResolutionsCount = ResolutionsCount;
211 
212  /* Fill resolutions infos */
213  for (Current = newEntry->Settings, i = 0; Current != NULL; Current = Current->Flink)
214  {
215  if (Current->Flink == NULL ||
216  (Current->Flink != NULL &&
217  ((Current->dmPelsWidth != Current->Flink->dmPelsWidth) ||
218  (Current->dmPelsHeight != Current->Flink->dmPelsHeight))))
219  {
220  newEntry->Resolutions[i].dmPelsWidth = Current->dmPelsWidth;
221  newEntry->Resolutions[i].dmPelsHeight = Current->dmPelsHeight;
222  i++;
223  }
224  }
225  descriptionSize = (_tcslen(DisplayDevice->DeviceString) + 1) * sizeof(TCHAR);
226  description = HeapAlloc(GetProcessHeap(), 0, descriptionSize);
227  if (!description) goto ByeBye;
228 
229  nameSize = (_tcslen(DisplayDevice->DeviceName) + 1) * sizeof(TCHAR);
230  name = HeapAlloc(GetProcessHeap(), 0, nameSize);
231  if (!name) goto ByeBye;
232 
233  keySize = (_tcslen(DisplayDevice->DeviceKey) + 1) * sizeof(TCHAR);
234  key = HeapAlloc(GetProcessHeap(), 0, keySize);
235  if (!key) goto ByeBye;
236 
237  devidSize = (_tcslen(DisplayDevice->DeviceID) + 1) * sizeof(TCHAR);
238  devid = HeapAlloc(GetProcessHeap(), 0, devidSize);
239  if (!devid) goto ByeBye;
240 
241  memcpy(description, DisplayDevice->DeviceString, descriptionSize);
242  memcpy(name, DisplayDevice->DeviceName, nameSize);
243  memcpy(key, DisplayDevice->DeviceKey, keySize);
244  memcpy(devid, DisplayDevice->DeviceID, devidSize);
245  newEntry->DeviceDescription = description;
246  newEntry->DeviceName = name;
247  newEntry->DeviceKey = key;
248  newEntry->DeviceID = devid;
249  newEntry->DeviceStateFlags = DisplayDevice->StateFlags;
250  newEntry->Flink = pData->DisplayDeviceList;
251  pData->DisplayDeviceList = newEntry;
252  return TRUE;
253 
254 ByeBye:
255  if (newEntry != NULL)
256  {
257  if (newEntry->Settings != NULL)
258  {
259  Current = newEntry->Settings;
260  while (Current != NULL)
261  {
262  PSETTINGS_ENTRY Next = Current->Flink;
263  HeapFree(GetProcessHeap(), 0, Current);
264  Current = Next;
265  }
266  }
267  if (newEntry->Resolutions != NULL)
268  HeapFree(GetProcessHeap(), 0, newEntry->Resolutions);
269  HeapFree(GetProcessHeap(), 0, newEntry);
270  }
271  if (description != NULL)
273  if (name != NULL)
275  if (key != NULL)
276  HeapFree(GetProcessHeap(), 0, key);
277  return FALSE;
278 }
279 
280 static VOID
282 {
283  PSETTINGS_ENTRY Current;
284  DWORD index;
285 
286  pData->CurrentDisplayDevice = pDeviceEntry; /* Update variable */
287 
288  /* Fill color depths combo box */
290  for (Current = pDeviceEntry->Settings; Current != NULL; Current = Current->Flink)
291  {
292  TCHAR Buffer[64];
293  if (LoadString(hApplet, (2900 + Current->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR)))
294  {
296  if (index == (DWORD)CB_ERR)
297  {
300  }
301  }
302  }
303 
304  /* Fill device description */
305  SendDlgItemMessage(hwndDlg, IDC_SETTINGS_DEVICE, WM_SETTEXT, 0, (LPARAM)pDeviceEntry->DeviceDescription);
306 
307  /* Fill resolutions slider */
309  SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_SETRANGE, TRUE, MAKELONG(0, pDeviceEntry->ResolutionsCount - 1));
310 
311  UpdateDisplay(hwndDlg, pData, TRUE);
312 }
313 
314 static VOID
316 {
317  BITMAP bitmap;
318  DWORD Result = 0;
319  DWORD iDevNum = 0;
320  DWORD i;
321  DISPLAY_DEVICE displayDevice;
323 
324  pData = HeapAlloc(GetProcessHeap(), 0, sizeof(SETTINGS_DATA));
325  if (pData == NULL)
326  return;
327 
329 
330  /* Get video cards list */
331  pData->DisplayDeviceList = NULL;
332  displayDevice.cb = sizeof(displayDevice);
333  while (EnumDisplayDevices(NULL, iDevNum, &displayDevice, EDD_GET_DEVICE_INTERFACE_NAME))
334  {
335  if ((displayDevice.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) != 0)
336  {
337  if (AddDisplayDevice(pData, &displayDevice))
338  Result++;
339  }
340  iDevNum++;
341  }
342 
343  if (Result == 0)
344  {
345  /* No adapter found */
351 
352  /* Do not initialize the color spectrum bitmaps */
353  memset(pData->hSpectrumBitmaps, 0, sizeof(pData->hSpectrumBitmaps));
354  return;
355  }
356  else if (Result == 1)
357  {
359 
360  /* Single video adapter */
361  OnDisplayDeviceChanged(hwndDlg, pData, pData->DisplayDeviceList);
362 
363  monitors.Position.x = monitors.Position.y = 0;
364  monitors.Size.cx = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
365  monitors.Size.cy = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
366  monitors.Flags = 0;
367  SendDlgItemMessage(hwndDlg,
370  1,
371  (LPARAM)&monitors);
372  }
373  else /* FIXME: Incomplete! */
374  {
375  PMONSL_MONINFO pMonitors;
376  DWORD i;
377 
378  OnDisplayDeviceChanged(hwndDlg, pData, pData->DisplayDeviceList);
379 
380  pMonitors = (PMONSL_MONINFO)HeapAlloc(GetProcessHeap(), 0, sizeof(MONSL_MONINFO) * Result);
381  if (pMonitors)
382  {
383  DWORD hack = 1280;
384  for (i = 0; i < Result; i++)
385  {
386  pMonitors[i].Position.x = hack * i;
387  pMonitors[i].Position.y = 0;
388  pMonitors[i].Size.cx = pData->DisplayDeviceList->CurrentSettings->dmPelsWidth;
389  pMonitors[i].Size.cy = pData->DisplayDeviceList->CurrentSettings->dmPelsHeight;
390  pMonitors[i].Flags = 0;
391  }
392 
393  SendDlgItemMessage(hwndDlg,
396  Result,
397  (LPARAM)pMonitors);
398 
399  HeapFree(GetProcessHeap(), 0, pMonitors);
400  }
401  }
402 
403  /* Initialize the color spectrum bitmaps */
404  for (i = 0; i < NUM_SPECTRUM_BITMAPS; i++)
405  {
407 
408  if (pData->hSpectrumBitmaps[i] != NULL)
409  {
410  if (GetObjectW(pData->hSpectrumBitmaps[i], sizeof(BITMAP), &bitmap) != 0)
411  {
412  pData->cxSource[i] = bitmap.bmWidth;
413  pData->cySource[i] = bitmap.bmHeight;
414  }
415  else
416  {
417  pData->cxSource[i] = 0;
418  pData->cySource[i] = 0;
419  }
420  }
421  }
422 }
423 
424 /* Get the ID for SETTINGS_DATA::hSpectrumBitmaps */
425 static VOID
427 {
428  HDC hdcMem;
429  INT iBitmap;
430 
432 
433  if (!hdcMem)
434  return;
435 
436  switch(BitsPerPel)
437  {
438  case 4: iBitmap = 0; break;
439  case 8: iBitmap = 1; break;
440  default: iBitmap = 2;
441  }
442 
443  if (SelectObject(hdcMem, pData->hSpectrumBitmaps[iBitmap]))
444  {
445  StretchBlt(hDC,
446  client->left, client->top,
447  client->right - client->left,
448  client->bottom - client->top,
449  hdcMem, 0, 0,
450  pData->cxSource[iBitmap],
451  pData->cySource[iBitmap], SRCCOPY);
452  }
453 
454  DeleteDC(hdcMem);
455 }
456 
457 static VOID
459 {
460  /* If new BPP is not compatible with resolution:
461  * 1) try to find the nearest smaller matching resolution
462  * 2) otherwise, get the nearest bigger resolution
463  */
464  PSETTINGS_ENTRY Current;
465  DWORD dmNewBitsPerPel;
466  DWORD index;
467  HDC hSpectrumDC;
468  HWND hSpectrumControl;
469  RECT client;
470 
472  dmNewBitsPerPel = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_GETITEMDATA, index, 0);
473 
474  /* Show a new spectrum bitmap */
475  hSpectrumControl = GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM);
476  hSpectrumDC = GetDC(hSpectrumControl);
477  if (hSpectrumDC == NULL)
478  return;
479 
480  GetClientRect(hSpectrumControl, &client);
481  ShowColorSpectrum(hSpectrumDC, &client, dmNewBitsPerPel, pData);
482  ReleaseDC(hSpectrumControl, hSpectrumDC);
483 
484  /* Find if new parameters are valid */
485  Current = pData->CurrentDisplayDevice->CurrentSettings;
486  if (dmNewBitsPerPel == Current->dmBitsPerPel)
487  {
488  /* No change */
489  return;
490  }
491 
492  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
493 
494  if (dmNewBitsPerPel < Current->dmBitsPerPel)
495  {
496  Current = Current->Blink;
497  while (Current != NULL)
498  {
499  if (Current->dmBitsPerPel == dmNewBitsPerPel
500  && Current->dmPelsHeight == pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight
501  && Current->dmPelsWidth == pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth)
502  {
503  pData->CurrentDisplayDevice->CurrentSettings = Current;
504  UpdateDisplay(hwndDlg, pData, TRUE);
505  return;
506  }
507  Current = Current->Blink;
508  }
509  }
510  else
511  {
512  Current = Current->Flink;
513  while (Current != NULL)
514  {
515  if (Current->dmBitsPerPel == dmNewBitsPerPel
516  && Current->dmPelsHeight == pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight
517  && Current->dmPelsWidth == pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth)
518  {
519  pData->CurrentDisplayDevice->CurrentSettings = Current;
520  UpdateDisplay(hwndDlg, pData, TRUE);
521  return;
522  }
523  Current = Current->Flink;
524  }
525  }
526 
527  /* Search smaller resolution compatible with current color depth */
528  Current = pData->CurrentDisplayDevice->CurrentSettings->Blink;
529  while (Current != NULL)
530  {
531  if (Current->dmBitsPerPel == dmNewBitsPerPel)
532  {
533  pData->CurrentDisplayDevice->CurrentSettings = Current;
534  UpdateDisplay(hwndDlg, pData, TRUE);
535  return;
536  }
537  Current = Current->Blink;
538  }
539 
540  /* Search bigger resolution compatible with current color depth */
541  Current = pData->CurrentDisplayDevice->CurrentSettings->Flink;
542  while (Current != NULL)
543  {
544  if (Current->dmBitsPerPel == dmNewBitsPerPel)
545  {
546  pData->CurrentDisplayDevice->CurrentSettings = Current;
547  UpdateDisplay(hwndDlg, pData, TRUE);
548  return;
549  }
550  Current = Current->Flink;
551  }
552 
553  /* We shouldn't go there */
554 }
555 
556 static VOID
558  IN BOOL bUpdateThumb)
559 {
560  /* If new resolution is not compatible with color depth:
561  * 1) try to find the nearest bigger matching color depth
562  * 2) otherwise, get the nearest smaller color depth
563  */
564  PSETTINGS_ENTRY Current;
565  DWORD dmNewPelsHeight = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsHeight;
566  DWORD dmNewPelsWidth = pData->CurrentDisplayDevice->Resolutions[NewPosition].dmPelsWidth;
567  DWORD dmBitsPerPel;
568  DWORD dmDisplayFrequency;
569 
570  /* Find if new parameters are valid */
571  Current = pData->CurrentDisplayDevice->CurrentSettings;
572  if (dmNewPelsHeight == Current->dmPelsHeight && dmNewPelsWidth == Current->dmPelsWidth)
573  {
574  /* No change */
575  return;
576  }
577 
578  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
579 
580  dmBitsPerPel = Current->dmBitsPerPel;
581  dmDisplayFrequency = Current->dmDisplayFrequency;
582 
583  if (CompareSettings(Current, dmNewPelsWidth,
584  dmNewPelsHeight, dmBitsPerPel,
585  dmDisplayFrequency) < 0)
586  {
587  Current = Current->Blink;
588  while (Current != NULL)
589  {
590  if (Current->dmPelsHeight == dmNewPelsHeight
591  && Current->dmPelsWidth == dmNewPelsWidth
592  && Current->dmBitsPerPel == dmBitsPerPel)
593  {
594  pData->CurrentDisplayDevice->CurrentSettings = Current;
595  UpdateDisplay(hwndDlg, pData, bUpdateThumb);
596  return;
597  }
598  Current = Current->Blink;
599  }
600  }
601  else
602  {
603  Current = Current->Flink;
604  while (Current != NULL)
605  {
606  if (Current->dmPelsHeight == dmNewPelsHeight
607  && Current->dmPelsWidth == dmNewPelsWidth
608  && Current->dmBitsPerPel == dmBitsPerPel)
609  {
610  pData->CurrentDisplayDevice->CurrentSettings = Current;
611  UpdateDisplay(hwndDlg, pData, bUpdateThumb);
612  return;
613  }
614  Current = Current->Flink;
615  }
616  }
617 
618  /* Search bigger color depth compatible with current resolution */
619  Current = pData->CurrentDisplayDevice->CurrentSettings->Flink;
620  while (Current != NULL)
621  {
622  if (dmNewPelsHeight == Current->dmPelsHeight && dmNewPelsWidth == Current->dmPelsWidth)
623  {
624  pData->CurrentDisplayDevice->CurrentSettings = Current;
625  UpdateDisplay(hwndDlg, pData, bUpdateThumb);
626  return;
627  }
628  Current = Current->Flink;
629  }
630 
631  /* Search smaller color depth compatible with current resolution */
632  Current = pData->CurrentDisplayDevice->CurrentSettings->Blink;
633  while (Current != NULL)
634  {
635  if (dmNewPelsHeight == Current->dmPelsHeight && dmNewPelsWidth == Current->dmPelsWidth)
636  {
637  pData->CurrentDisplayDevice->CurrentSettings = Current;
638  UpdateDisplay(hwndDlg, pData, bUpdateThumb);
639  return;
640  }
641  Current = Current->Blink;
642  }
643 
644  /* We shouldn't go there */
645 }
646 
647 /* Property sheet page callback */
650 {
651  UINT Ret = 0;
652 
653  switch (uMsg)
654  {
655  case PSPCB_CREATE:
657  break;
658 
659  case PSPCB_RELEASE:
661  break;
662  }
663 
664  return Ret;
665 }
666 
667 static INT_PTR CALLBACK
669 {
671 
673 
674  switch(uMsg)
675  {
676  case WM_INITDIALOG:
677  /* Allocate the local dialog data */
679  if (pData == NULL)
680  return FALSE;
681 
682  /* Link the dialog data to the dialog */
684 
685  /* Timeout in seconds */
686  pData->nTimeout = 15;
687 
688  /* Load the raw timeout string */
689  LoadString(hApplet, IDS_TIMEOUTTEXT, pData->szRawBuffer, ARRAYSIZE(pData->szRawBuffer));
690 
691  /* Cook the timeout string and show it */
692  _stprintf(pData->szCookedBuffer, pData->szRawBuffer, pData->nTimeout);
693  SetDlgItemText(hwndDlg, IDC_TIMEOUTTEXT, pData->szCookedBuffer);
694 
695  /* Start the timer (ticks every second)*/
696  SetTimer(hwndDlg, 1, 1000, NULL);
697  break;
698 
699  case WM_TIMER:
700  /* Update the timepout value */
701  pData->nTimeout--;
702 
703  /* Update the timeout text */
704  _stprintf(pData->szCookedBuffer, pData->szRawBuffer, pData->nTimeout);
705  SetDlgItemText(hwndDlg, IDC_TIMEOUTTEXT, pData->szCookedBuffer);
706 
707  /* Kill the timer and return a 'No', if we ran out of time */
708  if (pData->nTimeout == 0)
709  {
710  KillTimer(hwndDlg, 1);
711  EndDialog(hwndDlg, IDNO);
712  }
713  break;
714 
715  case WM_COMMAND:
716  /* Kill the timer and return the clicked button id */
717  KillTimer(hwndDlg, 1);
718  EndDialog(hwndDlg, LOWORD(wParam));
719  break;
720 
721  case WM_DESTROY:
722  /* Free the local dialog data */
724  break;
725  }
726 
727  return FALSE;
728 }
729 
730 BOOL
732 {
733  TCHAR Message[1024], Title[256];
735 
736  RtlZeroMemory(&devmode, sizeof(devmode));
737  devmode.dmSize = (WORD)sizeof(devmode);
743 
744  *rc = ChangeDisplaySettingsEx(DeviceName,
745  &devmode,
746  NULL,
748  NULL);
749  switch (*rc)
750  {
752  break;
753 
754  case DISP_CHANGE_RESTART:
755  LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR));
758  return FALSE;
759 
760  case DISP_CHANGE_FAILED:
761  default:
762  LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR));
763  LoadString(hApplet, IDS_APPLY_FAILED, Message, sizeof(Message) / sizeof (TCHAR));
764  MessageBox(hwndDlg, Message, Title, MB_OK | MB_ICONSTOP);
765  return FALSE;
766  }
767 
769  {
770  return TRUE;
771  }
772  else
773  {
774  devmode.dmPelsWidth = seInit->dmPelsWidth;
778 
779  *rc = ChangeDisplaySettingsEx(DeviceName,
780  &devmode,
781  NULL,
783  NULL);
784  switch (*rc)
785  {
787  return FALSE;
788 
789  case DISP_CHANGE_RESTART:
790  LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR));
793  return FALSE;
794 
795  case DISP_CHANGE_FAILED:
796  default:
797  LoadString(hApplet, IDS_DISPLAY_SETTINGS, Title, sizeof(Title) / sizeof(TCHAR));
798  LoadString(hApplet, IDS_APPLY_FAILED, Message, sizeof(Message) / sizeof (TCHAR));
799  MessageBox(hwndDlg, Message, Title, MB_OK | MB_ICONSTOP);
800  return FALSE;
801  }
802  }
803 }
804 
805 static VOID
807 {
808  BOOL Ret;
809  LONG rc;
810 
811  Ret = SwitchDisplayMode(hwndDlg,
812  pData->CurrentDisplayDevice->DeviceName,
813  &pData->CurrentDisplayDevice->InitialSettings,
814  pData->CurrentDisplayDevice->CurrentSettings,
815  &rc);
816 
817  if (rc != DISP_CHANGE_SUCCESSFUL)
818  return;
819 
820  if (Ret)
821  {
822  pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth = pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth;
823  pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight = pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight;
824  pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel = pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel;
825  pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency = pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency;
826  }
827  else
828  {
829  pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth = pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth;
830  pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight = pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight;
831  pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel = pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel;
832  pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency = pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency;
833  UpdateDisplay(hwndDlg, pData, TRUE);
834  }
835 }
836 
837 /* Property page dialog callback */
840 {
842 
844 
845  switch(uMsg)
846  {
847  case WM_INITDIALOG:
848  {
849  SettingsOnInitDialog(hwndDlg);
850  break;
851  }
852  case WM_DRAWITEM:
853  {
854  LPDRAWITEMSTRUCT lpDrawItem;
855  lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
856 
857  if (lpDrawItem->CtlID == IDC_SETTINGS_SPECTRUM)
858  ShowColorSpectrum(lpDrawItem->hDC, &lpDrawItem->rcItem, pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel, pData);
859  break;
860  }
861  case WM_COMMAND:
862  {
863  DWORD controlId = LOWORD(wParam);
865 
866  if (controlId == IDC_SETTINGS_ADVANCED && command == BN_CLICKED)
867  {
868  if (DisplayAdvancedSettings(hwndDlg, pData->CurrentDisplayDevice))
869  {
871  ZeroMemory(&devmode, sizeof(devmode));
872  devmode.dmSize = (WORD)sizeof(devmode);
873  if (EnumDisplaySettingsExW(pData->CurrentDisplayDevice->DeviceName, ENUM_CURRENT_SETTINGS, &devmode, 0))
874  {
875  pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth = devmode.dmPelsWidth;
876  pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight = devmode.dmPelsHeight;
877  pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel = devmode.dmBitsPerPel;
878  pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency = devmode.dmDisplayFrequency;
879  pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth = pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth;
880  pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight = pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight;
881  pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel = pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel;
882  pData->CurrentDisplayDevice->CurrentSettings->dmDisplayFrequency = pData->CurrentDisplayDevice->InitialSettings.dmDisplayFrequency;
883  UpdateDisplay(hwndDlg, pData, TRUE);
884  }
885  }
886  }
887  else if (controlId == IDC_SETTINGS_BPP && command == CBN_SELCHANGE)
888  OnBPPChanged(hwndDlg, pData);
889  break;
890  }
891  case WM_HSCROLL:
892  {
893  switch (LOWORD(wParam))
894  {
895  case TB_LINEUP:
896  case TB_LINEDOWN:
897  case TB_PAGEUP:
898  case TB_PAGEDOWN:
899  case TB_TOP:
900  case TB_BOTTOM:
901  case TB_ENDTRACK:
902  {
903  DWORD newPosition = (DWORD) SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_GETPOS, 0, 0);
904  OnResolutionChanged(hwndDlg, pData, newPosition, TRUE);
905  break;
906  }
907 
908  case TB_THUMBTRACK:
910  break;
911  }
912  break;
913  }
914  case WM_NOTIFY:
915  {
916  LPNMHDR lpnm = (LPNMHDR)lParam;
917  if (lpnm->code == (UINT)PSN_APPLY)
918  {
919  if (pData->CurrentDisplayDevice->CurrentSettings->dmPelsWidth != pData->CurrentDisplayDevice->InitialSettings.dmPelsWidth
920  || pData->CurrentDisplayDevice->CurrentSettings->dmPelsHeight != pData->CurrentDisplayDevice->InitialSettings.dmPelsHeight
921  || pData->CurrentDisplayDevice->CurrentSettings->dmBitsPerPel != pData->CurrentDisplayDevice->InitialSettings.dmBitsPerPel)
922  {
923  /* Apply new settings */
924  ApplyDisplaySettings(hwndDlg, pData);
925  }
926  }
927  else if (lpnm->code == MSLN_MONITORCHANGED)
928  {
930  PDISPLAY_DEVICE_ENTRY Current = pData->DisplayDeviceList;
931  ULONG i;
932  for (i = 0; i < lpnmi->hdr.Index; i++)
933  Current = Current->Flink;
934  OnDisplayDeviceChanged(hwndDlg, pData, Current);
935  }
936  break;
937  }
938 
939  case WM_CONTEXTMENU:
940  {
941  HWND hwndMonSel;
942  HMENU hPopup;
943  UINT uiCmd;
944  POINT pt, ptClient;
945  INT Index;
946 
947  pt.x = (SHORT)LOWORD(lParam);
948  pt.y = (SHORT)HIWORD(lParam);
949 
950  hwndMonSel = GetDlgItem(hwndDlg,
952  if ((HWND)wParam == hwndMonSel)
953  {
954  if (pt.x == -1 && pt.y == -1)
955  {
956  RECT rcMon;
957 
958  Index = (INT)SendMessage(hwndMonSel,
960  0,
961  0);
962 
963  if (Index >= 0 &&
964  (INT)SendMessage(hwndMonSel,
966  Index,
967  (LPARAM)&rcMon) > 0)
968  {
969  pt.x = rcMon.left + ((rcMon.right - rcMon.left) / 2);
970  pt.y = rcMon.top + ((rcMon.bottom - rcMon.top) / 2);
971  }
972  else
973  pt.x = pt.y = 0;
974 
975  MapWindowPoints(hwndMonSel,
976  NULL,
977  &pt,
978  1);
979  }
980  else
981  {
982  ptClient = pt;
984  hwndMonSel,
985  &ptClient,
986  1);
987 
988  Index = (INT)SendMessage(hwndMonSel,
989  MSLM_HITTEST,
990  (WPARAM)&ptClient,
991  0);
992  }
993 
994  if (Index >= 0)
995  {
996  hPopup = LoadPopupMenu(hApplet,
998  if (hPopup != NULL)
999  {
1000  /* FIXME: Enable/Disable menu items */
1001  EnableMenuItem(hPopup,
1004  EnableMenuItem(hPopup,
1007  EnableMenuItem(hPopup,
1010  EnableMenuItem(hPopup,
1013 
1014  uiCmd = (UINT)TrackPopupMenu(hPopup,
1016  pt.x,
1017  pt.y,
1018  0,
1019  hwndDlg,
1020  NULL);
1021 
1022  switch (uiCmd)
1023  {
1024  case ID_MENU_ATTACHED:
1025  case ID_MENU_PRIMARY:
1026  case ID_MENU_IDENTIFY:
1027  case ID_MENU_PROPERTIES:
1028  /* FIXME: Implement */
1029  break;
1030  }
1031 
1032  DestroyMenu(hPopup);
1033  }
1034  }
1035  }
1036  break;
1037  }
1038 
1039  case WM_DESTROY:
1040  {
1041  DWORD i;
1042  PDISPLAY_DEVICE_ENTRY Current = pData->DisplayDeviceList;
1043 
1044  while (Current != NULL)
1045  {
1046  PDISPLAY_DEVICE_ENTRY Next = Current->Flink;
1047  PSETTINGS_ENTRY CurrentSettings = Current->Settings;
1048  while (CurrentSettings != NULL)
1049  {
1050  PSETTINGS_ENTRY NextSettings = CurrentSettings->Flink;
1051  HeapFree(GetProcessHeap(), 0, CurrentSettings);
1052  CurrentSettings = NextSettings;
1053  }
1054  HeapFree(GetProcessHeap(), 0, Current);
1055  Current = Next;
1056  }
1057 
1058  for (i = 0; i < NUM_SPECTRUM_BITMAPS; i++)
1059  {
1060  if (pData->hSpectrumBitmaps[i])
1061  DeleteObject(pData->hSpectrumBitmaps[i]);
1062  }
1063 
1064  HeapFree(GetProcessHeap(), 0, pData);
1065  }
1066  }
1067  return FALSE;
1068 }
#define TB_THUMBTRACK
Definition: commctrl.h:2078
#define CB_SETITEMDATA
Definition: winuser.h:1953
#define IDS_TIMEOUTTEXT
Definition: resource.h:188
#define MAKEINTRESOURCE
Definition: winuser.h:591
struct _SETTINGS_DATA SETTINGS_DATA
PSETTINGS_ENTRY CurrentSettings
Definition: precomp.h:79
#define BITSPIXEL
Definition: wingdi.h:720
#define IN
Definition: typedefs.h:39
#define IDC_SETTINGS_DEVICE
Definition: resource.h:61
#define HORZRES
Definition: wingdi.h:716
#define IDC_SETTINGS_RESOLUTION_TEXT
Definition: resource.h:21
static VOID OnResolutionChanged(IN HWND hwndDlg, IN PSETTINGS_DATA pData, IN DWORD NewPosition, IN BOOL bUpdateThumb)
Definition: settings.c:557
#define MF_DISABLED
Definition: winuser.h:130
struct _MONSL_MONINFO * PMONSL_MONINFO
#define TB_PAGEDOWN
Definition: commctrl.h:2076
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
struct _SETTINGS_ENTRY * Blink
Definition: precomp.h:60
LPWSTR DeviceKey
Definition: precomp.h:72
DWORD dmDisplayFrequency
Definition: desk.h:85
#define MF_BYCOMMAND
Definition: winuser.h:202
#define MSLM_SETMONITORSINFO
Definition: monslctl.h:89
long y
Definition: polytest.cpp:48
#define WM_CONTEXTMENU
Definition: richedit.h:64
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
SETTINGS_ENTRY InitialSettings
Definition: precomp.h:80
PDISPLAY_DEVICE_ENTRY DisplayDeviceList
Definition: settings.c:15
#define IDYES
Definition: winuser.h:829
_In_ ULONG iMode
Definition: winddi.h:3520
#define DISP_CHANGE_RESTART
Definition: winuser.h:191
DWORD dmFields
Definition: wingdi.h:1622
long x
Definition: polytest.cpp:48
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HDC WINAPI GetDC(_In_opt_ HWND)
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
int cxSource[NUM_SPECTRUM_BITMAPS]
Definition: settings.c:18
int cySource[NUM_SPECTRUM_BITMAPS]
Definition: settings.c:19
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define SW_HIDE
Definition: winuser.h:762
struct _DISPLAY_DEVICE_ENTRY * Flink
Definition: precomp.h:69
UINT CALLBACK SettingsPageCallbackProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp)
Definition: settings.c:649
uint16_t * PWSTR
Definition: typedefs.h:56
#define ID_MENU_PRIMARY
Definition: resource.h:80
BOOL DisplayAdvancedSettings(HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice)
Definition: advmon.c:81
#define TPM_RETURNCMD
Definition: winuser.h:2367
#define CB_GETITEMDATA
Definition: winuser.h:1937
#define MSLM_SETMONITORINFO
Definition: monslctl.h:150
DWORD dmPelsWidth
Definition: precomp.h:63
#define INT
Definition: polytest.cpp:20
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
#define TBM_SETRANGE
Definition: commctrl.h:2037
WORD dmDriverExtra
Definition: wingdi.h:1621
static int CompareSettings(PSETTINGS_ENTRY Entry, DWORD dmPelsWidth, DWORD dmPelsHeight, DWORD dmBitsPerPel, DWORD dmDisplayFrequency)
Definition: settings.c:66
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
Definition: precomp.h:67
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LPWSTR DeviceName
Definition: precomp.h:71
#define TBM_SETPOS
Definition: commctrl.h:2036
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
SSSTARS Settings
Definition: settings.c:33
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5822
#define MB_ICONSTOP
Definition: winuser.h:797
DWORD dmBitsPerPel
Definition: precomp.h:62
#define PSN_APPLY
Definition: prsht.h:117
const char * description
Definition: directx.c:2497
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
DWORD dmBitsPerPel
Definition: wingdi.h:1647
int32_t INT_PTR
Definition: typedefs.h:64
#define IDC_SETTINGS_RESOLUTION
Definition: resource.h:63
#define ID_MENU_IDENTIFY
Definition: resource.h:81
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1930
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
struct tagNMHDR * LPNMHDR
#define ENUM_CURRENT_SETTINGS
Definition: winuser.h:179
INT_PTR CALLBACK SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: settings.c:839
#define TB_PAGEUP
Definition: commctrl.h:2075
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define TB_LINEDOWN
Definition: commctrl.h:2074
UINT code
Definition: winuser.h:3139
#define MSLM_GETMONITORRECT
Definition: monslctl.h:212
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2592
#define TB_BOTTOM
Definition: commctrl.h:2080
#define DialogBox
Definition: winuser.h:5741
#define TPM_RIGHTBUTTON
Definition: winuser.h:2360
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define CDS_UPDATEREGISTRY
Definition: winuser.h:181
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
long LONG
Definition: pedump.c:60
#define TBM_GETPOS
Definition: commctrl.h:2031
short SHORT
Definition: pedump.c:59
static struct _test_info info[]
Definition: SetCursorPos.c:19
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static VOID SettingsOnInitDialog(IN HWND hwndDlg)
Definition: settings.c:315
#define DISP_CHANGE_FAILED
Definition: winuser.h:194
MONSL_MONNMHDR hdr
Definition: monslctl.h:41
#define CB_ADDSTRING
Definition: winuser.h:1923
#define MAKELONG(a, b)
Definition: typedefs.h:249
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
PSETTINGS_ENTRY Settings
Definition: precomp.h:75
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _MONSL_MONINFO MONSL_MONINFO
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
LONG cx
Definition: windef.h:334
#define IDS_PIXEL
Definition: resource.h:41
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_APPLY_NEEDS_RESTART
Definition: resource.h:160
Definition: bufpool.h:45
struct _TIMEOUTDATA * PTIMEOUTDATA
VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance)
Definition: monslctl.c:1655
GLuint index
Definition: glext.h:6031
#define PSPCB_RELEASE
Definition: prsht.h:37
#define WM_SETTEXT
Definition: winuser.h:1604
#define CB_RESETCONTENT
Definition: winuser.h:1946
#define CB_ERR
Definition: winuser.h:2415
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define IDC_SETTINGS_ADVANCED
Definition: resource.h:65
#define WM_DESTROY
Definition: winuser.h:1596
Definition: uimain.c:88
char TCHAR
Definition: xmlstorage.h:189
DWORD Flags
Definition: monslctl.h:19
PDISPLAY_DEVICE_ENTRY CurrentDisplayDevice
Definition: settings.c:16
static const WCHAR Title[]
Definition: oid.c:1259
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
DEVMODEW devmode
static PSETTINGS_ENTRY GetPossibleSettings(IN LPCTSTR DeviceName, OUT DWORD *pSettingsCount, OUT PSETTINGS_ENTRY *CurrentSettings)
Definition: settings.c:88
_In_ WDFCOLLECTION _In_ ULONG Index
#define WM_TIMER
Definition: winuser.h:1729
#define IDD_CONFIRMSETTINGS
Definition: resource.h:18
#define IDC_TIMEOUTTEXT
Definition: resource.h:187
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
Definition: wingdi.h:1396
WORD dmSize
Definition: wingdi.h:1620
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
static BOOL AddDisplayDevice(IN PSETTINGS_DATA pData, IN const DISPLAY_DEVICE *DisplayDevice)
Definition: settings.c:173
static FILE * client
Definition: client.c:41
unsigned short WORD
Definition: ntddk_ex.h:93
#define BN_CLICKED
Definition: winuser.h:1912
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID ApplyDisplaySettings(HWND hwndDlg, PSETTINGS_DATA pData)
Definition: settings.c:806
#define IDS_APPLY_FAILED
Definition: resource.h:159
#define MSLM_GETCURSEL
Definition: monslctl.h:139
HBITMAP hSpectrumBitmaps[NUM_SPECTRUM_BITMAPS]
Definition: settings.c:17
#define SetDlgItemText
Definition: winuser.h:5829
static VOID OnBPPChanged(IN HWND hwndDlg, IN PSETTINGS_DATA pData)
Definition: settings.c:458
GLuint * monitors
Definition: glext.h:11118
DWORD dmPelsWidth
Definition: wingdi.h:1648
CHAR Message[80]
Definition: alive.c:5
#define TB_LINEUP
Definition: commctrl.h:2073
#define TB_ENDTRACK
Definition: commctrl.h:2081
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define PSPCB_CREATE
Definition: prsht.h:38
#define TB_TOP
Definition: commctrl.h:2079
#define IDC_SETTINGS_SPECTRUM
Definition: resource.h:67
#define index(s, c)
Definition: various.h:29
#define IDC_SETTINGS_MONSEL
Definition: resource.h:66
#define DWLP_USER
Definition: winuser.h:866
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define CB_SELECTSTRING
Definition: winuser.h:1947
TCHAR szCookedBuffer[256]
Definition: settings.c:25
BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum, LPDEVMODEW lpDevMode, DWORD dwFlags)
Definition: display.c:330
HKEY key
Definition: reg.c:28
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1272
BOOL SwitchDisplayMode(HWND hwndDlg, PWSTR DeviceName, PSETTINGS_ENTRY seInit, PSETTINGS_ENTRY seNew, OUT PLONG rc)
Definition: settings.c:731
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD DeviceStateFlags
Definition: precomp.h:74
#define MessageBox
Definition: winuser.h:5802
#define WM_COMMAND
Definition: winuser.h:1727
DWORD dmPelsWidth
Definition: precomp.h:54
LPWSTR DeviceID
Definition: precomp.h:73
PRESOLUTION_INFO Resolutions
Definition: precomp.h:77
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define NUM_SPECTRUM_BITMAPS
Definition: desk.h:67
static VOID UpdateDisplay(IN HWND hwndDlg, PSETTINGS_DATA pData, IN BOOL bUpdateThumb)
Definition: settings.c:30
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
DWORD dmPelsHeight
Definition: precomp.h:55
#define ID_MENU_PROPERTIES
Definition: resource.h:82
#define _stprintf
Definition: utility.h:124
static HDC hDC
Definition: 3dtext.c:33
ULONG_PTR SIZE_T
Definition: typedefs.h:80
HMENU LoadPopupMenu(IN HINSTANCE hInstance, IN LPCWSTR lpMenuName)
Definition: util.cpp:33
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
DWORD dmDisplayFrequency
Definition: wingdi.h:1654
HWND WINAPI GetParent(_In_ HWND)
#define IDM_MONITOR_MENU
Definition: resource.h:78
DWORD StateFlags
Definition: wingdi.h:2812
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI DeleteDC(_In_ HDC)
#define IDB_SPECTRUM_4
Definition: resource.h:69
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
DWORD SettingsCount
Definition: precomp.h:76
Definition: bl.h:1330
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define ID_MENU_ATTACHED
Definition: resource.h:79
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define WM_HSCROLL
Definition: winuser.h:1730
#define MB_OK
Definition: winuser.h:784
#define VERTRES
Definition: wingdi.h:717
struct _TIMEOUTDATA TIMEOUTDATA
#define IDS_DISPLAY_SETTINGS
Definition: resource.h:157
#define IMAGE_BITMAP
Definition: winuser.h:211
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CBN_SELCHANGE
Definition: winuser.h:1966
#define MSLN_MONITORCHANGED
Definition: monslctl.h:66
INT nTimeout
Definition: settings.c:26
DWORD ResolutionsCount
Definition: precomp.h:78
static VOID ShowColorSpectrum(IN HDC hDC, IN LPRECT client, IN DWORD BitsPerPel, IN PSETTINGS_DATA pData)
Definition: settings.c:426
DWORD dmPelsHeight
Definition: wingdi.h:1649
#define WM_DRAWITEM
Definition: winuser.h:1632
static INT_PTR CALLBACK ConfirmDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: settings.c:668
#define IDC_SETTINGS_BPP
Definition: resource.h:62
DWORD dmPelsHeight
Definition: precomp.h:64
Definition: name.c:38
#define SendMessage
Definition: winuser.h:5823
#define OUT
Definition: typedefs.h:40
#define MSLM_HITTEST
Definition: monslctl.h:120
struct _SETTINGS_DATA * PSETTINGS_DATA
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
#define CreateIC
Definition: wingdi.h:4446
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define DM_BITSPERPEL
Definition: wingdi.h:1268
DWORD bpp
Definition: surface.c:185
static HBITMAP bitmap
Definition: clipboard.c:1344
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDNO
Definition: winuser.h:830
#define GetWindowLongPtr
Definition: treelist.c:73
#define MF_GRAYED
Definition: winuser.h:129
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPWSTR DeviceDescription
Definition: precomp.h:70
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define memset(x, y, z)
Definition: compat.h:39
signed int * PLONG
Definition: retypes.h:5
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LONG cy
Definition: windef.h:335
Definition: precomp.h:58
#define WM_INITDIALOG
Definition: winuser.h:1726
#define MSLM_GETMONITORINFO
Definition: monslctl.h:161
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define LOWORD(l)
Definition: pedump.c:82
POINT Position
Definition: monslctl.h:17
TCHAR szRawBuffer[256]
Definition: settings.c:24
#define HeapFree(x, y, z)
Definition: compat.h:594
#define TBM_CLEARTICS
Definition: commctrl.h:2040
#define SRCCOPY
Definition: wingdi.h:333
#define LoadString
Definition: winuser.h:5799
base of all file and directory entries
Definition: entries.h:82
static VOID OnDisplayDeviceChanged(IN HWND hwndDlg, IN PSETTINGS_DATA pData, IN PDISPLAY_DEVICE_ENTRY pDeviceEntry)
Definition: settings.c:281
HDC hdcMem
Definition: welcome.c:104
#define WM_NOTIFY
Definition: richedit.h:61
struct _SETTINGS_ENTRY * Flink
Definition: precomp.h:61
BOOL RegisterMonitorSelectionControl(IN HINSTANCE hInstance)
Definition: monslctl.c:1638
Definition: copy.c:22
#define PLANES
Definition: wingdi.h:721
struct _MONSL_MONNMMONITORCHANGING * PMONSL_MONNMMONITORCHANGING
GLuint const GLchar * name
Definition: glext.h:6031
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1927