PowerBASIC and third party ocx dll calls

Started by Andreas Neumann, January 16, 2020, 08:47:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andreas Neumann

Hello,
I'm new to this forum and maybe I'm posting in the wrong folder.

I use PowerBASIC and connecting the code to measurement equipment hardware. This often comes with ocx and dot-net libraries. I attach a bit of code, the inc file was written with the PowerBASIC com browser. Since weeks I struggle with calls to interfaces which are marked by "This Interface cannot be created directly it can only...".

The AI feauture calls work, but not the IAnalogChannel.


I googled a lot but did not find a hint.

Thanks!

----  some lines of CODE --------------------
' Generated by: PowerBASIC COM Browser v.2.00.0087
' Date & Time : 15.01.2020 at 14:54
' Options:
' Always use an Interface Prefix : Off
' Interface Prefix              : Int_
' Prefix ProgIDs, ClassIDs...    : On
' Use ANSI Strings              : Off
' Use Singular Enumerations      : Off
' Generate Dispatch Interfaces  : Off
' Include Parameter Names        : On
' Use Property Get/Set statements: On
' ------------------------------------------------
' Library Name: BDaqOcxLib
' Library File: C:\WINDOWS\SysWow64\BDaqOcx.dll
' Description : Advantech DAQNavi Device ActiveX Controls
' GUID : {1752FF26-D6C9-4BC8-BFE9-7D0CA26DED89}
' LCID : 0
' Version : 1.0

' Version Dependent ProgIDs
$PROGID_BDaqOcxLib_InstantAiCtrl1 = "BDaqOcx.InstantAiCtrl.1"

....
.........  some CODE ........


' Interface Name  : IAiFeatures
' Description    : Interface IAiFeatures
' This Interface cannot be created directly it can only
' be returned by a Method or Property in this library.
INTERFACE IAiFeatures $IID_BDaqOcxLib_IAiFeatures
    INHERIT IDISPATCH

    PROPERTY GET Resolution <1> () AS LONG
    PROPERTY GET DataSize <2> () AS LONG
    PROPERTY GET DataMask <3> () AS LONG
    PROPERTY GET ChannelCountMax <4> () AS LONG
    PROPERTY GET ChannelType <5> () AS LONG
    PROPERTY GET OverallValueRange <6> () AS INTEGER
    PROPERTY GET ValueRanges <7> () AS DWORD
    PROPERTY GET BurnoutDetectSupported <8> () AS INTEGER
    PROPERTY GET BurnoutReturnTypes <9> () AS DWORD
    PROPERTY GET ThermoSupported <10> () AS INTEGER
    PROPERTY GET CjcChannels <11> () AS DWORD
    PROPERTY GET BufferedAiSupported <12> () AS INTEGER
    PROPERTY GET SamplingMethod <13> () AS LONG
    PROPERTY GET ChannelStartBase <14> () AS LONG
    PROPERTY GET ChannelCountBase <15> () AS LONG
    PROPERTY GET ConvertClockSources <16> () AS DWORD
    PROPERTY GET ConvertClockRange <17> () AS MathInterval
    PROPERTY GET BurstScanSupported <18> () AS INTEGER
    PROPERTY GET ScanClockSources <19> () AS DWORD
    PROPERTY GET ScanClockRange <20> () AS MathInterval
    PROPERTY GET ScanCountMax <21> () AS LONG
    PROPERTY GET TriggerSupported <22> () AS INTEGER
    PROPERTY GET TriggerSources <23> () AS DWORD
    PROPERTY GET TriggerActions <24> () AS DWORD
    PROPERTY GET TriggerDelayRange <25> () AS MathInterval
    PROPERTY GET Trigger1Supported <26> () AS INTEGER
    PROPERTY GET Trigger1Sources <27> () AS DWORD
    PROPERTY GET Trigger1Actions <28> () AS DWORD
    PROPERTY GET Trigger1DelayRange <29> () AS MathInterval
END INTERFACE

' Interface Name  : IAnalogChannel
' Description    : Interface IAnalogChannel
' This Interface cannot be created directly it can only
' be returned by a Method or Property in this library.
INTERFACE IAnalogChannel $IID_BDaqOcxLib_IAnalogChannel
    INHERIT IDISPATCH

    PROPERTY GET Channel <1> () AS LONG
    PROPERTY GET ValueRange <2> () AS LONG
    PROPERTY SET ValueRange <2> (BYVAL pVal AS LONG)
END INTERFACE

' Interface Name  : IAnalogInputChannel
' Description    : Interface IAnalogInputChannel
' This Interface cannot be created directly it can only
' be returned by a Method or Property in this library.
INTERFACE IAnalogInputChannel $IID_BDaqOcxLib_IAnalogInputChannel
    INHERIT IDISPATCH

    PROPERTY GET Channel <1> () AS LONG
    PROPERTY GET ValueRange <2> () AS LONG
    PROPERTY SET ValueRange <2> (BYVAL pVal AS LONG)
    PROPERTY GET SignalType <3> () AS LONG
    PROPERTY SET SignalType <3> (BYVAL pVal AS LONG)
    PROPERTY GET BurnoutRetType <4> () AS LONG
    PROPERTY SET BurnoutRetType <4> (BYVAL pVal AS LONG)
    PROPERTY GET BurnoutRetValue <5> () AS DOUBLE
    PROPERTY SET BurnoutRetValue <5> (BYVAL pVal AS DOUBLE)
END INTERFACE


.........

.....

' calling program

' some code...


    GLOBAL myOb  AS IInstantAiCtrl
    GLOBAL AnalogChannel() AS IAnalogInputChannel


'-------------------------------------------------------------------------------------------
CALLBACK FUNCTION Test_Callback () AS LONG
    LOCAL SendText AS ASCIIZ * 1024
    LOCAL Result AS LONG
    LOCAL ic AS LONG
    LOCAL hListBox AS DWORD
    LOCAL i AS LONG

    IF CB.MSG = %WM_COMMAND AND CB.CTLMSG = %BN_CLICKED THEN

    irun=1

    DO
      CONTROL SET TEXT CB.HNDL ,%IDC_dumplabel, "Los"
    ChaNo=1
        ercode= myOb.ReadChannel(0,Datx)
        CONTROL SET TEXT CB.HNDL ,%IDC_Ch0, STR$(Datx)
    END IF
....

END FUNCTION

....

'some code .................

    LET myOb = NEWCOM  $PROGID_BDaqOcxLib_InstantAiCtrl

    devMode1= myOb.ProductId
    ? "Product ID " & STR$(devMode1)


' more code.............
  •  

José Roca

Sorry, but without documentation and examples I can't guess how to use this OCX.
  •  

Theo Gottwald

Andreas, if you can not get it running alone, make a commercial project out of it. We have a new Forum for "Seeking Programmers".
Hire someone. Its possibly a question of some $100 to get working code of this from someone who know.
Make an add in the "Seeking Programmers" Subforum and see ...