par Michael DELIQUE » 07 Août 2009 à 08:58
Tu veux sans doute parler d'un truc comme ça
- Code : Tout sélectionner
Function AgentUNID_API(wAgent As NotesAgent) As String
'récupere l'ID de l'agent passé en parametre
Dim DBCible As NotesDatabase
Const NOTE_CLASS_FILTER = &H0200
Dim Space1024 As String
Dim nbHandleDB As Long
Dim nbAgentID As Long
Dim nbPseudo As Integer
Dim ti As String
Dim NameAgent As String
%REM
Declare Private Function NIFFindDesignNote Lib "NNOTES" Alias "NIFFindDesignNote" ( Byval hDB As Long, Byval S As String, Byval C As Integer, N As Long) As Integer
Declare Private Function NSFDbClose Lib "NNOTES" Alias "NSFDbClose" ( Byval DbHandle As Long) As Integer
Declare Private Function OSPathNetConstruct Lib "NNOTES" Alias "OSPathNetConstruct" ( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer
Declare Private Function NSFDbOpen Lib "NNOTES" Alias "NSFDbOpen" ( Byval PathName As String, DbHandle As Long) As Integer
%END REM
On Error Goto ErreurHandle
AgentUNID_API = ""
If wAgent Is Nothing Then
Error 9999,"wAgent is Nothing"
Exit Function
End If
Set DBCible = wAgent.Parent
Space1024 = Space(1024)
OSPathNetConstruct 0, DBCible.Server, DBCible.FilePath, Space1024
NSFDbOpen Space1024, nbHandleDB
If nbHandleDB = 0 Then
Error 9999, "Can not open Database : " +DBCible.FilePath
End If
Set DBCible = Nothing
NameAgent = Trim(Cstr(wAgent.Name))
nbPseudo = Instr(NameAgent, "|")
If nbPseudo > 0 Then
NameAgent = Trim$(Left$(NameAgent, nbPseudo - 1))
End If
NIFFindDesignNote nbHandleDB, NameAgent, NOTE_CLASS_FILTER, nbAgentID
If nbAgentID = 0 Then
Error 9999, "Can not find Agent : " + NameAgent
End If
NSFDbClose nbHandleDB
AgentUNID_API =Hex$(nbAgentID)
Exit Function
ErreurHandle:
Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
Set DBCible = Nothing
If nbHandleDB > 0 Then
NSFDbClose nbHandleDB
End If
AgentUNID_API = ""
Exit Function
End Function
Cordialement
Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN