掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ShellExecuteで開くマイコンピュータのサイズと位置を指定する (ID:61023)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
> FindWindowExで引数に"ExploreWClass"を置くと、開かなくなります。 というか、FindWindowExを使う意味がなくなったので、 (以前は同じウィンドウタイトルのウィンドウを2つ取得するので必要であった) FindWindow("ExploreWClass","Folder1") としてもだめでしょうか? ダメならば、VCに付属しているSpy++で、エクスプローラのウィンドウクラスを調べてみてください。 > ShellExecuteEx + WaitForInputIdle に変更ですかね。 の例 #include <shlwapi.h> #pragma comment( lib, "shlwapi.lib" ) ・ ・ ・ void CExplorerTestDlg::OnButton1() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください const LPCTSTR dir = TEXT( "C:\\" ); const LPCTSTR subdir1 = TEXT( "フォルダ1" ); const LPCTSTR subdir2 = TEXT( "フォルダ2" ); const int screenX = ::GetSystemMetrics( SM_CXSCREEN ); const int screenY = ::GetSystemMetrics( SM_CYSCREEN ); TCHAR path[ MAX_PATH ]; CWnd *pWnd1, *pWnd2; ::PathCombine( path, dir, subdir1 ); SHELLEXECUTEINFO sei1 = { 0 }; sei1.cbSize = sizeof( sei1 ); sei1.nShow = SW_HIDE; sei1.fMask = SEE_MASK_NOCLOSEPROCESS; sei1.lpVerb = TEXT( "explore" ); sei1.lpFile = path; if ( ::ShellExecuteEx( &sei1 ) ) { ::WaitForInputIdle( sei1.hProcess, INFINITE ); pWnd1 = this->FindWindow( TEXT( "ExploreWClass" ), subdir1 ); } ::PathCombine( path, dir, subdir2 ); SHELLEXECUTEINFO sei2 = { 0 }; sei2.cbSize = sizeof( sei2 ); sei2.nShow = SW_HIDE; sei2.fMask = SEE_MASK_NOCLOSEPROCESS; sei2.lpVerb = TEXT( "explore" ); sei2.lpFile = path; if ( ::ShellExecuteEx( &sei2 ) ) { ::WaitForInputIdle( sei2.hProcess, INFINITE ); pWnd2 = this->FindWindow( TEXT( "ExploreWClass" ), subdir2 ); } if ( pWnd1 ) { pWnd1->MoveWindow( 0, 0, screenX / 2, screenY ); pWnd1->ShowWindow( SW_SHOW ); pWnd1->SetForegroundWindow(); } if ( pWnd2 ) { pWnd2->MoveWindow( screenX / 2, 0, screenX / 2, screenY ); pWnd2->ShowWindow( SW_SHOW ); pWnd2->SetForegroundWindow(); } }
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.