Página 1 de 1
delphi dll call
Publicado: Vie Ago 24, 2012 3:14 pm
por Roberto
Hi,
I'm using a delphi dll. I can load and call some functions, but when I need to pass a parameter it appear to be wrong. For exemple:
cPath := "C:Temp"
aList := DllCall("filesutil.dll", NIL, "getfiles", cPath)
It should returns an array with file names, but I get a message
like this:
"cPath error: C:Temp☼◄"
I think there is some thing wrong passing paramater. The documentation about DllCall says that it use ANSI char, but I don't know how to send it. I Tried oemtoansi and a lot of other functions but nothing worked.
Any idea?
delphi dll call
Publicado: Vie Ago 24, 2012 5:36 pm
por jfgimenez
Roberto,
> I'm using a delphi dll. I can load and call some functions,
> but when I need to pass a parameter it appear to be wrong.
> For exemple:
>
> cPath := "C:Temp"
> aList := DllCall("filesutil.dll", NIL, "getfiles", cPath)
>
> It should returns an array with file names, but I get a
> message
> like this:
> "cPath error: C:Temp☼◄"
>
> I think there is some thing wrong passing paramater. The
> documentation about DllCall says that it use ANSI char, but
> I don't know how to send it. I Tried oemtoansi and a lot of
> other functions but nothing worked.
I'm not familiarized with this xHarbour's function, since I always write
'wrappers' when executing DLLs functions, but I seriously doubt that
DllCall() can handle an array as a returned value. My advice is to write
a wrapper to do it. In most cases, it's easier, and *always* it's faster
and more accurate than any other way.
If you aren't be able to do it, publish here the prototype and
documentation of that DLL function, and we'll try to help.
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
delphi dll call
Publicado: Vie Ago 24, 2012 9:08 pm
por Roberto
thank you so much, Jose.
Following is what I know about one function. There are more than 100 like this. Some of then works perfectly, some not.
Name: Inicia_SPED
Parent: SPEDFiscal32dll
Visibility: PUBLIC
Description: Inicia_SPED - Esta deve ser sempre a 1ª Função a ser chamada antes de iniciar o uso da Dll
Source code: Function Inicia_SPED ( Dir_Saida , Dir_Entrada : String ) : integer ; stdcall ; export
Parameters
Parameter Description
Dir_Saida : STRING Recebe arquivo do SPED, Log e Erro gerados pela dll contendo os registros devidamente formatados, informaçíµes relativas aos totais de registros gerados e erros encontrados
Dir_Entrada : STRING Contém arquivos CFOP.res, NCM.res, MUNICIPIO.res, PAIS.res contendo a lista valores válidos utilizados durante validação
Return Types Description
INTEGER -1 Erro durante a chamada da função
0 Função OK
Attached files dll.rar (220.8 KB)Â
delphi dll call
Publicado: Vie Ago 24, 2012 10:03 pm
por emeasoft
Roberto:
Não sei se vai te ajudar mas eu pego retorno por referíªncia, conforme
exemplo abaixo:
AFILL(a01,VAL("0"))
nHandle:=LoadLibrary("C:WINDOWSSYSTEM32Bemafi32.DLL")
DllCall(nHandle,DC_CALL_STD,"Bematech_FI_RetornoImpressoraMFD ",@a03[1],@a03[2],@a03[3],@a03[4])
Todavia, já li comentários que DLL compilada com Delphi não funciona corretamente com xHarbour.
Mário Angelini
delphi dll call
Publicado: Sab Ago 25, 2012 1:43 am
por Roberto
Mario,
Grato pela resposta.
Pelo que ja pesquisei deve ter algo a ver com o tipo de dado recebido pela funcao. Ela foi feita em Delphi 6 e o fornecedor nao dã suporte para (x)Harbour, infelizmente. Algumas chamadas funcionam sem problemas, mas esta, que inicia as funcoes para gerar o arquivo do SPED Fiscal, nao funciona nem a pau.
Creio que vou ter que comprar os fontes tambem e corrigir eu mesmo. Ate la vou continuar tentando pois ja vi muito problema cabeludo ser resolvido pelo pessoal do suporte do Xailer.
delphi dll call
Publicado: Lun Ago 27, 2012 10:32 pm
por Roberto
please, help!
here is a fragment of the delphi code:
Function Inicia_SPED(Dir_Saida, Dir_Entrada: String): integer; stdcall; export;
var
i: integer;
begin
result := -1; //Retorna Erro por default
the paramters Dir_Saida and Dir_Entrada "comes" with crazy values! For example it shoud be "E:SPED" but its received value is something like "E:SPED!@@#!@#". I tried passing by reference, value, using oemtoansi, ansitooem... nothing.
HELP!
delphi dll call
Publicado: Mar Ago 28, 2012 11:37 pm
por Roberto
NO HELP!?
delphi dll call
Publicado: Mié Ago 29, 2012 5:00 pm
por ignacio
Roberto escribió el lun, 27 agosto 2012 22:32please, help!
here is a fragment of the delphi code:
Function Inicia_SPED(Dir_Saida, Dir_Entrada: String): integer; stdcall; export;
var
i: integer;
begin
result := -1; //Retorna Erro por default
the paramters Dir_Saida and Dir_Entrada "comes" with crazy values! For example it shoud be "E:SPED" but its received value is something like "E:SPED!@@#!@#". I tried passing by reference, value, using oemtoansi, ansitooem... nothing.
HELP!
XA_FUNC( INICIA_SPED )
{
hb_retnl( Inicia_SPED( hb_parc( 1 ), hb_parc( 2 ) ) );
}
The function Inicia_SPED must be present on a static library.