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.

192 lines
3.8 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: selprog.hxx
  7. //
  8. // Contents: Task wizard program selection property page.
  9. //
  10. // Classes: CSelectProgramPage
  11. //
  12. // History: 4-28-1997 DavidMun Created
  13. //
  14. //---------------------------------------------------------------------------
  15. #ifndef __SELPROG_HXX_
  16. #define __SELPROG_HXX_
  17. //+--------------------------------------------------------------------------
  18. //
  19. // Class: CSelectProgramPage
  20. //
  21. // Purpose: Implement the task wizard program selection dialog
  22. //
  23. // History: 4-28-1997 DavidMun Created
  24. //
  25. //---------------------------------------------------------------------------
  26. class CSelectProgramPage: public CWizPage
  27. {
  28. public:
  29. CSelectProgramPage::CSelectProgramPage(
  30. CTaskWizard *pParent,
  31. LPTSTR ptszFolderPath,
  32. HPROPSHEETPAGE *phPSP);
  33. CSelectProgramPage::~CSelectProgramPage();
  34. //
  35. // CPropPage overrides
  36. //
  37. virtual LRESULT
  38. _OnCommand(
  39. int id,
  40. HWND hwndCtl,
  41. UINT codeNotify);
  42. virtual LRESULT
  43. _OnDestroy();
  44. virtual BOOL
  45. _ProcessListViewNotifications(
  46. UINT uMsg,
  47. WPARAM wParam,
  48. LPARAM lParam);
  49. //
  50. // CWizPage overrides
  51. //
  52. virtual LRESULT
  53. _OnInitDialog(
  54. LPARAM lParam);
  55. virtual LRESULT
  56. _OnPSNSetActive(
  57. LPARAM lParam);
  58. //
  59. // New member functions
  60. //
  61. VOID
  62. GetDefaultDisplayName(
  63. LPTSTR tszDisplayName,
  64. ULONG cchDisplayName);
  65. HICON
  66. GetSelectedAppIcon();
  67. VOID
  68. GetExeName(
  69. LPTSTR tszBuf,
  70. ULONG cchBuf);
  71. VOID
  72. GetExeFullPath(
  73. LPTSTR tszBuf,
  74. ULONG cchBuf);
  75. VOID
  76. GetExeDir(
  77. LPTSTR tszBuf,
  78. ULONG cchBuf);
  79. LPCTSTR
  80. GetArgs();
  81. private:
  82. HRESULT
  83. _InitListView();
  84. HRESULT
  85. _PopulateListView();
  86. HRESULT
  87. _AddAppToListView(
  88. LV_ITEM *plvi,
  89. HIMAGELIST hSmallImageList,
  90. LPLINKINFO pLinkInfo);
  91. BOOL
  92. _AppAlreadyInListView(
  93. LPLINKINFO pLinkInfo);
  94. VOID
  95. _OnBrowse();
  96. HWND _hwndLV;
  97. LINKINFO *_pSelectedLinkInfo;
  98. INT _idxSelectedIcon;
  99. BOOL _fUseBrowseSelection;
  100. TCHAR _tszExePath[MAX_PATH + 1];
  101. TCHAR _tszExeName[MAX_PATH + 1];
  102. };
  103. //+--------------------------------------------------------------------------
  104. //
  105. // Member: CSelectProgramPage::GetExeDir
  106. //
  107. // Synopsis: Return path to directory in which exe resides
  108. //
  109. // History: 5-06-1997 DavidMun Created
  110. //
  111. //---------------------------------------------------------------------------
  112. inline VOID
  113. CSelectProgramPage::GetExeDir(
  114. LPTSTR tszBuf,
  115. ULONG cchBuf)
  116. {
  117. if (_fUseBrowseSelection)
  118. {
  119. lstrcpyn(tszBuf, _tszExePath, cchBuf);
  120. }
  121. else
  122. {
  123. lstrcpyn(tszBuf, _pSelectedLinkInfo->szExePath, cchBuf);
  124. }
  125. if (lstrlen(tszBuf) == 2 && cchBuf > 3)
  126. {
  127. // lstrcat(tszBuf, TEXT("\\"));
  128. StringCchCat(tszBuf, cchBuf, TEXT("\\"));
  129. }
  130. }
  131. //+--------------------------------------------------------------------------
  132. //
  133. // Member: CSelectProgramPage::GetArgs
  134. //
  135. // Synopsis: Return exe's arguments, or empty string if there are none
  136. //
  137. // History: 5-08-1997 DavidMun Created
  138. //
  139. //---------------------------------------------------------------------------
  140. inline LPCTSTR
  141. CSelectProgramPage::GetArgs()
  142. {
  143. if (_fUseBrowseSelection)
  144. {
  145. return TEXT("");
  146. }
  147. return _pSelectedLinkInfo->tszArguments;
  148. }
  149. #endif // __SELPROG_HXX_