Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
Composition Setup
import.css=/download/attachments/3279126062824/newLayouttecnologia.css
Portuguese

Pagetitle

...

Função: ExecInDLLClose

...

ExecInDllClose
ExecInDllClose

Encerra a conexão com uma DLL (Dynamic-link library , ou Biblioteca de vinculo dinâmica).

Sintaxe

ExecInDLLClose ( < nHandle> ) --> Nil

Bloco de código
collapsefalse
ExecInDllClose( < nHandle > )

Parâmetros

...

Nome

Tipo

Descrição

Obrigatório

Referência

nHandle

...

numérico

Indica o handle da DLL obtida através da função ExecInDLLOpen().

X

 

...

Exemplos

Bloco de código
languagecpp
themeEclipse
linenumberstrue
collapsefalse
extern "C" __declspec(dllexport) int ExecInClientDLL(int ID, char * Buf, int nBuf, char * Buf2, int nBuf2)
{
  if(ID==1)
  {
    strcpy(Buf2,"Retorno opção 01");
    return 1;
  }
  else if (ID == 2)
  {
    strcpy(Buf2, "Retorno opção 02");
    return 2;
  }
  return -1;
}
Bloco de código
languagecpp
themeEclipse
linenumberstrue
collapsefalse
User Function Exemplo()

Local hHdl := 0,buffer := "",xRet1 := 0
// Abre Dll
hHdl
Nil (Nulo)
//============================================================// DLL DE EXEMPLO EM DELPHI//============================================================
library TSTDLL;
uses Dialogs;
{$R *.RES}
function ExecInClientDLL(
aFuncID: Integer;
aParams: PChar;
aBuff: PChar;
aBuffSize: Integer ): integer;
stdcall;
begin
if aFuncID=1 then
begin // Roda opção 01
showmessage('Executando pela DLL - Texto via parametro: '+chr(13) + aParams);
result:=999;
end;
if aFuncID=2 then
begin // Roda opção 02
result:=-1;
end;
end;
exports ExecInClientDLL;
beginend.
//============================================================// ROTINA EM AdvPL PARA CHAMADA DA DLL//============================================================
// Abre
DllhHdl
 := 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

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 )

Return

Preview

Image Added

Veja

...

também