Calling MC++ methods in C# application

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

    #1

    Calling MC++ methods in C# application

    Hi,

    I am writing a Managed C++ wrapper DLL for some C
    functions in a statically linked library, such that I can
    use those C functions (through the C++.NET Wrapped
    mehtods) in a C# Windows User Control.

    The C function is: someFunction(HI NSTANCE hinst); // the
    parameter is HINSTANCE.

    How can I write a correct wrapper function in MC++ for the
    above function? In another word, What can I pass in as a
    HINSTANCE? Note that this MC++ method will be called in C#
    program.

    Thanks
  • DM McGowan II

    #2
    Re: Calling MC++ methods in C# application

    "QINGFENG" <qf_duan@yahoo. com> wrote in message
    news:f78601c43e 05$a4b3c560$a30 1280a@phx.gbl.. .[color=blue]
    > Hi,
    >
    > I am writing a Managed C++ wrapper DLL for some C
    > functions in a statically linked library, such that I can
    > use those C functions (through the C++.NET Wrapped
    > mehtods) in a C# Windows User Control.
    >
    > The C function is: someFunction(HI NSTANCE hinst); // the
    > parameter is HINSTANCE.
    >
    > How can I write a correct wrapper function in MC++ for the
    > above function? In another word, What can I pass in as a
    > HINSTANCE? Note that this MC++ method will be called in C#
    > program.
    >
    > Thanks[/color]

    Perhaps Marshal.GetHINS TANCE.

    Comment

    • DM McGowan II

      #3
      Re: Calling MC++ methods in C# application

      "DM McGowan II" <nospam@nospam. net> wrote in message
      news:74WdncdQu7 ENsTHdRVn-gQ@comcast.com. ..[color=blue]
      > "QINGFENG" <qf_duan@yahoo. com> wrote in message
      > news:f78601c43e 05$a4b3c560$a30 1280a@phx.gbl.. .[color=green]
      > > Hi,
      > >
      > > I am writing a Managed C++ wrapper DLL for some C
      > > functions in a statically linked library, such that I can
      > > use those C functions (through the C++.NET Wrapped
      > > mehtods) in a C# Windows User Control.
      > >
      > > The C function is: someFunction(HI NSTANCE hinst); // the
      > > parameter is HINSTANCE.
      > >
      > > How can I write a correct wrapper function in MC++ for the
      > > above function? In another word, What can I pass in as a
      > > HINSTANCE? Note that this MC++ method will be called in C#
      > > program.
      > >
      > > Thanks[/color]
      >
      > Perhaps Marshal.GetHINS TANCE.
      >[/color]

      So is that what you were looking for or are you just one of those new
      generation types that asks for help but doesn't know how to be gracious and
      tell someone yes that worked or no that wasn't it?

      Comment

      • DUAN

        #4
        Re: Calling MC++ methods in C# application



        You are right. I should have replied back with some points. Actually, I
        did not try the proposed method. Just in my case, I passed a
        System.IntPtr(0 ) and it worked fine.


        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        Working...