shell32

How do I go about instantiating a COM Object in C# by CLSID?

别等时光非礼了梦想. 提交于 2019-12-06 08:13:16
问题 Forgive me if my terminology is off, as this is somewhat uncharted territory for me. I have a program which needs to create a FolderShortcut . Microsoft has documentation on how to create it in C++, and I'm trying to translate the directions to C#. The instructions state that the CoCreateInstance function needs to be called with CLSID_FolderShortcut as a parameter, which I infer to mean that it's instantiating a COM object. The CLSID for this object is {0AFACED1-E828-11D1-9187-B532F1E9575D} .

P/Invoke with Shell32, bypass Interop.Shell32.dll generation

醉酒当歌 提交于 2019-12-06 07:19:55
问题 So I'm using the following code to dump every extended file attribute to the debug console... ShellClass shellClass = new ShellClass(); Folder dir = shellClass.NameSpace(Path.GetDirectoryName(sFilePath)); FolderItem item = dir.ParseName(Path.GetFileName(sFilePath)); for (int i = 0; i < 267; i++) { System.Debug.WriteLine(dir.GetDetailsOf(item, i)); } As Shell32 is a non-managed library, I can't embed the DLL resource in the program directly, and it has to generate an interop helper DLL. Anyone

get the date when the file was sent to recycle bin

我们两清 提交于 2019-12-05 18:44:07
Is there any call which will get the date when the file was sent to recycle bin. Items object in Shell32 gives the lastmodified date but not when it is sent to recycle bin. I want to be able to restore files deleted on a particular date. OK - as usual it is very simple when you know how. I was thinking this would be a property of the file - but it is not - it is a property of the recycle bin. So once a link to the recycle bin has been got: var Shl = new Shell(); Folder Recycler = Shl.NameSpace(10); FI = Recycler.Items().Item(0); string FileName = Recycler.GetDetailsOf(FI, 0); string FilePath =

What is the correct way to implement a Managed Property Handler Shell Extension?

☆樱花仙子☆ 提交于 2019-12-05 09:07:38
Now that .NET CLR 4.0 supports side by side (SxS) operation it should now be possible to write shell extensions in managed code. I have attempted this and successfully coded a Property Handler that implements IPropertyStore, IInitializeWithStream and IPropertyStoreCapabilities. The handler works fine and is called as expected when browsing files via the explorer. It also works fine in displaying the custom properties in the preview panel and the file properties "detail" panel. However, when I attempt to edit a property in the preview panel, and then click "Save" I get a "File In Use" error

Referencing shell32 again, C# Visual Studio

拟墨画扇 提交于 2019-12-05 08:14:26
Hmmm. Okay after revisiting PInvoke, I'm sure that I don't quite get it :-/ (just asked this question ) Let me illustrate the code I need to handle. It works when I use "Add Reference --> COM --> Microsoft Shell Controls and Automatation" ... but sadly it places a reference in my project that looks like this: "C:\Users\Tim\Documents\Visual Studio 2008\Projects\Wing\FileWing\obj\Debug\Interop.Shell32.dll" I'm digging though the recycling bin and seek for a item that I want to recover. Is there any way NOT fighting through the PInvoke to get this done? Or to get a reference to the system32

How do I go about instantiating a COM Object in C# by CLSID?

霸气de小男生 提交于 2019-12-04 16:03:15
Forgive me if my terminology is off, as this is somewhat uncharted territory for me. I have a program which needs to create a FolderShortcut . Microsoft has documentation on how to create it in C++, and I'm trying to translate the directions to C#. The instructions state that the CoCreateInstance function needs to be called with CLSID_FolderShortcut as a parameter, which I infer to mean that it's instantiating a COM object. The CLSID for this object is {0AFACED1-E828-11D1-9187-B532F1E9575D} . I've tried adding a reference to Shell32.dll from the COM tab, but the FolderShortcut object does not

P/Invoke with Shell32, bypass Interop.Shell32.dll generation

雨燕双飞 提交于 2019-12-04 13:00:34
So I'm using the following code to dump every extended file attribute to the debug console... ShellClass shellClass = new ShellClass(); Folder dir = shellClass.NameSpace(Path.GetDirectoryName(sFilePath)); FolderItem item = dir.ParseName(Path.GetFileName(sFilePath)); for (int i = 0; i < 267; i++) { System.Debug.WriteLine(dir.GetDetailsOf(item, i)); } As Shell32 is a non-managed library, I can't embed the DLL resource in the program directly, and it has to generate an interop helper DLL. Anyone know of the DLLImport command lines for these functions in Shell32 to get around the whole generation

Get list of selected files from Windows Desktop

▼魔方 西西 提交于 2019-12-04 03:21:24
I am trying to get a list of selected files from the Windows Desktop and the Explorer Windows. The requirement is that I should be able to retrieve the current selection from the active explorer window or the Desktop. I have managed to put together the following code, after going through online resources, but it does not provide a list of selected items from the Desktop. ArrayList selected = new ArrayList(); var shell = new Shell32.Shell(); IntPtr handle = IntPtr.Zero; handle = GetForegroundWindow(); int intHandle = handle.ToInt32(); //For each explorer foreach (InternetExplorer window in new

'Safe' DLL Injection

杀马特。学长 韩版系。学妹 提交于 2019-12-03 17:13:32
Not a terribly good question, sorry. I have a program that needs to be alerted when a file is opened from explorer (i.e. ShellExecute(A/W) is called). Unfortunately, Microsoft removed the COM interface (IShellExecuteHook) that allows you to hook these events in Vista and up, supposedly because older code could cause a crash due to changes. There was a work-around to re-enable this feature, but it no longer works. I've done some research and it looks like the only way to catch calls to ShellExecute is to re-route the call to shell32.dll. At the moment, I'm looking at injecting my own DLL into

Use SHAssocEnumHandlers in C#

只谈情不闲聊 提交于 2019-12-02 12:13:17
问题 I am struggling to call the WinAPI SHAssocEnumHandlers in C#. using System; using System.Runtime.InteropServices; namespace AssocHandlerTest { [Flags] public enum ASSOC_FILTER { ASSOC_FILTER_NONE = 0x0, ASSOC_FILTER_RECOMMENDED = 0x1 }; [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("F04061AC-1659-4a3f-A954-775AA57FC083")] public interface IAssocHandler { int GetName([Out, MarshalAs(UnmanagedType.LPWStr)] out string ppsz); int GetUIName([Out, MarshalAs(UnmanagedType