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. Visual Basic
  4. DLL Function in VB

DLL Function in VB

Scheduled Pinned Locked Moved Visual Basic
c++comdebugginghelptutorial
8 Posts 2 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.
  • T Offline
    T Offline
    Tim Rymer
    wrote on last edited by
    #1

    When trying to call a dynamically declared .dll function, i pass in a String, but when i debug it inside of VC, it's junk ("????????????????") anyone see that happen before? and know how to fix that in an already made ATL Object in VC? ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

    V 1 Reply Last reply
    0
    • T Tim Rymer

      When trying to call a dynamically declared .dll function, i pass in a String, but when i debug it inside of VC, it's junk ("????????????????") anyone see that happen before? and know how to fix that in an already made ATL Object in VC? ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

      V Offline
      V Offline
      Volodya Orlenko
      wrote on last edited by
      #2

      Can you give a small example of code (C++/ATL and VB) that gives this behavior? I remember having this sort of problem, but I don't remember how I solved it ;) (Though I did solve it, so maybe I'll be able to help :) ) Volodya Orlenko, orlenko [at] hotmail [dot] com

      T 1 Reply Last reply
      0
      • V Volodya Orlenko

        Can you give a small example of code (C++/ATL and VB) that gives this behavior? I remember having this sort of problem, but I don't remember how I solved it ;) (Though I did solve it, so maybe I'll be able to help :) ) Volodya Orlenko, orlenko [at] hotmail [dot] com

        T Offline
        T Offline
        Tim Rymer
        wrote on last edited by
        #3

        Ok, well first I created an ATL COM AppWizard .dll, and then created an ATL Object. Then in CMyObject(not IMyObject) I created a function that had a BSTR for a parameter (just input) and i tried setting the return value to "void _stdcall" and "void __declspec(dllexport)" and then going into the .def file, i added the appropriate function names and added the "@number" after each, but when i run it in my VB program, and debug the dll from VC++, it will either have "" <-- nothing in the string (and i've debugged from vb and there is stuff passed in) or mumbojumbo that either looks like: "?????????????????????????" or "?[the return character] <-- this repeated a bunch" and then it'll crash when i close it or whatever. I'm trying it in a regular dll now, but i would rather just make the small changes to the object's functions. Any help would be grand! I'm glad someone else has at least had this happen before, so any help/advise is awesome thanks ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

        V 1 Reply Last reply
        0
        • T Tim Rymer

          Ok, well first I created an ATL COM AppWizard .dll, and then created an ATL Object. Then in CMyObject(not IMyObject) I created a function that had a BSTR for a parameter (just input) and i tried setting the return value to "void _stdcall" and "void __declspec(dllexport)" and then going into the .def file, i added the appropriate function names and added the "@number" after each, but when i run it in my VB program, and debug the dll from VC++, it will either have "" <-- nothing in the string (and i've debugged from vb and there is stuff passed in) or mumbojumbo that either looks like: "?????????????????????????" or "?[the return character] <-- this repeated a bunch" and then it'll crash when i close it or whatever. I'm trying it in a regular dll now, but i would rather just make the small changes to the object's functions. Any help would be grand! I'm glad someone else has at least had this happen before, so any help/advise is awesome thanks ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

          V Offline
          V Offline
          Volodya Orlenko
          wrote on last edited by
          #4

          If I understand you correctly, you created an ATL Dll, a COM object in it, and now you want to use its methods just as dll functions, without that COM object at all? That will not work. To create a simple dll to be used from VB or C or whatever, you do not need ATL. Use "New", then select "Win32 Dynamic-Link Library" in your Visual C++. Volodya Orlenko, orlenko [at] hotmail [dot] com

          T 1 Reply Last reply
          0
          • V Volodya Orlenko

            If I understand you correctly, you created an ATL Dll, a COM object in it, and now you want to use its methods just as dll functions, without that COM object at all? That will not work. To create a simple dll to be used from VB or C or whatever, you do not need ATL. Use "New", then select "Win32 Dynamic-Link Library" in your Visual C++. Volodya Orlenko, orlenko [at] hotmail [dot] com

            T Offline
            T Offline
            Tim Rymer
            wrote on last edited by
            #5

            The thing is, is that I can get into the Function though, and debug through it, I tried using a function outside of the ATL object as well, but it still wouldnt work. Check this article out, do you see anything that he might be forgetting to tell me? http://www.codeproject.com/dll/superdll.asp#xx77114xx ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

            V 1 Reply Last reply
            0
            • T Tim Rymer

              The thing is, is that I can get into the Function though, and debug through it, I tried using a function outside of the ATL object as well, but it still wouldnt work. Check this article out, do you see anything that he might be forgetting to tell me? http://www.codeproject.com/dll/superdll.asp#xx77114xx ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

              V Offline
              V Offline
              Volodya Orlenko
              wrote on last edited by
              #6

              Ok, I see what you ae trying to do. Please download that example and modify it for your needs. It works. Note that he did not use any COM classes! You could do exactly the same by creating a new dll from scratch. Volodya Orlenko, orlenko [at] hotmail [dot] com

              T 1 Reply Last reply
              0
              • V Volodya Orlenko

                Ok, I see what you ae trying to do. Please download that example and modify it for your needs. It works. Note that he did not use any COM classes! You could do exactly the same by creating a new dll from scratch. Volodya Orlenko, orlenko [at] hotmail [dot] com

                T Offline
                T Offline
                Tim Rymer
                wrote on last edited by
                #7

                Yeah, that is a totally an awesome thing, but i got my ATL Class to work! In MSDN, if you're messing with strings, it says to use LPSTR when you're recieving a string, and it worked! and that is a public function inside a ATL Class, so it's something else to remember... ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

                V 1 Reply Last reply
                0
                • T Tim Rymer

                  Yeah, that is a totally an awesome thing, but i got my ATL Class to work! In MSDN, if you're messing with strings, it says to use LPSTR when you're recieving a string, and it worked! and that is a public function inside a ATL Class, so it's something else to remember... ~Timothy T. Rymer www.digipen.edu tim.xpertz.com

                  V Offline
                  V Offline
                  Volodya Orlenko
                  wrote on last edited by
                  #8

                  ATL objects are COM objects. You've got to create an instance of a class to use its functions. In general, you cannot use a member function of your C++ class without creating an instance of that class. It looks like you try to use member functions without creating any variables of that object's type. Volodya Orlenko, orlenko [at] hotmail [dot] com

                  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