Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.8 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1996
  4. *
  5. * TITLE: POWERCFP.H
  6. *
  7. * VERSION: 2.0
  8. *
  9. * AUTHOR: ReedB
  10. *
  11. * DATE: 17 Oct, 1996
  12. *
  13. * DESCRIPTION:
  14. * Public declarations for PowerCfg notification interface. Systray uses
  15. * this interface to notify PowerCfg that the user has changed something.
  16. *
  17. *******************************************************************************/
  18. // Private PowerCfg notification message.
  19. #define PCWM_NOTIFYPOWER (WM_USER + 201)
  20. #define IDS_POWERPOLICIESTITLE 400
  21. /*******************************************************************************
  22. *
  23. * PowerCfg_Notify
  24. *
  25. * DESCRIPTION:
  26. * Called by Systray to notify PowerCfg that something has changed.
  27. *
  28. * PARAMETERS:
  29. *
  30. *******************************************************************************/
  31. _inline BOOL PowerCfg_Notify(void)
  32. {
  33. HINSTANCE hInst;
  34. static LPTSTR lpszWndName;
  35. TCHAR szBuf[128];
  36. HWND hwnd, hwndPC;
  37. int iLen;
  38. // first time initialization of the PowerCfg top level property sheet title.
  39. if (!lpszWndName) {
  40. if (hInst = LoadLibrary(TEXT("powercfg.cpl"))) {
  41. iLen = LoadString(hInst, IDS_POWERPOLICIESTITLE, szBuf, sizeof(szBuf)/sizeof(TCHAR));
  42. if (iLen) {
  43. if (lpszWndName = LocalAlloc(0, (iLen + 1) * sizeof(TCHAR))) {
  44. lstrcpy(lpszWndName, szBuf);
  45. }
  46. }
  47. }
  48. }
  49. // Notify the child of the top level window.
  50. if (lpszWndName) {
  51. hwndPC = FindWindow(WC_DIALOG, lpszWndName);
  52. if (hwndPC) {
  53. hwnd = GetWindow(hwndPC, GW_CHILD);
  54. if (hwnd) {
  55. return (BOOL)SendMessage(hwnd, PCWM_NOTIFYPOWER, 0, 0);
  56. }
  57. }
  58. }
  59. return FALSE;
  60. }