using SHObjectProperties?  
Author Message
Musafir





PostPosted: Visual C# General, using SHObjectProperties? Top

How to use the SHObjectProperties in .net please help with an example

please help



Visual C#17  
 
 
Mattias Sjogren





PostPosted: Visual C# General, using SHObjectProperties? Top

Declare it as an extern method with the DllImport attribute. Then call it pretty much like any other method. I think something like this should work

[DllImport("shell32.dll", CharSet=CharSet.Unicode)] static extern bool SHObjectProperties(IntPtr hwnd, uint dwType, string szObject, string szPage);



 
 
Gabriel Lozano-Moran





PostPosted: Visual C# General, using SHObjectProperties? Top

Normally I would recommend to bookmark the following web site:

The funny thing is that no one has entered yet the sig for SHObjectProperties in shell32.dll



 
 
Musafir





PostPosted: Visual C# General, using SHObjectProperties? Top

Thank you for the reply. where should i use the

[DllImport("shell32.dll", CharSet=CharSet.Unicode)] static extern bool SHObjectProperties(IntPtr hwnd, uint dwType, string szObject, string szPage);

i tried in the form load, but i am getting an error. I am doing Windows application using c#. should i include any reference

please help


 
 
Musafir





PostPosted: Visual C# General, using SHObjectProperties? Top

I used the code as follows:

[DllImport("shell32.dll", EntryPoint="SHObjectProperties", CharSet = CharSet.Auto)]

public static extern bool CallPropDialog(this.Handle , GetProperties.SHOP_FILEPATH , "c\\windows\\notepad.exe",null);

public enum GetProperties

{

SHOP_PRINTERNAME = 0x00000001, // lpObject points to a printer friendly name

SHOP_FILEPATH = 0x00000002, // lpObject points to a fully qualified path+file name

SHOP_VOLUMEGUID = 0x00000004 // lpObject points to a Volume GUID

};

But i am getting error as Type expected. Is the above code the correct way to use the shobjectproperties


 
 
Gabriel Lozano-Moran





PostPosted: Visual C# General, using SHObjectProperties? Top

public static extern bool CallPropDialog(this.Handle , GetProperties.SHOP_FILEPATH , "c\\windows\\notepad.exe",null);

This line has to be a method signature not a method call.