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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Importing a win32 dll in C#

Importing a win32 dll in C#

Scheduled Pinned Locked Moved C#
csharpquestion
5 Posts 5 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.
  • Y Offline
    Y Offline
    yeah1000
    wrote on last edited by
    #1

    Hello, i need to import a win32 (unmanaged) dll in C#, can it be done and what would be the best way to do it? TY

    L R K 3 Replies Last reply
    0
    • Y yeah1000

      Hello, i need to import a win32 (unmanaged) dll in C#, can it be done and what would be the best way to do it? TY

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, I don't know about importing a DLL, however you can call unmanaged functions using P/Invoke. I have been writing this little article[^] on the subject, it isn't finished yet, but it may offer an introduction. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
      [The QA section does it automatically now, when do we get it on regular forums?]


      1 Reply Last reply
      0
      • Y yeah1000

        Hello, i need to import a win32 (unmanaged) dll in C#, can it be done and what would be the best way to do it? TY

        R Offline
        R Offline
        Rhys Gravell
        wrote on last edited by
        #3

        Ref. PInvoke, there's a good wiki available; pinvoke.net/[^]

        Rhys "The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it" They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance." Terry Pratchett

        1 Reply Last reply
        0
        • Y yeah1000

          Hello, i need to import a win32 (unmanaged) dll in C#, can it be done and what would be the best way to do it? TY

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          it can be done as described in the others answers, but consider it is a lot of writing boring code so really think what you need and what not. Because degrees performance, consider writing a wrapper dll which will do some stuff. Tip: Strings with StringBuilder and size as parameter :thumbsup:

          Press F1 for help or google it. Greetings from Germany

          L 1 Reply Last reply
          0
          • K KarstenK

            it can be done as described in the others answers, but consider it is a lot of writing boring code so really think what you need and what not. Because degrees performance, consider writing a wrapper dll which will do some stuff. Tip: Strings with StringBuilder and size as parameter :thumbsup:

            Press F1 for help or google it. Greetings from Germany

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            which dll you want to use? Is it system dll or else?

            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