Ajúda com Declaração - VB / Delphi para FWH (resolvido)

Ajúda com Declaração - VB / Delphi para FWH (resolvido)

Postby MGA » Tue Aug 10, 2010 8:35 pm

Amigos, abaixo segue a mesma declaração em DELPHI e VB, como declarar para FIVEWIN?

Exemplo em DELPHI:

function ScopeGetParam (_TipoParam: LongInt;
_lpParam: PParam_Coleta): LongInt; stdcall;
external scope name 'ScopeGetParam';


PParam_Coleta = ^TParam_Coleta;

TParam_Coleta = packed record
Bandeira,
FormatoDado,
HabTeclas: Word;
MsgOp1,
MsgOp2,
MsgCl1,
MsgCl2: array [1..64] of Char;
WrkKey: array [1..17] of Char;
PosMasterKey: Word;
PAN: array [1..20] of Char;
UsaCriptoPinpad,
IdModoPagto,
AceitaCartaoDigitado: Byte;
Reservado: array [1..105] of Char;
end;

Exemplo em VB:

Declare Function ScopeGetParam Lib "SCOPEAPI.DLL" _
(ByVal Status As Long, _
ByRef Coleta As stColeta) As Long

' Estrutura de coleta
Type stColeta
Bandeira As Integer
FormatoDado As Integer
HabTeclas As Integer
MsgOp1 As String * 64
MsgOp2 As String * 64
MsgCl1 As String * 64
MsgCl2 As String * 64
WrkKey As String * 17
' devido ao alinhamento do VB foi necessario quebrar o campo em dois
PosMasterKey As Byte
Filler As Byte
Reservadoas As String * 128
End Type
Last edited by MGA on Thu Aug 12, 2010 5:06 pm, edited 1 time in total.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Ajúda com Declaração - VB / Delphi para FWH

Postby MGA » Wed Aug 11, 2010 9:32 pm

Ninguem!?
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Ajúda com Declaração - VB / Delphi para FWH

Postby MGA » Thu Aug 12, 2010 5:06 pm

Resolvido assim:

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <hbapiitm.h>
#include <scopeapi.h>
#include <loadlib.h>

typedef dllScopeAPI (WINAPI*SCOPEGETPARAM) (LONG _TipoParam, ptPARAM_COLETA _lpParam);

HB_FUNC(HB_SCOPEGETPARAM)
{
stPARAM_COLETA PColeta;

PHB_ITEM pArrayPlus;

SCOPEGETPARAM pFunc;

memset(&PColeta, 0, sizeof(PColeta)); //zera tudo
pFunc = (SCOPEGETPARAM) GetProcAddress((HINSTANCE)hb_parnl(3), "ScopeGetParam");
hb_retnl(pFunc(hb_parni(1), &PColeta));

pArrayPlus = hb_param(2, HB_IT_ARRAY);
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.Bandeira)); // 1
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.FormatoDado)); // 2
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.HabTeclas)); // 3
hb_arrayAddForward(pArrayPlus, hb_itemPutC(NULL, PColeta.MsgOp1)); // 4
hb_arrayAddForward(pArrayPlus, hb_itemPutC(NULL, PColeta.MsgOp2)); // 5
hb_arrayAddForward(pArrayPlus, hb_itemPutC(NULL, PColeta.MsgCl1)); // 6
hb_arrayAddForward(pArrayPlus, hb_itemPutC(NULL, PColeta.MsgCl2)); // 7
hb_arrayAddForward(pArrayPlus, hb_itemPutC(NULL, PColeta.WrkKey)); // 8
hb_arrayAddForward(pArrayPlus, hb_itemPutCL(NULL, " ", 1)); // 9
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.PosMasterKey)); // 10
hb_arrayAddForward(pArrayPlus, hb_itemPutC(NULL, PColeta.PAN)); // 11
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.UsaCriptoPinpad)); // 12
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.IdModoPagto)); // 13
hb_arrayAddForward(pArrayPlus, hb_itemPutNI(NULL, PColeta.AceitaCartaoDigitado)); // 14
hb_arrayAddForward(pArrayPlus, hb_itemPutCL(NULL, PColeta.Reservado, 105)); // 15

}

#pragma ENDDUMP
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests