Passing COM Interface Implementation to PInvoke API Call,...

  • Thread starter Thread starter Kerem Gümrükcü
  • Start date Start date
K

Kerem Gümrükcü

Hi,

i am looking for an example that shows how to
implement a COM Interface (with events) and
pass it to a Windows API Call via pointer. Since
this is really new to me, i dont know where to
start,...

The Problem is still the EditSecurity Windows API
call, that expects a pointer to a ISecurityInformation
Interface implementation as the second parameter.
How to implement this Interface in C# and the
how to pass this to the function,...?

Any help is really welcome!

Regards

Kerem


--
 
Hi,

i am looking for an example that shows how to
implement a COM Interface (with events) and
pass it to a Windows API Call via pointer. Since
this is really new to me, i dont know where to
start,...

The Problem is still the EditSecurity Windows API
call, that expects a pointer to a ISecurityInformation
Interface implementation as the second parameter.
How to implement this Interface in C# and the
how to pass this to the function,...?

If you have a typelib that defines the interface, you can use
tlbimp.exe to produce a C# definition of that interface. Otherwise, my
advice would be to do the same on a similar interface, then decompile
the produced assembly using Reflector, and see how various COM
constructs are translated to C#. From there, you should be able to
hand-code the interface definition.

To pass it in a P/Invoke call, nothing special is needed. You just
declare the argument of a function with the type of that interface.
 
Hi Pavel,

i am very glad to get some reply here. I have never
implemented a COM Interface in C# before, i mean
handwritten. Can you point to some example or
a documentation for this. There is no TypeLib
available for that interface, just C++ and IDL Interface
definitions in the Windows API Headers,...

Regards

Kerem

--
 
i am very glad to get some reply here. I have never
implemented a COM Interface in C# before, i mean
handwritten. Can you point to some example or
a documentation for this. There is no TypeLib
available for that interface, just C++ and IDL Interface
definitions in the Windows API Headers,...

Here's an MSDN article explaining how to hand-write C# interface
declarations for COM interfaces:

http://msdn.microsoft.com/en-us/library/x8fbsf00.aspx
 
Thanks for the Link Pavel,...


Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
i am very glad to get some reply here. I have never
implemented a COM Interface in C# before, i mean
handwritten. Can you point to some example or
a documentation for this. There is no TypeLib
available for that interface, just C++ and IDL Interface
definitions in the Windows API Headers,...

Here's an MSDN article explaining how to hand-write C# interface
declarations for COM interfaces:

http://msdn.microsoft.com/en-us/library/x8fbsf00.aspx
 
Back
Top