Amigos...acho que ta quase lá... (primeira etapa).
Porém, na hora de compilar, retornou o seguinte erro:
xHarbour Compiler build 1.0.0 (SimpLex)
Copyright 1999-2007,
http://www.xharbour.org http://www.harbour-project.org/
Compiling 'ECF.PRG' AND generating prepocessed output to 'ECF.ppo'...
ECF.PRG(76) Error E0030 Syntax error: "syntax error at 'CSEPARATOR'"
error
No code generated
Aparentemente um erro de sintaxe CSEPARATOR. Mas não consegui achar. Portanto, segue abaixo o código-fonte, que eu já tinha desenvolvido e com os complementos passados pelo companheiro alaminojunior, com apoio de material do Rochinha
Código: Selecionar todos
Function Main()
#command DEFAULT := [, := ];
=> ;
:= IIF( = NIL, , ) ;
[; := IIF( = NIL, , ) ]
*** CÓDIGO BÁSICO PARA TESTES COM SAT DA SWEDA
*** AUTOR: PAULO FARIAS
REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850
REQUEST HB_CODEPAGE_PTISO
SET DATE BRITISH
SET ESCAPE ON
SET CENTURY ON
SET CURSOR ON
SET DELETE ON
SET WRAP ON
SET EPOCH TO 1954
SETCANCEL(.F.)
cseparator:=""
retorno:=""
h1:=LoadLibrary("sat.dll") // CARREGAMENTO DA DLL SAT.DLL
// precisa checar o valor de h1, para ter certeza de que a DLL foi carregada
cchave_sat:="container" // CHAVE DE ATIVAÇÃO DO SAT
DLLCall(h1,32,"ConsultarStatusOperacional",Random(), CCHAVE_SAT)
// aqui precisa precisa saber o retorno desta função também
// use retorno:= DLLCall(h1,32,"ConsultarStatusOperacional",Random(), CCHAVE_SAT)
// o retorno desta função, é o ponteiro com o endereço das informações que pediu
xRet:= HB_Pointer2String(retorno,1000)// depois dê uma lida a respeito desta função no manual do xHarbour, para entender o 2º parâmetro
*** monta array com informações
xTxt:= StringToArray( trim(xRet), "|" ) // essa é contribuição do Rochinha
if xTxt[2] != '10000' // '10000' seria o retorno com sucesso para este método da SAT.DLL, ATENÇÃO POIS CADA MÉTODO TEM UM RETORNO DIFERENTE PARA SUCESSO NA OPERAÇÃO
@ 10,1 say (xTxt[3] + ' - ' + xTxt[2])
return .F.
endif
if !empty(xTxt[5])
@ 11,1 say (xTxt[5] + ' - ' + xTxt[4])
endif
alert( valtoprg(xTxt) ) // xTxt é uma matriz com as informações pedidas
return .T.
***********************************************************************************************************************
Function Random(nMaximo) // NUMERO RANDOMICO PARA OS COMANDOS
static nRandomico
local nTemporal
nMaximo = if(nMaximo == NIL, 65535, nMaximo)
If nRandomico == NIL
nRandomico = seconds()
Endif
nTemporal = (nRandomico * seconds()) % (nMaximo + 1)
nRandomico = (nTemporal + seconds() )
Return int(nTemporal)
***********************************************************************************************************************
Function StringToArray( cString, cSeparator )
LOCAL nPos, nCount:= 0
LOCAL aString := {}
DEFAULT cSeparator := ";"
cString := ALLTRIM( cString ) + cSeparator
DO WHILE .T.
nPos := AT( cSeparator, cString )
IF nPos = 0
EXIT
ENDIF
AADD( aString, SUBSTR( cString, 1, nPos-1 ) )
cString := SUBSTR( cString, nPos+1 )
nCount ++
if nCount = 5
* hwg_processmessage()
nCount = 0
endif
ENDDO
RETURN ( aString )
***********************************************************************************************************************
Fico no aguardo
Abraços
Paulo
***********************************************************************************************************************