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. Calling DLL's

Calling DLL's

Scheduled Pinned Locked Moved C#
helpcsharpjsonquestion
6 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.
  • V Offline
    V Offline
    Venet
    wrote on last edited by
    #1

    Hi All, I'm having a small problem with my C# application. I have a DLL written a while ago, using pure Windows API. Now, it would be really nice if I could call functions of that DLL from my C# application. Any ideas how I might go about it? Any help would be appreciated. Regards, Venet. -------- Black holes are where God divided by zero.(Steven Wright)

    R Z 2 Replies Last reply
    0
    • V Venet

      Hi All, I'm having a small problem with my C# application. I have a DLL written a while ago, using pure Windows API. Now, it would be really nice if I could call functions of that DLL from my C# application. Any ideas how I might go about it? Any help would be appreciated. Regards, Venet. -------- Black holes are where God divided by zero.(Steven Wright)

      R Offline
      R Offline
      Rupel
      wrote on last edited by
      #2

      i'm not an expert in dll-including, but i once took a function out of an ordinary dll like this:

      [DllImport("user32.dll")]
      private static extern bool SetForegroundWindow(IntPtr hWnd);

      and just used it. that was all :) :wq

      1 Reply Last reply
      0
      • V Venet

        Hi All, I'm having a small problem with my C# application. I have a DLL written a while ago, using pure Windows API. Now, it would be really nice if I could call functions of that DLL from my C# application. Any ideas how I might go about it? Any help would be appreciated. Regards, Venet. -------- Black holes are where God divided by zero.(Steven Wright)

        Z Offline
        Z Offline
        Zombies with Coffee LLC
        wrote on last edited by
        #3

        Your best bet... Put up the function call and we'll translate it for you. It's incredibly easy with C# now. I've done about 20 of them so far and I'm really impressed with the robustness of them.

        V 1 Reply Last reply
        0
        • Z Zombies with Coffee LLC

          Your best bet... Put up the function call and we'll translate it for you. It's incredibly easy with C# now. I've done about 20 of them so far and I'm really impressed with the robustness of them.

          V Offline
          V Offline
          Venet
          wrote on last edited by
          #4

          Thanks for your replies. Basically the function contained within the dll is: bool state; bool InstallMHook(state); And I have exported this function from mhook.dll. So is this what I need to do: [DllImport("mhook.dll")] private static extern bool InstallMHook(bool someState); as suggested by Rüpel ? Regards, Venet. -------- Black holes are where God divided by zero.(Steven Wright)

          Z 1 Reply Last reply
          0
          • V Venet

            Thanks for your replies. Basically the function contained within the dll is: bool state; bool InstallMHook(state); And I have exported this function from mhook.dll. So is this what I need to do: [DllImport("mhook.dll")] private static extern bool InstallMHook(bool someState); as suggested by Rüpel ? Regards, Venet. -------- Black holes are where God divided by zero.(Steven Wright)

            Z Offline
            Z Offline
            Zombies with Coffee LLC
            wrote on last edited by
            #5

            Exactly!

            V 1 Reply Last reply
            0
            • Z Zombies with Coffee LLC

              Exactly!

              V Offline
              V Offline
              Venet
              wrote on last edited by
              #6

              I shall try this.:) Regards, Venet. -------- Black holes are where God divided by zero.(Steven Wright)

              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