Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. win32 datatype in C#.NET

win32 datatype in C#.NET

Scheduled Pinned Locked Moved C#
csharpcomhelptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Babarsaeed
    wrote on last edited by
    #1

    HI, how to use win32 datatype in c#.NET am using [DllImport("Kernel32", CharSet=CharSet.Auto)] private unsafe static extern UInt32 CreateIoCompletionPort(UInt32 hFile, UInt32 hExistingCompletionPort, UInt32* puiCompletionKey, UInt32 uiNumberOfConcurrentThreads); this function , n i wants to pass a socket to ist parameter as a handle and when i convert socket to UInt32 it gives me INVALID CAST EXCEPTION so how i pass socket to UInt32 hFile this argument.??? please help me ........... Thanks babur.saeed@gmail.com its_me_babar@yahoo.com Babar

    S 1 Reply Last reply
    0
    • B Babarsaeed

      HI, how to use win32 datatype in c#.NET am using [DllImport("Kernel32", CharSet=CharSet.Auto)] private unsafe static extern UInt32 CreateIoCompletionPort(UInt32 hFile, UInt32 hExistingCompletionPort, UInt32* puiCompletionKey, UInt32 uiNumberOfConcurrentThreads); this function , n i wants to pass a socket to ist parameter as a handle and when i convert socket to UInt32 it gives me INVALID CAST EXCEPTION so how i pass socket to UInt32 hFile this argument.??? please help me ........... Thanks babur.saeed@gmail.com its_me_babar@yahoo.com Babar

      S Offline
      S Offline
      Stanciu Vlad
      wrote on last edited by
      #2

      Handle dataTypes in C# must be IntPtr, therefor you procedure should look like this :

      [DllImport("Kernel32")]
      private static extern IntPtr CreateIoCompletionPort(IntPtr hFile, IntPtr hExistingCompletionPort, IntPtr puiCompletionKey, IntPtr uiNumberOfConcurrentThreads);

      I hope you understand... By the way... visit http://nehe.gamedev.net[^]

      A 1 Reply Last reply
      0
      • S Stanciu Vlad

        Handle dataTypes in C# must be IntPtr, therefor you procedure should look like this :

        [DllImport("Kernel32")]
        private static extern IntPtr CreateIoCompletionPort(IntPtr hFile, IntPtr hExistingCompletionPort, IntPtr puiCompletionKey, IntPtr uiNumberOfConcurrentThreads);

        I hope you understand... By the way... visit http://nehe.gamedev.net[^]

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Thank u very much i have solved the problem,,,,,,,, but now stuck into another problem :sigh: can u help me if i send u code?

        S 1 Reply Last reply
        0
        • A Anonymous

          Thank u very much i have solved the problem,,,,,,,, but now stuck into another problem :sigh: can u help me if i send u code?

          S Offline
          S Offline
          Stanciu Vlad
          wrote on last edited by
          #4

          Yes, at least I will try. I hope you understand... By the way... visit http://nehe.gamedev.net[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups