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.

574 lines
18 KiB

  1. /*****************************************************************************\
  2. FILE: EffectsAdvPg.cpp
  3. DESCRIPTION:
  4. This code will display the Effect tab in the Advanced Display Control
  5. panel.
  6. BryanSt 4/13/2000 Updated and Converted to C++
  7. Copyright (C) Microsoft Corp 2000-2000. All rights reserved.
  8. \*****************************************************************************/
  9. #include "priv.h"
  10. #include "EffectsAdvPg.h"
  11. #include "regutil.h"
  12. //#undef _SHSEMIP_H_
  13. //#include <shsemip.h>
  14. typedef struct
  15. {
  16. DWORD dwControlID;
  17. DWORD dwHelpContextID;
  18. }POPUP_HELP_ARRAY;
  19. POPUP_HELP_ARRAY phaMainDisplay[] = {
  20. { IDC_LARGEICONS, IDH_DISPLAY_EFFECTS_LARGE_ICONS_CHECKBOX },
  21. { IDC_ICONHIGHCOLOR, IDH_DISPLAY_EFFECTS_ALL_COLORS_CHECKBOX },
  22. { IDC_MENUANIMATION, IDH_DISPLAY_EFFECTS_ANIMATE_WINDOWS },
  23. { IDC_FONTSMOOTH, IDH_DISPLAY_EFFECTS_SMOOTH_FONTS_CHECKBOX },
  24. { IDC_SHOWDRAG, IDH_DISPLAY_EFFECTS_DRAG_WINDOW_CHECKBOX },
  25. { IDC_KEYBOARDINDICATORS, IDH_DISPLAY_EFFECTS_HIDE_KEYBOARD_INDICATORS },
  26. { IDC_GRPBOX_2, IDH_COMM_GROUPBOX },
  27. { IDC_COMBOEFFECT, IDH_DISPLAY_EFFECTS_ANIMATE_LISTBOX },
  28. { IDC_COMBOFSMOOTH, IDH_DISPLAY_EFFECTS_SMOOTH_FONTS_LISTBOX },
  29. { IDC_MENUSHADOWS, IDH_DISPLAY_EFFECTS_MENUSHADOWS},
  30. { 0, 0 },
  31. { 0, 0 }, // double-null terminator NECESSARY!
  32. };
  33. #define SZ_HELPFILE_DISPLAY TEXT("DISPLAY.HLP")
  34. #define SZ_HELPFILE_WINDOWS TEXT("WINDOWS.HLP")
  35. ULONG g_ulFontInformation, g_ulNewFontInformation;
  36. //===========================
  37. // *** Class Internals & Helpers ***
  38. //===========================
  39. DWORD ListIndexToFontSmoothingType(int nIndex, DWORD dwPreviousType)
  40. {
  41. // We want to keep the high bits in dwPreviousType because we are only replacing
  42. // the lower bits.
  43. return ((0xFFFFFFF0 & dwPreviousType) | (nIndex + 1));
  44. }
  45. void HideComboEffectsWindow(HWND hDlg)
  46. {
  47. TCHAR szText[MAX_PATH];
  48. // We change the text so it doesn't have a reference to the drop down.
  49. LoadString(HINST_THISDLL, IDS_COMBO_EFFECTS_NOLIST, szText, ARRAYSIZE(szText));
  50. SetWindowText(GetDlgItem(hDlg, IDC_MENUANIMATION), szText);
  51. ShowWindow(GetDlgItem(hDlg, IDC_COMBOEFFECT), SW_HIDE);
  52. }
  53. BOOL FadeEffectAvailable()
  54. {
  55. BOOL fFade = FALSE, fTestFade = FALSE;
  56. ClassicSystemParametersInfo( SPI_GETMENUFADE, 0, (PVOID)&fFade, 0 );
  57. if (fFade)
  58. return TRUE;
  59. ClassicSystemParametersInfo( SPI_SETMENUFADE, 0, (PVOID)1, 0);
  60. ClassicSystemParametersInfo( SPI_GETMENUFADE, 0, (PVOID)&fTestFade, 0 );
  61. ClassicSystemParametersInfo( SPI_SETMENUFADE, 0, IntToPtr(fFade), 0);
  62. return (fTestFade);
  63. }
  64. HRESULT CEffectsPage::_OnApply(HWND hDlg)
  65. {
  66. HRESULT hr = S_OK;
  67. // Full Color Icons
  68. if (m_pEffectsState && (m_pEffectsState->_nOldHighIconColor != m_pEffectsState->_nHighIconColor))
  69. {
  70. if ((GetBitsPerPixel() < 16) && (m_pEffectsState->_nHighIconColor == 16)) // Display mode won't support icon high colors
  71. {
  72. TCHAR szTemp1[512];
  73. TCHAR szTemp2[256];
  74. LoadString(HINST_THISDLL, IDS_256COLORPROBLEM, szTemp1, ARRAYSIZE(szTemp1));
  75. LoadString(HINST_THISDLL, IDS_ICONCOLORWONTWORK, szTemp2, ARRAYSIZE(szTemp2));
  76. StringCchCat(szTemp1, ARRAYSIZE(szTemp1), szTemp2);
  77. LoadString(HINST_THISDLL, IDS_EFFECTS, szTemp2, ARRAYSIZE(szTemp2));
  78. MessageBox(hDlg, szTemp1, szTemp2, MB_OK|MB_ICONINFORMATION);
  79. }
  80. }
  81. return hr;
  82. }
  83. HRESULT CEffectsPage::_OnInit(HWND hDlg)
  84. {
  85. HRESULT hr = S_OK;
  86. TCHAR szRes[100];
  87. if (!m_pEffectsState)
  88. {
  89. return E_INVALIDARG;
  90. }
  91. //////////////////////////////////////////////////////////////////////////
  92. // Load the state from persisted form (registry) to the state struct
  93. //////////////////////////////////////////////////////////////////////////
  94. g_bMirroredOS = IS_MIRRORING_ENABLED();
  95. //////////////////////////////////////////////////////////////////////////
  96. // Update UI based on the state struct
  97. //////////////////////////////////////////////////////////////////////////
  98. if (m_pEffectsState->_nLargeIcon == ICON_INDETERMINATE)
  99. {
  100. HWND hItem = GetDlgItem(hDlg, IDC_LARGEICONS);
  101. SendMessage(hItem, BM_SETSTYLE, (WPARAM)LOWORD(BS_AUTO3STATE), MAKELPARAM(FALSE,0));
  102. }
  103. // Set CheckBoxes
  104. SendMessage((HWND)GetDlgItem(hDlg, IDC_LARGEICONS), BM_SETCHECK, (WPARAM)m_pEffectsState->_nLargeIcon, 0);
  105. SendMessage((HWND)GetDlgItem(hDlg, IDC_MENUSHADOWS), BM_SETCHECK, (WPARAM)m_pEffectsState->_fMenuShadows, 0);
  106. SendMessage((HWND)GetDlgItem(hDlg, IDC_ICONHIGHCOLOR ), BM_SETCHECK, (WPARAM)(BOOL)(m_pEffectsState->_nHighIconColor == 16), 0);
  107. SendMessage((HWND)GetDlgItem(hDlg, IDC_MENUANIMATION), BM_SETCHECK, (WPARAM)m_pEffectsState->_wpMenuAnimation, 0);
  108. SendMessage((HWND)GetDlgItem(hDlg, IDC_FONTSMOOTH), BM_SETCHECK, (WPARAM)m_pEffectsState->_fFontSmoothing, 0);
  109. SendMessage((HWND)GetDlgItem(hDlg, IDC_SHOWDRAG), BM_SETCHECK, (WPARAM)m_pEffectsState->_fDragWindow, 0);
  110. SendMessage((HWND)GetDlgItem(hDlg, IDC_KEYBOARDINDICATORS), BM_SETCHECK, (WPARAM)(m_pEffectsState->_fKeyboardIndicators ? BST_UNCHECKED : BST_CHECKED), 0);
  111. // Set Effects Drop Down
  112. HWND hwndCombo = GetDlgItem(hDlg,IDC_COMBOEFFECT);
  113. ComboBox_ResetContent(hwndCombo);
  114. LoadString(HINST_THISDLL, IDS_FADEEFFECT, szRes, ARRAYSIZE(szRes) );
  115. ComboBox_AddString(hwndCombo, szRes);
  116. LoadString(HINST_THISDLL, IDS_SCROLLEFFECT, szRes, ARRAYSIZE(szRes) );
  117. ComboBox_AddString(hwndCombo, szRes);
  118. ComboBox_SetCurSel(hwndCombo, (MENU_EFFECT_FADE == m_pEffectsState->_dwAnimationEffect) ? 0 : 1);
  119. EnableWindow(hwndCombo, (UINT)m_pEffectsState->_wpMenuAnimation);
  120. if (IsTSPerfFlagEnabled(TSPerFlag_NoAnimation))
  121. {
  122. EnableWindow(GetDlgItem(hDlg, IDC_MENUANIMATION), FALSE);
  123. EnableWindow(GetDlgItem(hDlg, IDC_COMBOEFFECT), FALSE);
  124. LogStatus("Animation Forced off because of TS Perf Flags\r\n");
  125. }
  126. if (IsTSPerfFlagEnabled(TSPerFlag_NoWindowDrag))
  127. {
  128. EnableWindow(GetDlgItem(hDlg, IDC_SHOWDRAG), FALSE);
  129. LogStatus("FullWindowDrag feature Forced off because of TS Perf Flags\r\n");
  130. }
  131. if (!FadeEffectAvailable())
  132. {
  133. HideComboEffectsWindow(hDlg);
  134. }
  135. if (0 != SHGetRestriction(NULL,POLICY_KEY_EXPLORER,POLICY_VALUE_ANIMATION))
  136. {
  137. //disable
  138. //0= enable
  139. //non-0= disable
  140. //relies on the fact that if the key does not exist it returns 0 as well
  141. EnableWindow((HWND)GetDlgItem(hDlg, IDC_MENUANIMATION), FALSE);
  142. EnableWindow((HWND)GetDlgItem(hDlg, IDC_COMBOEFFECT), FALSE);
  143. }
  144. hwndCombo = GetDlgItem(hDlg,IDC_COMBOFSMOOTH);
  145. ComboBox_ResetContent(hwndCombo);
  146. LoadString(HINST_THISDLL, IDS_STANDARDSMOOTHING, szRes, ARRAYSIZE(szRes));
  147. ComboBox_AddString(hwndCombo, szRes);
  148. LoadString(HINST_THISDLL, IDS_CLEARTYPE, szRes, ARRAYSIZE(szRes));
  149. ComboBox_AddString(hwndCombo, szRes);
  150. BOOL fTemp;
  151. ComboBox_SetCurSel(hwndCombo, m_pEffectsState->_dwFontSmoothingType-1);
  152. if (ClassicSystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, (PVOID)&fTemp, 0))
  153. {
  154. EnableWindow((HWND)hwndCombo, m_pEffectsState->_fFontSmoothing);
  155. }
  156. else
  157. {
  158. ShowWindow(hwndCombo, SW_HIDE);
  159. ShowWindow(GetDlgItem(hDlg, IDC_SHOWME), SW_HIDE);
  160. }
  161. if (0 != SHGetRestriction(NULL, POLICY_KEY_EXPLORER, POLICY_VALUE_KEYBOARDNAV))
  162. {
  163. //disable, see comment for animation
  164. EnableWindow((HWND)GetDlgItem(hDlg, IDC_KEYBOARDINDICATORS), FALSE);
  165. }
  166. //disable and uncheck things if we are on terminal server
  167. BOOL bEffectsEnabled;
  168. if (!ClassicSystemParametersInfo(SPI_GETUIEFFECTS, 0, (PVOID) &bEffectsEnabled, 0))
  169. {
  170. // This flag is only available on Win2k and later. We're depending
  171. // on the call returning false if the flag doesn't exist...
  172. bEffectsEnabled = TRUE;
  173. }
  174. if (!bEffectsEnabled)
  175. {
  176. EnableWindow((HWND)GetDlgItem( hDlg, IDC_MENUANIMATION), FALSE);
  177. EnableWindow((HWND)GetDlgItem(hDlg, IDC_ICONHIGHCOLOR), FALSE);
  178. EnableWindow((HWND)GetDlgItem(hDlg, IDC_KEYBOARDINDICATORS), FALSE);
  179. EnableWindow((HWND)GetDlgItem(hDlg, IDC_FONTSMOOTH), FALSE);
  180. EnableWindow((HWND)GetDlgItem(hDlg, IDC_COMBOFSMOOTH), FALSE);
  181. HideComboEffectsWindow(hDlg);
  182. SendDlgItemMessage(hDlg, IDC_MENUANIMATION, BM_SETCHECK, 0, 0);
  183. SendDlgItemMessage(hDlg, IDC_ICONHIGHCOLOR, BM_SETCHECK, 0, 0);
  184. SendDlgItemMessage(hDlg, IDC_KEYBOARDINDICATORS, BM_SETCHECK, 0, 0);
  185. SendDlgItemMessage(hDlg, IDC_FONTSMOOTH, BM_SETCHECK, 0, 0);
  186. }
  187. return hr;
  188. }
  189. INT_PTR CEffectsPage::_OnCommand(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  190. {
  191. BOOL fHandled = 1; // Not handled (WM_COMMAND seems to be different)
  192. WORD idCtrl = GET_WM_COMMAND_ID(wParam, lParam);
  193. WORD wEvent = GET_WM_COMMAND_CMD(wParam, lParam);
  194. switch (idCtrl)
  195. {
  196. case IDOK:
  197. EndDialog(hDlg, IDOK);
  198. break;
  199. case IDCANCEL:
  200. EndDialog(hDlg, IDCANCEL);
  201. break;
  202. case IDC_LARGEICONS:
  203. if (m_pEffectsState)
  204. {
  205. m_pEffectsState->_nLargeIcon = (int)SendMessage ( (HWND)lParam, BM_GETCHECK, 0, 0 );
  206. }
  207. break;
  208. case IDC_MENUSHADOWS:
  209. if (m_pEffectsState)
  210. {
  211. m_pEffectsState->_fMenuShadows = (int)SendMessage ( (HWND)lParam, BM_GETCHECK, 0, 0 );
  212. }
  213. break;
  214. case IDC_ICONHIGHCOLOR:
  215. if (m_pEffectsState)
  216. {
  217. m_pEffectsState->_nHighIconColor = 4;
  218. if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == TRUE)
  219. {
  220. m_pEffectsState->_nHighIconColor = 16;
  221. }
  222. }
  223. break;
  224. case IDC_SHOWDRAG:
  225. if (m_pEffectsState)
  226. {
  227. m_pEffectsState->_fDragWindow = (SendMessage( (HWND)lParam, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
  228. }
  229. break;
  230. case IDC_MENUANIMATION:
  231. if (m_pEffectsState)
  232. {
  233. switch (m_pEffectsState->_wpMenuAnimation)
  234. {
  235. case BST_UNCHECKED:
  236. m_pEffectsState->_wpMenuAnimation = BST_CHECKED;
  237. break;
  238. case BST_CHECKED:
  239. case BST_INDETERMINATE:
  240. m_pEffectsState->_wpMenuAnimation = BST_UNCHECKED;
  241. break;
  242. }
  243. SendMessage( (HWND)lParam, BM_SETCHECK, (WPARAM)m_pEffectsState->_wpMenuAnimation, 0 );
  244. EnableWindow((HWND)GetDlgItem( hDlg, IDC_COMBOEFFECT), (BST_CHECKED == m_pEffectsState->_wpMenuAnimation));
  245. }
  246. break;
  247. case IDC_COMBOEFFECT:
  248. if ((wEvent == CBN_SELCHANGE) && m_pEffectsState)
  249. {
  250. m_pEffectsState->_dwAnimationEffect = (DWORD)ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_COMBOEFFECT)) + 1;
  251. }
  252. break;
  253. case IDC_COMBOFSMOOTH:
  254. if ((wEvent == CBN_SELCHANGE) && m_pEffectsState)
  255. {
  256. m_pEffectsState->_dwFontSmoothingType = ListIndexToFontSmoothingType(ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_COMBOFSMOOTH)), m_pEffectsState->_dwFontSmoothingType);
  257. }
  258. break;
  259. case IDC_FONTSMOOTH:
  260. if (m_pEffectsState)
  261. {
  262. m_pEffectsState->_fFontSmoothing = (SendMessage( (HWND)lParam, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
  263. EnableWindow((HWND)GetDlgItem( hDlg, IDC_COMBOFSMOOTH), m_pEffectsState->_fFontSmoothing);
  264. if (m_pEffectsState->_fFontSmoothing)
  265. {
  266. m_pEffectsState->_dwFontSmoothingType = ListIndexToFontSmoothingType(ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_COMBOFSMOOTH)), m_pEffectsState->_dwFontSmoothingType);
  267. }
  268. }
  269. break;
  270. case IDC_KEYBOARDINDICATORS:
  271. if (m_pEffectsState)
  272. {
  273. m_pEffectsState->_fKeyboardIndicators = ((SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED) ? FALSE : TRUE);
  274. }
  275. break;
  276. default:
  277. break;
  278. }
  279. return fHandled;
  280. }
  281. INT_PTR CALLBACK PropertySheetDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
  282. {
  283. CEffectsPage * pThis = (CEffectsPage *)GetWindowLongPtr(hDlg, DWLP_USER);
  284. if (WM_INITDIALOG == wMsg)
  285. {
  286. pThis = (CEffectsPage *) lParam;
  287. if (pThis)
  288. {
  289. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  290. }
  291. }
  292. if (pThis)
  293. return pThis->_PropertySheetDlgProc(hDlg, wMsg, wParam, lParam);
  294. return DefWindowProc(hDlg, wMsg, wParam, lParam);
  295. }
  296. //---------------------------------------------------------------------------
  297. //
  298. // PropertySheetDlgProc()
  299. //
  300. // The dialog procedure for the "PlusPack" property sheet page.
  301. //
  302. //---------------------------------------------------------------------------
  303. INT_PTR CEffectsPage::_PropertySheetDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
  304. {
  305. switch( uMessage )
  306. {
  307. case WM_INITDIALOG:
  308. _OnInit(hDlg);
  309. break;
  310. case WM_COMMAND:
  311. _OnCommand(hDlg, uMessage, wParam, lParam);
  312. break;
  313. case WM_HELP:
  314. {
  315. LPHELPINFO lphi = (LPHELPINFO)lParam;
  316. if( lphi->iContextType == HELPINFO_WINDOW )
  317. {
  318. LPCWSTR pszHelpFile = ((lphi->hItemHandle == GetDlgItem(hDlg, IDC_GRPBOX_2)) ? SZ_HELPFILE_WINDOWS : SZ_HELPFILE_DISPLAY);
  319. WinHelp( (HWND)lphi->hItemHandle, pszHelpFile, HELP_WM_HELP, (DWORD_PTR)phaMainDisplay);
  320. }
  321. }
  322. break;
  323. case WM_CONTEXTMENU:
  324. // first check for dlg window
  325. if( (HWND)wParam == hDlg )
  326. {
  327. // let the def dlg proc decide whether to respond or ignore;
  328. // necessary for title bar sys menu on right click
  329. return FALSE; // didn't process message EXIT
  330. }
  331. else
  332. {
  333. // else go for the controls
  334. LPCWSTR pszHelpFile = (((HWND)wParam == GetDlgItem(hDlg, IDC_GRPBOX_2)) ? SZ_HELPFILE_WINDOWS : SZ_HELPFILE_DISPLAY);
  335. WinHelp( (HWND)wParam, pszHelpFile, HELP_CONTEXTMENU, (DWORD_PTR)phaMainDisplay);
  336. }
  337. break;
  338. default:
  339. return FALSE;
  340. }
  341. return(TRUE);
  342. }
  343. HRESULT CEffectsPage::_IsDirty(IN BOOL * pIsDirty)
  344. {
  345. HRESULT hr = E_INVALIDARG;
  346. if (pIsDirty && m_pEffectsState)
  347. {
  348. // Ask state if it's dirty
  349. *pIsDirty = m_pEffectsState->IsDirty();
  350. hr = S_OK;
  351. }
  352. return hr;
  353. }
  354. //===========================
  355. // *** IAdvancedDialog Interface ***
  356. //===========================
  357. HRESULT CEffectsPage::DisplayAdvancedDialog(IN HWND hwndParent, IN IPropertyBag * pBasePage, IN BOOL * pfEnableApply)
  358. {
  359. HRESULT hr = E_INVALIDARG;
  360. if (hwndParent && pBasePage && pfEnableApply)
  361. {
  362. // Load State Into Advanced Dialog
  363. if (m_pEffectsState)
  364. {
  365. m_pEffectsState->Release();
  366. m_pEffectsState = NULL;
  367. }
  368. *pfEnableApply = FALSE;
  369. CEffectState * pEffectClone = NULL;
  370. hr = SHPropertyBag_ReadByRef(pBasePage, SZ_PBPROP_EFFECTSSTATE, (void *)&pEffectClone, sizeof(pEffectClone));
  371. if (SUCCEEDED(hr) && pEffectClone)
  372. {
  373. // We want a copy of their state
  374. hr = pEffectClone->Clone(&m_pEffectsState);
  375. if (SUCCEEDED(hr))
  376. {
  377. LinkWindow_RegisterClass();
  378. // Display Advanced Dialog
  379. if ((IDOK == DialogBoxParam(HINST_THISDLL, MAKEINTRESOURCE(DLG_EFFECTS), hwndParent, PropertySheetDlgProc, (LPARAM)this)) && m_pEffectsState)
  380. {
  381. // The user clicked OK, so merge modified state back into base dialog
  382. _IsDirty(pfEnableApply);
  383. // The user clicked Okay in the dialog so merge the dirty state from the
  384. // advanced dialog into the base dialog.
  385. hr = SHPropertyBag_WriteByRef(pBasePage, SZ_PBPROP_EFFECTSSTATE, (void *)m_pEffectsState);
  386. m_pEffectsState->Release();
  387. m_pEffectsState = NULL;
  388. }
  389. }
  390. LinkWindow_UnregisterClass(HINST_THISDLL);
  391. pEffectClone->Release();
  392. }
  393. }
  394. return hr;
  395. }
  396. //===========================
  397. // *** IUnknown Interface ***
  398. //===========================
  399. ULONG CEffectsPage::AddRef()
  400. {
  401. return InterlockedIncrement(&m_cRef);
  402. }
  403. ULONG CEffectsPage::Release()
  404. {
  405. ASSERT( 0 != m_cRef );
  406. ULONG cRef = InterlockedDecrement(&m_cRef);
  407. if ( 0 == cRef )
  408. {
  409. delete this;
  410. }
  411. return cRef;
  412. }
  413. HRESULT CEffectsPage::QueryInterface(REFIID riid, void **ppvObj)
  414. {
  415. static const QITAB qit[] =
  416. {
  417. QITABENT(CEffectsPage, IObjectWithSite),
  418. QITABENT(CEffectsPage, IAdvancedDialog),
  419. { 0 },
  420. };
  421. return QISearch(this, qit, riid, ppvObj);
  422. }
  423. //===========================
  424. // *** Class Methods ***
  425. //===========================
  426. CEffectsPage::CEffectsPage() : m_cRef(1)
  427. {
  428. // This needs to be allocated in Zero Inited Memory.
  429. // Assert that all Member Variables are inited to Zero.
  430. m_fDirty = FALSE;
  431. }
  432. CEffectsPage::~CEffectsPage()
  433. {
  434. if (m_pEffectsState)
  435. {
  436. m_pEffectsState->Release();
  437. }
  438. }
  439. HRESULT CEffectsPage_CreateInstance(OUT IAdvancedDialog ** ppAdvDialog)
  440. {
  441. HRESULT hr = E_INVALIDARG;
  442. if (ppAdvDialog)
  443. {
  444. CEffectsPage * pThis = new CEffectsPage();
  445. if (pThis)
  446. {
  447. hr = pThis->QueryInterface(IID_PPV_ARG(IAdvancedDialog, ppAdvDialog));
  448. pThis->Release();
  449. }
  450. else
  451. {
  452. *ppAdvDialog = NULL;
  453. hr = E_OUTOFMEMORY;
  454. }
  455. }
  456. return hr;
  457. }