IntPtr

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

    #1

    IntPtr

    What is the C# equivelent of the VB .Net "IntPtr"
    i need to pass it to the File System object?


  • Bob Powell [MVP]

    #2
    Re: IntPtr

    System.IntPtr is a standard value type and works with all .NET languages.

    --
    Bob Powell [MVP]
    C#, System.Drawing

    The November edition of Well Formed is now available.
    Learn how to create Shell Extensions in managed code.


    Answer those GDI+ questions with the GDI+ FAQ


    Read my Blog at http://bobpowelldotnet.blogspot.com

    "Lou" <lou.garvin@com cast.net> wrote in message
    news:OYpCR%23Pu DHA.1512@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > What is the C# equivelent of the VB .Net "IntPtr"
    > i need to pass it to the File System object?
    >
    >[/color]


    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: IntPtr

      Bob and Lou,

      It should be noted that if you are going to pass handles to unmanaged
      code that are represented by managed constructs, you should use the
      HandleRef structure instead. This will make sure that if the object is not
      referenced anywhere else, it is not disposed of.

      For example, if using the Graphics object, and you call GetHdc, you
      should use a HandleRef structure instead of an IntPtr, so that when passed
      to unmanaged code (a call to BitBlt perhaps), the Graphics instance won't be
      collected by the GC if it isn't referenced anywhere.

      Hope this helps.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m

      "Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
      news:OLy1ACQuDH A.2448@TK2MSFTN GP12.phx.gbl...[color=blue]
      > System.IntPtr is a standard value type and works with all .NET languages.
      >
      > --
      > Bob Powell [MVP]
      > C#, System.Drawing
      >
      > The November edition of Well Formed is now available.
      > Learn how to create Shell Extensions in managed code.
      > http://www.bobpowell.net/currentissue.htm
      >
      > Answer those GDI+ questions with the GDI+ FAQ
      > http://www.bobpowell.net/gdiplus_faq.htm
      >
      > Read my Blog at http://bobpowelldotnet.blogspot.com
      >
      > "Lou" <lou.garvin@com cast.net> wrote in message
      > news:OYpCR%23Pu DHA.1512@TK2MSF TNGP10.phx.gbl. ..[color=green]
      > > What is the C# equivelent of the VB .Net "IntPtr"
      > > i need to pass it to the File System object?
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...