Leaked source code of windows server 2003
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.

84 lines
2.5 KiB

  1. //---------------------------------------------------------------------------
  2. // Windows 4.0 Task Switcher. Copyright Microsoft Corp. 1993.
  3. // Insept: May 1993 IanEl.
  4. // Bastardised for RunOnce by FelixA.
  5. //---------------------------------------------------------------------------
  6. // #include <windows.h>
  7. #include "precomp.h"
  8. //---------------------------------------------------------------------------
  9. // Global to everybody...
  10. HINSTANCE g_hinst;
  11. HWND g_hwndLB = NULL;
  12. HWND g_hwndMain = NULL;
  13. HWND g_hwndStatus = NULL;
  14. const TCHAR g_szNull[] = TEXT("");
  15. // Icon sizes.
  16. int g_cxIcon = 0;
  17. int g_cyIcon = 0;
  18. int g_cxSmIcon = 0;
  19. int g_cySmIcon = 0;
  20. // Extent of text in buttons.
  21. DWORD g_dwBTextExt = 0;
  22. SIZE g_SizeTextExt;
  23. //---------------------------------------------------------------------------
  24. // Global to this file only...
  25. HFONT g_hfont = NULL;
  26. HFONT g_hBoldFont=NULL;
  27. static int g_iItemCur = 0;
  28. static TCHAR g_szLotsaWs[] = TEXT("WWWWWWWWWW");
  29. HBRUSH g_hbrBkGnd = NULL;
  30. //---------------------------------------------------------------------------
  31. BOOL CreateGlobals(HWND hwndCtl)
  32. {
  33. LOGFONT lf;
  34. HDC hdc;
  35. HFONT hfontOld;
  36. g_cxIcon = GetSystemMetrics(SM_CXICON);
  37. g_cyIcon = GetSystemMetrics(SM_CYICON);
  38. g_cxSmIcon = GetSystemMetrics(SM_CXSMICON);
  39. g_cySmIcon = GetSystemMetrics(SM_CYSMICON);
  40. g_hbrBkGnd = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
  41. // if (SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0))
  42. if ( (hfontOld = (HFONT)(WORD)SendMessage( hwndCtl, WM_GETFONT, 0, 0L )) != NULL )
  43. {
  44. if ( GetObject( hfontOld, sizeof(LOGFONT), (LPTSTR) &lf ) )
  45. {
  46. lf.lfWeight=400;
  47. g_hfont = CreateFontIndirect(&lf);
  48. lf.lfWeight=700;
  49. // lf.lfItalic=TRUE;
  50. g_hBoldFont = CreateFontIndirect(&lf);
  51. }
  52. }
  53. if (g_hfont)
  54. {
  55. // Calc sensible size for text in buttons.
  56. hdc = GetDC(NULL);
  57. hfontOld = SelectObject(hdc, g_hfont);
  58. GetTextExtentPoint(hdc, g_szLotsaWs, lstrlen(g_szLotsaWs), &g_SizeTextExt);
  59. SelectObject(hdc, hfontOld);
  60. ReleaseDC(NULL, hdc);
  61. return TRUE;
  62. }
  63. return FALSE;
  64. }
  65. //---------------------------------------------------------------------------
  66. VOID DestroyGlobals(void)
  67. {
  68. if (g_hfont)
  69. DeleteObject(g_hfont);
  70. if (g_hBoldFont)
  71. DeleteObject(g_hBoldFont);
  72. if (g_hbrBkGnd)
  73. DeleteObject(g_hbrBkGnd);
  74. }