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.

162 lines
4.2 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. class CLayoutApp
  34. {
  35. public:
  36. CLayoutApp(HINSTANCE hInst);
  37. BOOL InitApp(void);
  38. INT DoAppMessageLoop(void);
  39. private:
  40. HINSTANCE m_hInst;
  41. HWND m_hwndMain;
  42. HWND m_hwndBtnAdd;
  43. HWND m_hwndBtnRemove;
  44. HWND m_hwndBtnOptimize;
  45. HWND m_hwndListFiles;
  46. HWND m_hwndStaticFiles;
  47. BOOL m_bOptimizing;
  48. BOOL m_bCancelled;
  49. static INT_PTR CALLBACK LayoutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  50. static LONG CALLBACK ListBoxWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  51. static LONG CALLBACK ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  52. static DWORD OptimizeFiles (void *args);
  53. BOOL InitWindow (void);
  54. VOID ReSizeWindow( LPARAM lParam );
  55. VOID AddFiles( void );
  56. VOID RemoveFiles( void );
  57. VOID EnableButtons( BOOL bShowOptimizeBtn = TRUE );
  58. VOID FormFilterString( TCHAR *patcFilter, INT nMaxLen );
  59. VOID WriteFilesToList( TCHAR *patc );
  60. VOID AddFileToListBox( TCHAR *patcFile );
  61. VOID RemoveFileFromListBox( INT nIndex );
  62. VOID SetListBoxExtent( void );
  63. VOID HandleOptimizeReturnCode( SCODE sc );
  64. VOID SetActionButton( UINT uID );
  65. INT DisplayMessage( HWND hWnd,
  66. UINT uMessageID,
  67. UINT uTitleID,
  68. UINT uFlags );
  69. INT DisplayMessageWithFileName(HWND hWnd,
  70. UINT uMessageIDBefore,
  71. UINT uMessageIDAfter,
  72. UINT uTitleID,
  73. UINT uFlags,
  74. TCHAR *patcFileName);
  75. INT CLayoutApp::DisplayMessageWithTwoFileNames(HWND hWnd,
  76. UINT uMessageID,
  77. UINT uTitleID,
  78. UINT uFlags,
  79. TCHAR *patcFirstFileName,
  80. TCHAR *patcLastFileName);
  81. SCODE OptimizeFilesWorker( void );
  82. SCODE DoOptimizeFile( TCHAR *patcFileName, TCHAR *patcTempFile );
  83. OLECHAR *TCharToOleChar(TCHAR *atcSrc, OLECHAR *awcDst, INT nDstLen);
  84. #if DBG==1
  85. BOOL CLayoutApp::IdenticalFiles( TCHAR *patcFileOne,
  86. TCHAR *patcFileTwo);
  87. #endif
  88. };
  89. class COleClientSite : public IOleClientSite
  90. {
  91. public:
  92. TCHAR *m_patcFile;
  93. inline COleClientSite(void);
  94. // IUnknown
  95. STDMETHOD(QueryInterface)(REFIID riid, void** ppObject);
  96. STDMETHOD_(ULONG, AddRef)(void);
  97. STDMETHOD_(ULONG, Release)(void);
  98. //IOleClientSite
  99. STDMETHOD (SaveObject)( void);
  100. STDMETHOD (GetMoniker)(
  101. /* [in] */ DWORD dwAssign,
  102. /* [in] */ DWORD dwWhichMoniker,
  103. /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk);
  104. STDMETHOD (GetContainer)(
  105. /* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer);
  106. STDMETHOD (ShowObject)( void);
  107. STDMETHOD (OnShowWindow)(
  108. /* [in] */ BOOL fShow);
  109. STDMETHOD (RequestNewObjectLayout)( void);
  110. private:
  111. LONG _cReferences;
  112. };
  113. inline COleClientSite::COleClientSite(void)
  114. {
  115. _cReferences = 1;
  116. }
  117. #endif // __LAYOUTUI_HXX__