Estou tentando tentando fazer a leitura de peso de uma balança Elgin DP-3000 plus, mas sem sucesso, tem os exemplos em vb e delphi mas não consegui converte-los.
Código: Selecionar todos
#include <hmg.ch>
#include "hbdyn.ch"
Function Main
Load Window Main
Main.Center
Main.Activate
Return
********************************************************************************
Function le
Local hDLL, retorno, strValor, strPorta, strBaud, iRetorno
strValor := Space(5)
strPorta := "COM2"
strBaud := "9600"
hDLL := hb_LibLoad("elgin.dll")
retorno := hb_dynCall( { "Elgin_leBalanca", hDLL, HB_DYN_CALLCONV_STDCALL}, strPorta, strBaud, strValor)
MsgBox(retorno)
hb_LibFree(hDLL)
Return
********************************************************************************Código: Selecionar todos
Exemplo em Visual Basic
Dim strPorta as String
Dim strBaud as String
Dim strValor as String
Dim iRetorno as Integer
strValor = Space(5)
strPorta = "COM2"
strBaud = "9600"
iRetorno = Elgin_LeBalanca( strPorta, strBaud, strValor )Código: Selecionar todos
// Exemplo em Delphi
var
strPorta, strBaud, strValor: String;
iRetorno: Integer;
begin
strValor := StringofChar(' ', 5);
strPorta := 'COM2';
strBaud := '9600';
iRetorno := Elgin_LeBalanca( strPorta, strBaud, strValor );
end;
