Lotus Notes: Acessando uma dll através do LotusScript: Difference between revisions

From Wiki
(New page: Como fazer para utilizar função que fica em DLL do Windows através do Lotus Notes? Vamos exemplificar com o seguinte código abaixo, que pega o usuário do Windows logado 1) Crie uma ...)
 
No edit summary
 
Line 25: Line 25:


Basta agora chamar a função no seu código
Basta agora chamar a função no seu código
= Ver também =
* [[Lotus Domino e Notes|  Mais artigos sobre IBM Domino e Notes]]
[[Category: IBM Domino]]
[[Category: Lotus Domino]]

Latest revision as of 15:01, 27 February 2014

Como fazer para utilizar função que fica em DLL do Windows através do Lotus Notes?

Vamos exemplificar com o seguinte código abaixo, que pega o usuário do Windows logado

1) Crie uma agente adicione o seguinte em Declarations

'Declarations Script de Auditoria - Inicio
Declare Function win32GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (Byval lpBuffer As String, nSize As Long) As Long 

2) Crie a função getCurrentOSUser

Function getCurrentOSUser As String
  Dim username As String ' receives name of the user
  Dim slength As Long ' length of the string
  Dim retval As Long ' return value
  
  username = Space(255) ' room for 255 characters
  slength = 255 ' initialize the size of the string
  
  retval = win32GetUserName(username, slength) ' slength is now the length of the returned string
  username = Left(username, slength - 1) ' extract the returned info from the buffer
  
  getCurrentOSUser = username
End Function

Basta agora chamar a função no seu código

Ver também