Displaying the 'Properties' of a file or folder.
When you select a file or folder in Explorer window, and choose 'Properties' from the menu, you get the properties window that contains some essential information about the file: The size of file, created date, modified date, attributes, and so on.
It's possible to display this properties window programmatically, by using the ShellExecuteEx API function.
The function below accept 2 parameters, and displays the properties window of the file:
hwnd - The handle of the window that calls this function.
lpszFile - The file or folder that you want to display its properties.

Return back to C/C++ code index

void ShowFileProperties(HWND hwnd, LPSTR lpszFile)
{
	SHELLEXECUTEINFO ShExecInfo = {0};

	ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
	ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;
	ShExecInfo.hwnd = hwnd;
	ShExecInfo.lpVerb = "properties";
	ShExecInfo.lpFile = lpszFile;
	ShExecInfo.lpParameters = ""; 
	ShExecInfo.lpDirectory = NULL;
	ShExecInfo.nShow = SW_SHOW;
	ShExecInfo.hInstApp = NULL; 
	ShellExecuteEx(&ShExecInfo);
}