Pavel Minaev
9/29/2008 7:12:00 AM
On Sep 26, 9:19 pm, Kerem Gümrükcü <kareem...@hotmail.com> wrote:
> 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.