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. How to import "user32.dll'' from C# application [modified]

How to import "user32.dll'' from C# application [modified]

Scheduled Pinned Locked Moved C#
csharpjsontutorial
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.
  • R Offline
    R Offline
    rrpatel
    wrote on last edited by
    #1

    Hello, I want to do some windows API operation from C#. and for that i want to import user32.dll please give me specific syntax for importing dll from the .cs page at runtime Rahul Patel, Software Engineer, Gateway Technolabs -- modified at 6:26 Tuesday 13th February, 2007

    M W 2 Replies Last reply
    0
    • R rrpatel

      Hello, I want to do some windows API operation from C#. and for that i want to import user32.dll please give me specific syntax for importing dll from the .cs page at runtime Rahul Patel, Software Engineer, Gateway Technolabs -- modified at 6:26 Tuesday 13th February, 2007

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      [DllImport("user32")] private static extern UInt32 GetKeyboardLayoutList(int nBuff,ref int lpList);

      R 1 Reply Last reply
      0
      • M Martin 0

        [DllImport("user32")] private static extern UInt32 GetKeyboardLayoutList(int nBuff,ref int lpList);

        R Offline
        R Offline
        rrpatel
        wrote on last edited by
        #3

        thank a lot for giving me a solution....

        1 Reply Last reply
        0
        • R rrpatel

          Hello, I want to do some windows API operation from C#. and for that i want to import user32.dll please give me specific syntax for importing dll from the .cs page at runtime Rahul Patel, Software Engineer, Gateway Technolabs -- modified at 6:26 Tuesday 13th February, 2007

          W Offline
          W Offline
          wasife
          wrote on last edited by
          #4

          You need to use something like this: [DllImport("user32.dll")] < Declaration of function in user32.dll to be used here preceded by static extern > You have to declare each function you want to use in C# code in the above manner.Moreover you should write this code where you are declaring other variables of your class which is normally at the start of the class. After that you can use those functions in your C# code. Keep in mind that all the types used while declaring function prototypes must be C# types and must not contains Win32 or other languages types. Regards, Wasif Ehsan.

          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