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 / C++ / MFC
  4. how to call vb dll in vc++( iam using MFC) and vc6

how to call vb dll in vc++( iam using MFC) and vc6

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
13 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.
  • U User 3650979

    can u please help any body how to call vb dll in vc++ i MY VB DLL IS mydll.dll #import "c:\mydll.dll" // this is given compilation errors or typedef CString (WINAPI*ifunc)(CString str); INCREMENTFUN pIncrement; HINSTANCE hLib; hLib = LoadLibrary("..\\scdthndl.dll"); pIncrement = (INCREMENTFUN)GetProcAddress((HMODULE)hLib, "StringToCSV"); // here its giving pIncrement = 0x0000000 any one can help me....

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

    the other comments are fully right to call the dll. But for string parameter you should use BSTR type. An article with basic explanations: Guide to BSTR and C String Conversions[^]

    Press F1 for help or google it. Greetings from Germany

    1 Reply Last reply
    0
    • CPalliniC CPallini

      Member 3653751 wrote:

      c:\mydll.dll

      Member 3653751 wrote:

      scdthndl.dll

      Why different names?

      Member 3653751 wrote:

      pIncrement = (INCREMENTFUN)GetProcAddress((HMODULE)hLib, "StringToCSV"); // here its giving pIncrement = 0x0000000

      Afterwards, you should call GetLastError() to obtain more info. Did you check what is the exported function name (you may use, for instance, the Depends tool)? :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      U Offline
      U Offline
      User 3650979
      wrote on last edited by
      #5

      sorry.... by mistake i typed scdthndl.dll...if i give mydll.dll also same problem.... can u please help i want use vb dll in vc++

      CPalliniC 1 Reply Last reply
      0
      • U User 3650979

        sorry.... by mistake i typed scdthndl.dll...if i give mydll.dll also same problem.... can u please help i want use vb dll in vc++

        CPalliniC Online
        CPalliniC Online
        CPallini
        wrote on last edited by
        #6

        Did you check the exported function name? Do you read the suggestions (mine and of the other folks?)? :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        U 1 Reply Last reply
        0
        • U User 3650979

          can u please help any body how to call vb dll in vc++ i MY VB DLL IS mydll.dll #import "c:\mydll.dll" // this is given compilation errors or typedef CString (WINAPI*ifunc)(CString str); INCREMENTFUN pIncrement; HINSTANCE hLib; hLib = LoadLibrary("..\\scdthndl.dll"); pIncrement = (INCREMENTFUN)GetProcAddress((HMODULE)hLib, "StringToCSV"); // here its giving pIncrement = 0x0000000 any one can help me....

          A Offline
          A Offline
          Adam Roderick J
          wrote on last edited by
          #7

          Check whether scdthndl.dll is loaded, means hLib is having value or it is also 0?

          Величие не Бога может быть недооценена.

          U 1 Reply Last reply
          0
          • S Stephen Hewitt

            Firstly, if you're using GetProcAddress the function should be exported from the DLL. Check with something like depends[^]. #import is for type libraries. Using this implies that the method is exported using COM, in which case GetProcAddress will not work.

            Steve

            U Offline
            U Offline
            User 3650979
            wrote on last edited by
            #8

            hi i have vb activex dll...i want to use vc++...please help me.... HINSTANCE hLib; hLib = LoadLibrary(c:\scdthndl.dll"); pIncrement = (INCREMENTFUN)GetProcAddress((HMODULE)hLib, "StringToCSV"); pIncrement is giving 0x000000..

            S 1 Reply Last reply
            0
            • CPalliniC CPallini

              Did you check the exported function name? Do you read the suggestions (mine and of the other folks?)? :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              U Offline
              U Offline
              User 3650979
              wrote on last edited by
              #9

              i checked exported function name....it is correct only... but its giveing NULL....

              CPalliniC 1 Reply Last reply
              0
              • U User 3650979

                i checked exported function name....it is correct only... but its giveing NULL....

                CPalliniC Online
                CPalliniC Online
                CPallini
                wrote on last edited by
                #10

                Why didn't you call, as suggested, GetLastError?

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                In testa che avete, signor di Ceprano?

                1 Reply Last reply
                0
                • A Adam Roderick J

                  Check whether scdthndl.dll is loaded, means hLib is having value or it is also 0?

                  Величие не Бога может быть недооценена.

                  U Offline
                  U Offline
                  User 3650979
                  wrote on last edited by
                  #11

                  hi hlib have value...GetProcAddress() only Null coming please give me any suggestions....

                  A 1 Reply Last reply
                  0
                  • U User 3650979

                    hi hlib have value...GetProcAddress() only Null coming please give me any suggestions....

                    A Offline
                    A Offline
                    Adam Roderick J
                    wrote on last edited by
                    #12

                    Then surely StringToCSV is not an exported function from that DLL check the depedency of the DLL, check if StringToCSV is shown in Exported functions.

                    Величие не Бога может быть недооценена.

                    1 Reply Last reply
                    0
                    • U User 3650979

                      hi i have vb activex dll...i want to use vc++...please help me.... HINSTANCE hLib; hLib = LoadLibrary(c:\scdthndl.dll"); pIncrement = (INCREMENTFUN)GetProcAddress((HMODULE)hLib, "StringToCSV"); pIncrement is giving 0x000000..

                      S Offline
                      S Offline
                      Stephen Hewitt
                      wrote on last edited by
                      #13

                      As I told you before, verify the function is exported.

                      Steve

                      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