Announcement

Collapse
No announcement yet.

DLL for VB6 problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DLL for VB6 problems

    According to all info available, it should be possible to write a DLL for the use by VB6.
    HA!
    I tried it, but if I don't register it, VB6 won't find it (even if it is in the same directory). If I try to register it, I get an error msg, "can not find regserver entry point" ( and I used the Export declaration). If I just try to use it from the IDE (Project - References etc) it says VB cannot use it.
    It seems I am doing something wrong, but what ?

  • #2
    People use PB DLLs with VB all the time so, yes, it can be done.

    Read the section in the PB manual called "Creating Dynamic Link Libraries". You need to EXPORT functions from your DLL and then craft the correct DECLARES to use in your VB program in order to call those functions in the DLL. You do not "register" the DLLs. RegSvr is used with ActiveX DLLs.
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

    Comment


    • #3
      Today's hint: When creating PB DLLs for use with VB6, do NOT use "BYVAL AS STRING" parameters in your functions:

      http://www.powerbasic.com/support/pb...ad.php?t=38894
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        VB uses dynamic loading of DLLs (LoadLibrary), in the IDE, so a simple CHDIR APP.PATH in the main Form_Load will help it find a DLL located in the project folder. This is an old trick I used to use.
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          Also may be useful for VB+PB developers......

          Show Loaded Modules Source and Executable package for PB and VB
          Visual Basic include files/demo code by Balthasar Indermuehle. (PB code by YT.)
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Sounds like a upper/lower case problem finding exported function.
            Did you use ALIAS in both PB and VB using all upper case?

            PB:
            Code:
            DECLARE SUB Hello LIB "connect.dll" ALIAS "HELLO" (s AS STRING)
            VB: (placed into MODULE1.BAS in this example)
            Code:
            PUBLIC Declare Sub Hello "connect.dll" Alias "HELLO" (s As String)
            How long is an idea?

            Comment


            • #7
              Also, you do not need ALIAS on the PB side if ALIAS "UPPER CASE" on the VB side as the function is exported all upper case by default. That is in the help somewhere, but I didn't find it.
              How long is an idea?

              Comment


              • #8
                No, you don't "NEED" the ALIAS clause, but I would suggest it is a good practice.

                You also don't "NEED" #DIM ALL or #DEBUG ERROR ON, but I would suggest these are good practice as well.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  I disagree. You do need it on the VB6 side unless he plans to use all upper case.
                  How long is an idea?

                  Comment


                  • #10
                    You DOOOoooo need uppercase unless aliased (as seen in my other post), but that is also up to the compiler that is accessing a DLL (whether your own, or a 3rd party, or a API)

                    What matters is making the rosetta stone between the DLL and how you use it
                    Engineer's Motto: If it aint broke take it apart and fix it

                    "If at 1st you don't succeed... call it version 1.0"

                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                    Comment

                    Working...
                    X