Função: ExecInDLLOpen
Abre uma determinada DLL - Dynamic-link library (Biblioteca de ligação dinâmica) para executar functions ou procedures.
ExecInDLLOpen ( < cDLLName> ) --> nHandle
Nome | Tipo | Descrição | Obrigatório | Referência |
cDLLName | Caracter | Indica o nome do arquivo da DLL. | X |
nHandle
- (numerico)
- Retorna o handle de abertura da DLL.
A DLL que será manipulada deve estar no mesmo diretório do Smart Client.
DLL de exemplo em Delphi
library DLLProtheus; uses sysutils; {$R *.RES} function ExecInClientDLL( ID: Integer; aPar: PChar; Buf: PChar; nBuf: Integer ): integer; stdcall; begin result := -1; if (ID = 1) then begin StrPCopy(Buf, PChar('Retorno opção 01')); result := 200; end else if (ID = 2)then begin StrPCopy(Buf, PChar('Retorno opção 02')); result := 300; end; end; exports ExecInClientDLL; begin end.
Rotina de exemplo em AdvPL
// Abre Dll hHdl := ExecInDLLOpen( "TSTDLL.DLL" ) // ---------------------------------------------------------------- // Envia comando para execução, repare que estamos // usando a opção "1" no momento de chamar a DLL. // ---------------------------------------------------------------- // ExecInDllRun não retorna valor da DLL buffer:= "Executando a partir da ExecInDllRun..." xRet1 := ExecInDllRun( hHdl, 1, @buffer ) alert("Retorno da ExecInDllRun: " + xRet1) // ExeDllRun2 retorna valor numérico da DLL buffer:= "Executando a partir da ExeDllRun2..." nRet2 := ExeDllRun2( hHdl, 1, @buffer ) alert("Retorno da ExeDllRun2: " + StrZero(nRet2,3)) // ExeDllRun3 retorna valor numérico da DLL buffer:= "Executando a partir da ExeDllRun3..." nRet3 := ExeDllRun3( hHdl, 1, @buffer ) alert("Retorno da ExeDllRun3: " + StrZero(nRet3,3)) // ---------------------------------------------------------------- // Fecha a DLL ExecInDllClose( hHdl )
Exemplo da função ExecInDLLOpen()
Microsiga Protheus 8.11 , TOTVS Application Server 10 , ByYou Application Server
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas