首页 > 编程语言 > 详细

VC++显示文件或文件夹属性

时间:2017-11-02 18:50:52      阅读:339      评论:0      收藏:0      [点我收藏+]

 

  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. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
void ShowFileProperties(HWND hwnd, LPCWSTR lpszFile)
{
    SHELLEXECUTEINFO ShExecInfo = {
0};

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

技术分享技术分享

 

VC++显示文件或文件夹属性

原文:http://www.cnblogs.com/MakeView660/p/7773613.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!