Consultor Eletrônico



Kbase P151610: 4GL/ABL: How to pass a Visual Basic BYTE data type to an OCX method using 4GL/ABL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   9/2/2009
Status: Unverified

GOAL:

4GL/ABL: How to pass a Visual Basic BYTE data type to an OCX method using 4GL/ABL?

GOAL:

How to translate the following Visual Basic code to 4GL/ABL code?
Private Sub Command2_Click()
Dim varB(0) As Byte
varB(0) = 0
bResult = AdvDIO1.WriteDoPorts(varB, 0, 1)
End Sub

GOAL:

How to invoke the following WriteDoPorts() method that has the following Progress Com Object Viewer exposed syntax?

[ Logical-Var = ] <com-handle>: WriteDoPorts (
INPUT-OUTPUT <anytype>-pBuffer BY-VARIANT-POINTER,
Integer-portStart,
Integer-portCount ).

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)

FIX:

Use a RAW data type variable for the first parameter of the WriteDoPorts() method (i.e. the Visual Basic BYTE data type ). For example:
DEFINE VAR mm AS RAW.
LENGTH(mm) = 1.
PUT-BYTE(mm, 1) = 0.
comHdl:WriteDoPorts(mm, 0, 1).