Announcement

Collapse
No announcement yet.

Something Simple?

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

  • Something Simple?

    Hi,
    I'm using PBCC 5.01.0100 on Windows XP.

    I'm having difficulty in getting PBCC to use an ActiveXDLL that I created in Visual Basic 5.0.

    The said DLL works fine from a VB program, and a Delphi program, so I know that the DLL is okay.

    Here's the include file;

    ' Generated by: PowerBASIC COM Browser v.2.00.0070
    ' Date & Time : 7/28/2009 at 12:22 PM
    ' ------------------------------------------------
    ' Library Name: myjlc
    ' Library File: C:\Documents and Settings\jlc\My Documents\Data\Visual Basic\myjlc\myjlc.dll
    ' Description :
    ' GUID : {DDA871C3-7AEE-41E3-8C8C-D90E65180E1C}
    ' LCID : 0
    ' Version : 2.0

    ' Version Dependent ProgID's
    $PROGID_myjlc_cMathcMath = "myjlc.cMath"

    ' Class Indentifiers
    $CLSID_myjlc_cMath = GUID$("{ED22822B-A2B3-4B4B-9D26-21FCE57D318A}")

    ' Interface Indentifiers
    $IID_myjlc_Int__cMath = GUID$("{597360D2-FB5E-4ED3-9452-158898F40676}")

    ' Interface Name : Int__cMath
    ' Class Name : cMath
    ' ClassID : $CLSID_myjlc_cMath
    Interface Int__cMath $IID_myjlc_Int__cMath
    Inherit IDispatch

    Method PricePerPound <1610809344> (ByRef In PricePerKg As Currency) As Currency
    Method test <1610809345> ()
    Method IsPrime <1610809346> (Byval number As Currency) As Integer
    End Interface


    Here's the PBTEST.BAS program,

    #COMPILE EXE
    #INCLUDE "myjlc.inc"

    FUNCTION PBMAIN () AS LONG
    DIM rc AS CURRENCY
    DIM jlcutils AS Int__cMath
    LET jlcutils = GETCOM "$CLSID_myjlc_cMath"
    IF ISOBJECT(jlcutils) AND ISFALSE ERR THEN
    PRINT "Success!"
    rc = jlcutils.PricePerPound(4.54)
    ELSE
    PRINT "Error"
    END IF
    END FUNCTION

    I have read "The Life and Times of an Object" at http://www.powerbasic.com/support/pb...ad.php?t=39898 but I must be missing something very simple.

    Constructive assistance would be appreciated.

    Thanks from Joe

  • #2
    Hi,
    I should mention that the program just prints "Error", and ends.

    Joe

    Comment


    • #3
      If you are going to use the CLSID and not the ProgId use:
      Code:
      LET jlcutils = NEWCOM CLSID $CLSID_myjlc_cMath
      or if you use the ProgID:
      Code:
      LET jlcutils = NEWCOM $PROGID_myjlc_cMathcMath
      And you will want to use NEWCOM, see http://www.powerbasic.com/support/help/pbwin/html/LET_statement_(with_Objects).htm.
      If the requested object is in a DLL (in-process server), you will always use the NEWCOM option, as you're asking for a new object.
      Sincerely,

      Steve Rossell
      PowerBASIC Staff

      Comment


      • #4
        Hi,
        Thanks very much for the quick response.

        Works like a charm.

        Joe

        Comment


        • #5
          And I was so sure the reason it didn't work was because you posted the code without Code Tags.
          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment

          Working...
          X