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 use the dll developed in VC6

how to use the dll developed in VC6

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiotutorial
5 Posts 4 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
    yyf
    wrote on last edited by
    #1

    Hi, everyone I have a dll file developed by someone else in VC6. Now I tried to use it in VS.Net, but how can I do that? Thanks in advance.

    M 1 Reply Last reply
    0
    • Y yyf

      Hi, everyone I have a dll file developed by someone else in VC6. Now I tried to use it in VS.Net, but how can I do that? Thanks in advance.

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      If it is a COM dll, you can just use Add Reference meny by right click on your references in your project solution and select its dll in COM tab and simply use its namespace. If its not COM and its just like win32 dlls you can use DllImport to use its functions. See MSDN and this site for samples. Mazy "Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland

      Y 1 Reply Last reply
      0
      • M Mazdak

        If it is a COM dll, you can just use Add Reference meny by right click on your references in your project solution and select its dll in COM tab and simply use its namespace. If its not COM and its just like win32 dlls you can use DllImport to use its functions. See MSDN and this site for samples. Mazy "Man is different from animals in that he speculates, a high risk activity." - Edward Hoagland

        Y Offline
        Y Offline
        yyf
        wrote on last edited by
        #3

        It's not a com dll. Because when I am using "add reference", it doesn't work. Then I tried to use DllImport like this: [System.Runtime.InteropServices.DllImport(@"C:\Visual Studio Projects\test\bin\Debug\dcli.dll", EntryPoint="AdminLogin")] public static extern bool AdminLogin(string lpctstrUser, string lpctstrPassWord); Then I got a "DllNotFound" exception. But I already put the dll file in "C:\Visual Studio Projects\test\bin\Debug\dcli.dll". Do you know why? Thanks in advance.

        J 1 Reply Last reply
        0
        • Y yyf

          It's not a com dll. Because when I am using "add reference", it doesn't work. Then I tried to use DllImport like this: [System.Runtime.InteropServices.DllImport(@"C:\Visual Studio Projects\test\bin\Debug\dcli.dll", EntryPoint="AdminLogin")] public static extern bool AdminLogin(string lpctstrUser, string lpctstrPassWord); Then I got a "DllNotFound" exception. But I already put the dll file in "C:\Visual Studio Projects\test\bin\Debug\dcli.dll". Do you know why? Thanks in advance.

          J Offline
          J Offline
          Jeremy Kimball
          wrote on last edited by
          #4

          Ugh. I think I remember reading/hearing something about this. I'm not sure I remember exactly, but I don't believe you can explicitly provide a path as you have. I think it looks for "filename.dll" in a set order of pathnames. Jeremy Kimball

          A 1 Reply Last reply
          0
          • J Jeremy Kimball

            Ugh. I think I remember reading/hearing something about this. I'm not sure I remember exactly, but I don't believe you can explicitly provide a path as you have. I think it looks for "filename.dll" in a set order of pathnames. Jeremy Kimball

            A Offline
            A Offline
            Andy Wieberneit
            wrote on last edited by
            #5

            Seems that your dll is delivering strings. If you want to get a string from a dll, you should use a string builder. Try something like this: StringBuilder sb = new StringBuilder( 256 ); [DllImport( "myDll.dll" )] public static extern void GetString( StringBuilder sb ); void myFunc() { GetString( sb ); Debug.WriteLine( "String = " + sb.ToString() ); }

            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