COM Problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • timtos

    #1

    COM Problems

    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.


  • Mattias Sjögren

    #2
    Re: COM Problems

    >[color=blue]
    >I want to use the function IShellExtInit:: Initialize
    >
    >HRESULT Initialize(
    > LPCITEMIDLIST pidlFolder,
    > IDataObject *pdtobj,
    > HKEY hkeyProgID
    > );
    >
    >in C#.[/color]
    [color=blue]
    >I´ve used the [DllImport] a few times[/color]

    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
    %FrameworkSDKDi r%\Samples\Tech nologies\Intero p\Applications\ ShellCmd

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



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org

    Please reply only to the newsgroup.

    Comment

    • timtos

      #3
      Re: COM Problems

      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" <mattias.dont.w ant.spam@mvps.o rg> wrote in message news:%23TFA%23W xdDHA.2804@TK2M SFTNGP11.phx.gb l...[color=blue][color=green]
      > >
      > >I want to use the function IShellExtInit:: Initialize
      > >
      > >HRESULT Initialize(
      > > LPCITEMIDLIST pidlFolder,
      > > IDataObject *pdtobj,
      > > HKEY hkeyProgID
      > > );
      > >
      > >in C#.[/color]
      >[color=green]
      > >I´ve used the [DllImport] a few times[/color]
      >
      > 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
      > %FrameworkSDKDi r%\Samples\Tech nologies\Intero p\Applications\ ShellCmd
      >
      > Then you have to instantiate the COM object that implements the
      > interface.
      >
      >
      >
      > Mattias
      >
      > --
      > Mattias Sjögren [MVP] mattias @ mvps.org
      > http://www.msjogren.net/dotnet/
      > Please reply only to the newsgroup.[/color]


      Comment

      Working...