ホーム » VC » ShellExecute.. properties

2025年6月
1234567
891011121314
15161718192021
22232425262728
2930  

カテゴリー

アーカイブ

ブログ統計情報

  • 117,558 アクセス


ShellExecute.. properties

ファイルやフォルダの「プロパティ」ダイアログを表示したくなった.
以前調べた時,ShellExecute の lpOperation で指定すれば良いと思っていた.
Copilot に聞いてみると,次の様なコードが表示された.

{
	LPCTSTR   filePath  = _T("E:/_backup_") ;
	HINSTANCE hInstance = ::ShellExecute(NULL,_T("properties"),filePath,NULL,NULL,SW_SHOWNORMAL) ;
	if (UINT64(hInstance) < 32)	{
		DWORD	error = ::GetLastError() ;
		tstring	str   = ::Error_FormatMessage(error) ;
		std::tout << str << std::endl ;
		}
	}
{
	SHELLEXECUTEINFO sei = {0};
	sei.cbSize = sizeof(SHELLEXECUTEINFO) ;
	sei.lpVerb = _T("properties") ;
	sei.lpFile = _T("E:/_backup_") ;
	sei.nShow  = SW_SHOWNORMAL ;
	sei.fMask  = SEE_MASK_INVOKEIDLIST ;
	if (!::ShellExecuteEx(&sei)) {
		DWORD	error = ::GetLastError() ;
		tstring	str   = ::Error_FormatMessage(error) ;
		std::tout << str << std::endl ;
		}
	}

::ShellExecuteEx は表示できるが,::ShellExecute はエラーになる.
改めてドキュメントを見ると ::ShellExecute には “properties” がない.
::ShellExecuteEx   properties



C++&Win API 設定(Windows設定アプリ)を表示する
ファイルプロパティの表示
ShellExecute()とデフォルトブラウザの起動、拡張子の関連付け

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.
%d人のブロガーが「いいね」をつけました。