Announcement

Collapse
No announcement yet.

VB to PowerBasic Conversion

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

  • VB to PowerBasic Conversion

    Hello All,
    I have a simple question for you and I hope u can help me with this.

    I have a DLL file compiled in VB, it has LockCheck as the Class Name and hasa Function CHECKESSDI in which a string can be passed as a parameter and the CHECKESSDI function returns either 0 or 1 (Integer). So in VB I just add a refrence for the dll file and I execute the checkessdi function by the following code.

    Dim Test as LockCheck
    set Test=New LockCheck
    Result=Test.CheckESSDI("12344")

    Now I will have either 0 / 1 in the result variable based on the return value the check function returns.

    Now how do I write the same code in PowerBasic. How do I declare the function in the DLL. I tried some examples, but they didn't work. It throws an error that the procedure entry point not found. I'm new to PB. Please advice.

  • #2
    If the DLL is COM compliant in its structure, you are looking to set Test as an interface of a class.

    DIM Test AS interface name

    In PB Win 9.0, the keyword SET is being deprecated for use with objects, instead we are being asked to use one of the appropriate forms of LET. See the help file topic LET statement (with objects). By reading that topic you should be able to determine which LET form is right for your program.

    Here's another thread with a similar question I posted a bit more info to earlier:
    Here
    Last edited by Richard Angell; 12 Sep 2008, 10:13 PM.
    Rick Angell

    Comment


    • #3
      Dear Richard

      Thank you for your reply. I'm using PB 8.0 and I'm very new to PB. Could you please show me an example code on how to link the DLL into PB and also the example of the code as I do in VB. The name of the dll is CheckLock.DLL

      Comment


      • #4
        PB 8 does not support the creation of ActiveX DLLs, only standard Win32 DLLs. You need to use the old method of DECLARE FUNCTION in your VB module, as you would if you needed to use the API. The references dialog is no use here as your DLL is not an ActiveX DLL.

        Also, remember to use "ALIAS" in VB with the DECLARE FUNCTION and/or your PB code (PB will export an upper-case name by default).
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          I think you have misunderstood. I'm not trying to create an activex dll in PB 8, I'm trying to use a DLL created in Visual Basic under PowerBasic. Hope I'm clear.

          Comment


          • #6
            PBWin 8, as Kev noted, does not have the extended abilities available in PBWin 9. PBWin9 has a much improved and extended COM interface and creation capabilities. You can see them in the on-line manual, for comparison with PBWin8,
            Here
            If you bought PBWin 8 just before PBWin 9 was announced you may be eligible for a free upgrade, so you should contact [email protected].

            However for the present, we are assuming the VB DLL is ActtiveX, so Kev is pointing you in the right direction. If you have the VB DLL code, you ought to post it here so other PB'ers can explain by example what needs to be done.

            Another approach is to re-create CheckLock.DLL in PBWin8, then it can be all PBWin 8 and 9 compatible without needing COM
            Rick Angell

            Comment

            Working...
            X