Thursday, February 12, 2009

[VC++] Programmatically displaying properties dialog

Here is how to display the properties dialog programmatically.
SHELLEXECUTEINFO shExecuteInfo = { 0 } ;
shExecuteInfo.cbSize = sizeof ( shExecuteInfo ) ;
shExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST ;
shExecuteInfo.lpVerb = "properties" ;
shExecuteInfo.lpFile = "C:\\WINDOWS\\system32\\notepad.exe" ;
ShellExecuteEx ( &shExecuteInfo ) ;
Above code when executed will display the properties dialog box of notepad(as shown below). Similarly we can display any folder or file properties by giving its path name to SHELLEXECUTEINFO::lpFile.

No comments: