COM Problems

  • Thread starter Thread starter timtos
  • Start date Start date
T

timtos

Hello.

I want to use the function IShellExtInit::Initialize

HRESULT Initialize(
LPCITEMIDLIST pidlFolder,
IDataObject *pdtobj,
HKEY hkeyProgID
);

in C#.

I´ve used the [DllImport] a few times, often with no problems but this time I think I have to give up! I´ve searched the net and the
msdn but I´ve found NO help.

Can anybody give me a few hints or a code snippet?
Really every little hint is welcome!

Greetings and thanks in advance,
timtos.
 
I want to use the function IShellExtInit::Initialize

HRESULT Initialize(
LPCITEMIDLIST pidlFolder,
IDataObject *pdtobj,
HKEY hkeyProgID
);

in C#.
I´ve used the [DllImport] a few times

The DllImport attribute is for P/Invoke. IShellExtInit::Initialize is
a COM interface method, so you have to use COM interop to call it.

First you have to declare the IShellExtInit interface. Check out the
ShellCmd sample included with the .NET SDK to see how this is done.
It's in
%FrameworkSDKDir%\Samples\Technologies\Interop\Applications\ShellCmd

Then you have to instantiate the COM object that implements the
interface.



Mattias
 
Thanks a lot!
I will take a look at the sample right now...

(And now I know why I didn´t find any information
about this topic. I always included the DllImport
string in my search query. Thanks for making things clear.)

Greetings,
timtos

Mattias Sjögren said:
I want to use the function IShellExtInit::Initialize

HRESULT Initialize(
LPCITEMIDLIST pidlFolder,
IDataObject *pdtobj,
HKEY hkeyProgID
);

in C#.
I´ve used the [DllImport] a few times

The DllImport attribute is for P/Invoke. IShellExtInit::Initialize is
a COM interface method, so you have to use COM interop to call it.

First you have to declare the IShellExtInit interface. Check out the
ShellCmd sample included with the .NET SDK to see how this is done.
It's in
%FrameworkSDKDir%\Samples\Technologies\Interop\Applications\ShellCmd

Then you have to instantiate the COM object that implements the
interface.



Mattias
 
Back
Top