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.

83 lines
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: util.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #pragma once
  11. class tstring;
  12. class CStr;
  13. ULONG _ttoul(LPTSTR psz);
  14. WORD I_SplitModuleAndResourceID(LPCTSTR szBuf);
  15. BOOL I_GetStrFromModule(LPCTSTR pszModule, ULONG ulMsgNo, CStr &strBuf);
  16. HICON I_GetHicon(LPCTSTR pszModule, ULONG ulId);
  17. LPSTR CoTaskDupString(LPCSTR lpszIn);
  18. LPWSTR CoTaskDupString(LPCWSTR lpszIn);
  19. LPTSTR NewDupString(LPCTSTR lpszIn);
  20. LPTSTR StripTrailingWhitespace (LPTSTR pszStart);
  21. HRESULT GUIDToCStr(CStr& str, const GUID& guid);
  22. HRESULT GUIDFromCStr(const CStr& str, GUID* pguid);
  23. bool IsWhistler ();
  24. HRESULT WriteCompatibleImageList (HIMAGELIST himl, IStream* pstm);
  25. HRESULT ReadCompatibleImageList (IStream* pstm, HIMAGELIST& himl);
  26. bool InflateFont (LOGFONT* plf, int nPointsToGrowBy);
  27. inline bool DeflateFont (LOGFONT* plf, int nPointsToShrinkBy)
  28. { return (InflateFont (plf, -nPointsToShrinkBy)); }
  29. bool GetTBBtnTextAndStatus(HINSTANCE hInst, int nID, std::wstring& szButton, std::wstring& szToolTip);
  30. #ifdef DBG
  31. void DrawOnDesktop (HBITMAP hbm, int x, int y);
  32. void DrawOnDesktop (HICON hIcon, int x, int y);
  33. void DrawOnDesktop (HIMAGELIST himl, int x, int y, int iImage = -1);
  34. #endif
  35. /*---------------------------------------------------------*\
  36. | copied from winuser.h since we currently compile
  37. | with _WIN32_WINNT == 0x0400
  38. \*---------------------------------------------------------*/
  39. #if (_WIN32_WINNT < 0x0500)
  40. #if !defined(WS_EX_LAYOUTRTL)
  41. #define WS_EX_LAYOUTRTL 0x00400000L
  42. #endif
  43. #if !defined(LAYOUT_BITMAPORIENTATIONPRESERVED)
  44. #define LAYOUT_BITMAPORIENTATIONPRESERVED 0x00000008
  45. #endif
  46. #if !defined(LAYOUT_RTL)
  47. #define LAYOUT_RTL 0x00000001 // Right to left
  48. #endif
  49. // implement locally Gdi32 functions for layout
  50. DWORD PrivateSetLayout( HDC hdc, DWORD dwLayout );
  51. inline DWORD SetLayout( HDC hdc, DWORD dwLayout )
  52. {
  53. return PrivateSetLayout( hdc, dwLayout );
  54. }
  55. // implement locally Gdi32 functions for layout
  56. DWORD PrivateGetLayout( HDC hdc );
  57. inline DWORD GetLayout( HDC hdc )
  58. {
  59. return PrivateGetLayout( hdc );
  60. }
  61. // To deactivate UI theming before calling snapins & restore original context
  62. // use below apis. (See util.cpp for more details).
  63. BOOL WINAPI MmcDownlevelActivateActCtx(HANDLE hActCtx, ULONG_PTR* pulCookie);
  64. VOID WINAPI MmcDownlevelDeactivateActCtx(DWORD dwFlags, ULONG_PTR ulCookie);
  65. #endif