码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2017-11-02 19:07:03      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:http   nta   color   hwnd   tee   eof   idt   cin   cut   

 

  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   nta   color   hwnd   tee   eof   idt   cin   cut   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!