Árvore de páginas

Versões comparadas

Chave

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

Pagetitle

...

...

ExecInDllOpen
ExecInDllOpen

Abre

...

uma

...

DLL (Dynamic-link

...

library , ou Biblioteca de vinculo dinâmica)

...

para

...

executar

...

functions

...

ou

...

procedures.

Sintaxe

...

Bloco de código
collapsefalse
ExecInDllOpen( < cDLLName > )

Parâmetros

ExecInDLLOpen ( < cDLLName> ) --> nHandle

...

Nome

Tipo

Descrição

Obrigatório

Referência

cDLLName

...

caractere

Indica o nome

...

e caminho da DLL.

X

 

Retorno

Nome

...

Tipo

...

Descrição

nHandle

...

numérico

Retorna o handle de abertura da DLL.

Observações

...

  • Caso não informado o caminho, a aplicação irá procurar a DLL no mesmo diretório do Smart Client.

...

Exemplos

themedelphiDLL de exemplo em DelphiEclipse
return -1;
}
Bloco de código
Eclipse
language
cpp
title
themeEclipse
linenumberstrue
collapsefalse
extern "C" __declspec(dllexport) int
library DLLProtheus; uses sysutils; {$R *.RES} function
 ExecInClientDLL(int ID
:
, 
Integer; aPar: PChar;
char * Buf
:
, 
PChar;
int nBuf
:
, 
Integer
char 
): integer; stdcall; begin result := -1;
* Buf2, int nBuf2)
{
  if
(ID
==
1)
 
then
 
begin
{
    
StrPCopy
strcpy(
Buf, PChar('
Buf2,"Retorno opção 01
')
");
    
result := 200
return 1;
  
}
 
end
 else if (ID == 2)
then begin

  {
    
StrPCopy
strcpy(
Buf
Buf2, 
PChar('
"Retorno opção 02
'
")
)
;
    
result := 300
return 2;
  }
  
end; end; exports ExecInClientDLL; begin end.
Bloco de código
theme
Rotina de exemplo em AdvPL
Bloco de código
languagecpp
title
themeEclipse
linenumberstrue
collapsefalse
User Function Exemplo()

Local hHdl := 0,buffer := "",xRet1 := 0
// 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 )

Return

Preview

...

Image Added

Exemplo da função ExecInDLLOpen()
Image Removed

...

Veja também