Seria algo mais ou menos assim?
Código: Selecionar todos
dados:="c:\sat\xml\venda.xml"
retorno:=DLLCall(h1,32,"EnviarDadosVenda",Random(), CCHAVE_SAT, dados)
Moderador: Moderadores
Código: Selecionar todos
dados:="c:\sat\xml\venda.xml"
retorno:=DLLCall(h1,32,"EnviarDadosVenda",Random(), CCHAVE_SAT, dados)

Na verdade é mais assim:dados:="c:\sat\xml\venda.xml"
retorno:=DLLCall(h1,32,"EnviarDadosVenda",Random(), CCHAVE_SAT, dados)
Código: Selecionar todos
dados := MemoRead( "c:\sat\xml\venda.xml" )
retorno := DLLCall(h1,32,"EnviarDadosVenda",Random(), CCHAVE_SAT, dados)

Caro amiguinho Rochinha !rochinha escreveu:A variável retorno conterá uma string com informações separadas por |

Código: Selecionar todos
xRet:= HB_Pointer2String(retorno,1000)
Código: Selecionar todos
FUNCTION HB_BASE64DECODE( cString )
LOCAL cResult
LOCAL nLen
LOCAL nGroupPos
LOCAL nGroup
LOCAL nCharPos
LOCAL nDataLen
LOCAL nData
/* remove white spaces, If any */
cString := StrTran( cString, Chr( 10 ) )
cString := StrTran( cString, Chr( 13 ) )
cString := StrTran( cString, Chr( 9 ) )
cString := StrTran( cString, " " )
/* The source must consists from groups with Len of 4 chars */
IF ( nLen := Len( cString ) ) % 4 != 0
RETURN "" /* Bad Base64 string */
ENDIF
//#if 0
// IF nLen > Int( MAXSTRINGLENGTH / 1.34 ) /* Base64 is 1/3rd larger than source text. */
// RETURN "" /* Not enough memory to decode */
// ENDIF
//#endif
cResult := ""
/* Now decode each group: */
FOR nGroupPos := 1 TO nLen STEP 4
/* Each data group encodes up To 3 actual bytes */
nDataLen := 3
nGroup := 0
FOR nCharPos := 0 TO 3
/* Convert each character into 6 bits of data, And add it To
an integer For temporary storage. If a character is a '=', there
is one fewer data byte. (There can only be a maximum of 2 '=' In
the whole string.) */
nData := At( SubStr( cString, nGroupPos + nCharPos, 1 ), "=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ) - 2
DO CASE
CASE nData >= 0
/* Do nothing (for speed) */
CASE nData == -1
nData := 0
nDataLen--
CASE nData == -2
RETURN "" /* Bad character In Base64 string */
ENDCASE
nGroup := 64 * nGroup + nData
NEXT
/* Convert the 24 bits to 3 characters
and add nDataLen characters To out string */
cResult += Left( Chr( nGroup / 65536 ) +; /* bitwise AND 255, which is done by Chr() automatically */
Chr( nGroup / 256 ) +; /* bitwise AND 255, which is done by Chr() automatically */
Chr( nGroup ), nDataLen ) /* bitwise AND 255, which is done by Chr() automatically */
NEXT
RETURN cResult

Código: Selecionar todos
// #include "fivewin.ch"
FUNCTION MAIN()
PUBLIC nSec := 0, xmlSAT := ""
PUBLIC ctlSAT := 0, cModelo := "12", cPorta := "COM2"
//RegisterServer( "ctlSAT.ocx" )
//IF Isactivex( "shSAT.ctlSAT" )
ctlSAT := CreateObject( "shSAT.ctlSAT" )
// ----------------------------------
// GERA UM NUMERO DE SESSAO ALEATORIO
nSec := int(hb_Random( 99999 )) // ctlSAT:NumeroSessao()
// ----------------------------------
// ESTE METODO GERA UM XML USANDO UMA
// FUNCÇÃO INTERNA DO OCX CHAMADO DE
// ctlSAT.GeraCFe
// CODE PODE USAR ELE PARA GERAR O SEU
// OU PODE GERAR MANUALMENTE E IR DIRETO
// PARA A FUNÇÃO ENVIAR DADOS VENDA
xmlSAT := GeraXML()
// ----------------------------------
// CHAMA A FUNÇÃO DO COMPONENTE
// ? "xRetorno := ctlSAT:SATEnviarDadosVenda( nSec, xmlSAT )",;
xRetorno := ctlSAT:SATEnviarDadosVenda( nSec, xmlSAT )
// ----------------------------------
// USE ESTA FUNÇÃO PARA INTERPRETAR O ULTIMO BUFFER (RESPOSTA) RECEBIDA PELO COMPONENTE
? "numeroSessao=" + ctlSAT:SplitBufferItem(0),;
"EEEEE=" + ctlSAT:SplitBufferItem(1),;
"CCCC=" + ctlSAT:SplitBufferItem(2),;
"mensagem=" + ctlSAT:SplitBufferItem(3)
? xChave:Text := ctlSAT:SplitBufferItem(8)
//ENDIF
return nil
FUNCTION ConsultarSAT()
LOCAL nSec := 0
// ----------------------------------
// GERA UM NUMERO DE SESSAO ALEATORIO
nSec = ctlSAT:NumeroSessao
// ----------------------------------
// CHAMA A FUNÇÃO DO COMPONENTE
xRetorno:Text := ctlSAT:SATConsultarSAT(nSec)
// ----------------------------------
// USE ESTA FUNÇÃO PARA INTERPRETAR O ULTIMO BUFFER (RESPOSTA) RECEBIDA PELO COMPONENTE
? "numeroSessao=" + ctlSAT:SplitBufferItem(0),;
"EEEEE=" + ctlSAT:SplitBufferItem(1),;
"mensagem=" + ctlSAT:SplitBufferItem(2)
RETURN xRetorno:Text
FUNCTION geraXML()
RETURN MemoRead( "CFeTeste.xml" )
Código: Selecionar todos
Windows Registry Editor Version 5.00
;================================================
; \\\\\\\\\\\\\\ Context Menus //////////////
;================================================
;------------------------------------------------------------------------------------------------------------
;Add register / unregister to the context menu for .dll files
[HKEY_CLASSES_ROOT\.dll]
;"Content Type"="application/x-msdownload"
@="dllfile"
[HKEY_CLASSES_ROOT\dllfile]
@="Application Extension"
@="DLL"
[HKEY_CLASSES_ROOT\dllfile\Shell\Registra\command]
@="regsvr32.exe /s \"%1\""
[HKEY_CLASSES_ROOT\dllfile\Shell\DeRegistra\command]
@="regsvr32.exe /u \"%1\""
;------------------------------------------------------------------------------------------------------------
;Add register / unregister to the context menu for .ocx files
[HKEY_CLASSES_ROOT\.ocx]
@="ocxfile"
[HKEY_CLASSES_ROOT\ocxfile]
@="OCX"
[HKEY_CLASSES_ROOT\ocxfile\Shell\Registra\command]
@="regsvr32.exe /s \"%1\""
[HKEY_CLASSES_ROOT\ocxfile\Shell\DeRegistra\command]
@="regsvr32.exe /u \"%1\""



...entre no prompt do DOS como administrador e execute o registro: %windir%\system32\regsvr32 cltSAT.ocx...
Código: Selecionar todos
dados := MemoRead( "c:\proemp\xml\sat\sat"+minio+".xml" )
retorno := DLLCall(h1,32,"EnviarDadosVenda",Random(), CCHAVE_SAT, dados)
xRet:= HB_Pointer2String(retorno,1000)
xTxt:= StringToArray( trim(xRet), "|" )
If xTxt[2] != '10000'
// '10000' RESPOSTA COM SUCESSO
@ 1,1 Say (xTxt[3] + ' - ' + xTxt[2])
return .F.
Else
@ 1,1 Say (xTxt[3] + ' - ' + xTxt[2])
return .F.
Endif
if !empty(xTxt[5])
@ 1,1 Say (xTxt[5] + ' - ' + xTxt[4])
Endif
// MATRIZ COM INFORMACOES PERDIDAS
@ 1,1 Say valtoprg(xTxt)
Return .T.
