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.

183 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: layoutui.hxx
  7. //
  8. // Contents: Common header file Layout Tool UI
  9. //
  10. // Classes: CLayoutApp
  11. // COleClientSite
  12. //
  13. // History: 23-Mar-96 SusiA Created
  14. //
  15. //----------------------------------------------------------------------------
  16. #ifndef __LAYOUTUI_HXX__
  17. #define __LAYOUTUI_HXX__
  18. #include <windows.h>
  19. #include <shellapi.h>
  20. #include <commdlg.h>
  21. #include <cderr.h>
  22. #include <winuser.h>
  23. #include "resource.h"
  24. #ifndef STG_E_NONEOPTIMIZED
  25. #define STG_E_NONEOPTIMIZED _HRESULT_TYPEDEF_(0x80030205L)
  26. #endif
  27. #define gdxWndMin 300;
  28. #define gdyWndMin 300;
  29. #define hwndNil NULL;
  30. #define hNil NULL;
  31. #define bMsgHandled 1
  32. #define bMsgNotHandled 0
  33. int Laylstrcmp (
  34. const wchar_t * src,
  35. const wchar_t * dst);
  36. wchar_t * Laylstrcat (
  37. wchar_t * dst,
  38. const wchar_t * src );
  39. wchar_t * Laylstrcpy(
  40. wchar_t * dst,
  41. const wchar_t * src );
  42. wchar_t * Laylstrcpyn (
  43. wchar_t * dest,
  44. const wchar_t * source,
  45. size_t count);
  46. size_t Laylstrlen (
  47. const wchar_t * wcs);
  48. class CLayoutApp
  49. {
  50. public:
  51. CLayoutApp(HINSTANCE hInst);
  52. BOOL InitApp(void);
  53. INT DoAppMessageLoop(void);
  54. private:
  55. HINSTANCE m_hInst;
  56. HWND m_hwndMain;
  57. HWND m_hwndBtnAdd;
  58. HWND m_hwndBtnRemove;
  59. HWND m_hwndBtnOptimize;
  60. HWND m_hwndListFiles;
  61. HWND m_hwndStaticFiles;
  62. BOOL m_bOptimizing;
  63. BOOL m_bCancelled;
  64. static BOOL CALLBACK LayoutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  65. static LONG CALLBACK ListBoxWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  66. static LONG CALLBACK ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  67. static DWORD OptimizeFiles (void *args);
  68. BOOL InitWindow (void);
  69. VOID ReSizeWindow( LPARAM lParam );
  70. VOID AddFiles( void );
  71. VOID RemoveFiles( void );
  72. VOID EnableButtons( BOOL bShowOptimizeBtn = TRUE );
  73. VOID FormFilterString( TCHAR *patcFilter, INT nMaxLen );
  74. VOID WriteFilesToList( TCHAR *patc );
  75. VOID AddFileToListBox( TCHAR *patcFile );
  76. VOID RemoveFileFromListBox( INT nIndex );
  77. VOID SetListBoxExtent( void );
  78. VOID HandleOptimizeReturnCode( SCODE sc );
  79. VOID SetActionButton( UINT uID );
  80. INT DisplayMessage( HWND hWnd,
  81. UINT uMessageID,
  82. UINT uTitleID,
  83. UINT uFlags );
  84. INT DisplayMessageWithFileName(HWND hWnd,
  85. UINT uMessageIDBefore,
  86. UINT uMessageIDAfter,
  87. UINT uTitleID,
  88. UINT uFlags,
  89. TCHAR *patcFileName);
  90. INT CLayoutApp::DisplayMessageWithTwoFileNames(HWND hWnd,
  91. UINT uMessageID,
  92. UINT uTitleID,
  93. UINT uFlags,
  94. TCHAR *patcFirstFileName,
  95. TCHAR *patcLastFileName);
  96. SCODE OptimizeFilesWorker( void );
  97. SCODE DoOptimizeFile( TCHAR *patcFileName, TCHAR *patcTempFile );
  98. OLECHAR *TCharToOleChar(TCHAR *atcSrc, OLECHAR *awcDst, INT nDstLen);
  99. #if DBG==1
  100. BOOL CLayoutApp::IdenticalFiles( TCHAR *patcFileOne,
  101. TCHAR *patcFileTwo);
  102. #endif
  103. };
  104. class COleClientSite : public IOleClientSite
  105. {
  106. public:
  107. TCHAR *m_patcFile;
  108. inline COleClientSite(void);
  109. // IUnknown
  110. STDMETHOD(QueryInterface)(REFIID riid, void** ppObject);
  111. STDMETHOD_(ULONG, AddRef)(void);
  112. STDMETHOD_(ULONG, Release)(void);
  113. //IOleClientSite
  114. STDMETHOD (SaveObject)( void);
  115. STDMETHOD (GetMoniker)(
  116. /* [in] */ DWORD dwAssign,
  117. /* [in] */ DWORD dwWhichMoniker,
  118. /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk);
  119. STDMETHOD (GetContainer)(
  120. /* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer);
  121. STDMETHOD (ShowObject)( void);
  122. STDMETHOD (OnShowWindow)(
  123. /* [in] */ BOOL fShow);
  124. STDMETHOD (RequestNewObjectLayout)( void);
  125. private:
  126. LONG _cReferences;
  127. };
  128. inline COleClientSite::COleClientSite(void)
  129. {
  130. _cReferences = 1;
  131. }
  132. #endif // __LAYOUTUI_HXX__