掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
処理が重くなってしまったエクスプローラ表示を軽くするには? (ID:63126)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
対策としては、 案1.CabinetWClass と ExploreWClass でFindWindowする。(取れるまで無限ループ) 案2.ShellExecuteではなくShellExecuteExで起動し、WaitForInputIdleで待ってから、 CabinetWClass と ExploreWClass でFindWindowする。(1回) 参考過去ログ:http://madia.world.coocan.jp/cgi-bin/Vcbbs/wwwlng.cgi?print+200603/06030036.txt 案3.SHDocVw::ShellWindowsをつかって、ハンドルを取得する。 (一番確実に取れるが、COMなので扱いにくい上に若干遅い。) 一応案3ので試したコード #import <SHDocVw.dll> #import <Shell32.dll> ・ ・ ・ void CXXXXDlg::OnButton1() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください const LPCTSTR path = _T( "E:\\" ); // 任意のパス TCHAR cmd[ 256 ]; _stprintf( cmd, _T( "/e,/root=\"%s\"" ), path ); if ( ( int )::ShellExecute( 0, _T( "open" ), _T( "explorer" ), cmd, NULL, SW_SHOW ) >= 32 ) { CWnd* pExplorer = NULL; HRESULT hr = ::CoInitialize( NULL ); if ( FAILED( hr ) ) return; SHDocVw::IShellWindowsPtr sw = NULL; try { hr = sw.CreateInstance( __uuidof( SHDocVw::ShellWindows ) ); if ( FAILED( hr ) ) _com_issue_error( hr ); for ( long i = 0; i < sw->Count; ++i ) { if ( SHDocVw::IWebBrowser2Ptr ie = sw->Item( i ) ) { if ( Shell32::IShellFolderViewDualPtr view = ie->GetDocument() ) { Shell32::Folder2Ptr pFolder = view->Folder; Shell32::FolderItemPtr pFolderItem = pFolder->Self; _bstr_t sPath = pFolderItem->Path; if ( !_wcsicmp( sPath, ( _bstr_t )path ) ) { pExplorer = CWnd::FromHandle( ( HWND )ie->HWND ); while ( ie->Visible == VARIANT_FALSE ); // ie->ToolBar = VARIANT_FALSE; break; } } } } } catch ( _com_error& e ) { hr = e.Error(); } sw.Release(); ::CoUninitialize(); if ( FAILED( hr ) ) return; if ( pExplorer == NULL ) return; CWnd* pWork = pExplorer->GetDlgItem( 0xA005 ); if ( pWork ) { CWnd* pReBar = pWork->GetDlgItem( 0xA005 ); if ( pReBar ) { CWnd* pToolBar = pReBar->GetDlgItem( 0xA000 ); if ( pToolBar && pToolBar->IsWindowVisible() ) { pExplorer->SendMessage( WM_COMMAND, ( WPARAM )0xA204, ( LPARAM )0L ); } } } } } 行コメントになっているのが、前回のレスで行ったやつ。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.