Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get file's and directory's properties sheets

Posted on 1999-07-03
3
Medium Priority
?
208 Views
Last Modified: 2013-11-20
 In "Windows Explorer" when we right-click on some file or directory item, we can get its shortcut menu,in which there are a item named as "Properties". If we select this item, windows will show us a properties  sheet of the file.
  I want to get the "properties" sheet in my own program. Can anyone tell  me how to implement  it?
0
Comment
Question by:jwh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 800 total points
ID: 1308740
To display this dialog, use 'ShellExecuteEx()':

SHELLEXECUTEINFO sei;

   ZeroMemory(&sei,sizeof(sei));
   sei.cbSize = sizeof(sei);
   sei.lpFile = "<the file's mame>";
   sei.lpVerb = "properties";
   sei.fMask  = SEE_MASK_INVOKEIDLIST;
   ShellExecuteEx(&sei);
0
 
LVL 86

Expert Comment

by:jkr
ID: 1308741
BTW: This works for NT ans should work for Win9x also. If not, you might want to take a look at

'http://www.geocities.com/SiliconValley/4942/common.html'

This _undocumented_ function will do the same:
"Displaying Object Properties
 
The last function I'm going to deal with in this section is
SHObjectProperties. This is what you would use to display
the properties dialog for a file or folder. It can also be used
to display the properties for a printer object. The ordinal
value is 178 and the function declaration looks like this:
 
   BOOL WINAPI SHObjectProperties(
     HWND    hwndOwner, 
     UINT    uFlags, 
     LPCSTR  lpstrName, 
     LPCSTR  lpstrParameters);
 
      hwndOwner identifies the window that owns the dialog.
lpstrName points to a string containing the path
name or the printer name whose properties
will be displayed. uFlags specifies the type of
name contained in lpstrName (see Figure 5).
lpstrParameters points to a string containing   
OPF_PRINTERNAME 0x01
OPF_PATHNAME 0x02
Figure 5  SHObjectProperties Flags
 
 
 
the name of the page that will initially be selected. If lpstr-
Parameters is NULL, the first page on the property sheet
will be selected.
      If the function succeeds, the return value is TRUE. If
the function fails, the return value is FALSE. To get exten-
ded error information, call GetLastError. Note that this
dialog is actually modeless, so when the function returns the
dialog will probably still be open. There is no way of kno-
wing when the user has closed the dialog.
      I should also mention that if you only need to display
the properties for a file or folder, you can quite easily ac-
complish the same thing with a call to the documented
function ShellExecuteEx, specifying "properties" for the
lpVerb parameter. This doesn't appear to work for printer
names though.   "
0
 
LVL 86

Expert Comment

by:jkr
ID: 1308742
Sorry,

 sei.lpFile = "<the file's mame>";

should of course read

 sei.lpFile = "<the file's name>";

;-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question