Annuaire

Commande de compilation

Dans le menu Project - References de Visual Basic, il faut importer les déclarations de modules Up ! Kernel et Up ! Object Request Broker en cochant les cases correspondantes.

Commande d'enregistrement des ActiveX

upsvtm Com=Charger

Commande d'exécution

annuaire.exe

Fichiers sources

Dim MUpsKrn As IUpsKrn
Dim MUpsOrb As IUpsOrb
Dim A As IUpsOrbAnnuaire

Private Sub EcrireEcran(ByVal Libelle As String)
' ==============================================
Ecran.AddItem Libelle
End Sub

Private Sub AfficherAnnuaire2(ByVal An As IUpsOrbAnnuaire, ByVal Chemin As IUpsKrnCaractere)
' ==========================================================================================
Dim L As IUpsKrnListe
Dim C As IUpsKrnCaractere

On Error GoTo GestionErreur

Set L = An.LireArborescenceAnnuaire(Chemin)
If Not MUpsKrn.EstNul(L) Then
End If

Exit Sub

GestionErreur:
'=============
EcrireEcran Erreur UpsKrn-0 : L'exception suivante a été envoyée dans le source '" + Err.Source + "' :"
EcrireEcran Err.Description
End Sub

Private Sub AfficherAnnuaire(ByVal An As IUpsKrnAnnuaire)
' =======================================================
On Error GoTo GestionErreur

EcrireEcran MUpsKrn.Caractere2ComBStr(An.NomAnnuaire())
AfficherAnnuaire2 An, MUpsKrn.ComBStr2Caractere(")
EcrireEcran "

Exit Sub

GestionErreur:
'=============
EcrireEcran Erreur UpsKrn-0 : L'exception suivante a été envoyée dans le source '" + Err.Source + "' :"
EcrireEcran Err.Description
End Sub

Private Sub Form_Load()
' =====================
Dim L As IUpsKrnListe
Dim C As IUpsKrnCaractere

On Error GoTo GestionErreur

Set MUpsKrn = CreateObject("UpsApp.UpsKrn")
Set MUpsOrb = CreateObject("UpsApp.UpsOrb")

Set A = MUpsOrb.Annuaire1(MUpsKrn.ComBStr2Caractere("MonAnnuaire"))
A.EcrireEntree MUpsKrn.ComBStr2Caractere("coucou"), MUpsKrn.ComBStr2Caractere("COUCOU")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("hello"), MUpsKrn.ComBStr2Caractere("HELLO")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("guten tag"), MUpsKrn.ComBStr2Caractere("GUTEN TAG")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("coucou.coucou"), MUpsKrn.ComBStr2Caractere("COUCOU.COUCOU")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("hello.coucou"), MUpsKrn.ComBStr2Caractere("HELLO.COUCOU")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("coucou.hello"), MUpsKrn.ComBStr2Caractere("COUCOU.HELLO")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("hello.hello"), MUpsKrn.ComBStr2Caractere("HELLO.HELLO")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("hello.guten tag"), MUpsKrn.ComBStr2Caractere("HELLO.GUTEN TAG")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("coucou.guten tag"), MUpsKrn.ComBStr2Caractere("COUCOU.GUTEN TAG")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("guten tag.coucou"), MUpsKrn.ComBStr2Caractere("GUTEN TAG.COUCOU")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("guten tag.hello"), MUpsKrn.ComBStr2Caractere("GUTEN TAG.HELLO")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("guten tag.guten tag"), MUpsKrn.ComBStr2Caractere("GUTEN TAG.GUTEN TAG")
AfficherAnnuaire A

EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("coucou")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("coucou.coucou")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere(coucou.guten tag")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("coucou.hello")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("hello")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("hello.coucou")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere(hello.guten tag")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("hello.hello")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere(guten tag")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere(guten tag.coucou")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere(guten tag.guten tag")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere(guten tag.hello")))
EcrireEcran "

A.SupprimerEntree MUpsKrn.ComBStr2Caractere("hello.hello"), False
A.SupprimerEntree MUpsKrn.ComBStr2Caractere("guten tag"), True
A.EcrireEntree MUpsKrn.ComBStr2Caractere("hello"), MUpsKrn.ComBStr2Caractere("HELLO !!!")
A.EcrireEntree MUpsKrn.ComBStr2Caractere("coucou.hello"), MUpsKrn.ComBStr2Caractere("COUCOU.HELLO !!!")
A.RenommerEntree MUpsKrn.ComBStr2Caractere("coucou"), MUpsKrn.ComBStr2Caractere("salut"), True
A.RenommerEntree MUpsKrn.ComBStr2Caractere("hello.guten tag"), MUpsKrn.ComBStr2Caractere("good morning.schluss"), False
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("hello")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("salut.hello")))
EcrireEcran MUpsKrn.Caractere2ComBStr(A.LireEntree(MUpsKrn.ComBStr2Caractere("salut")))
EcrireEcran "

AfficherAnnuaire A

MUpsOrb.AnnuaireLocal().EcrireEntree MUpsKrn.ComBStr2Caractere("coucou"), MUpsKrn.ComBStr2Caractere("COUCOU")
MUpsOrb.AnnuaireLocal().EcrireEntree MUpsKrn.ComBStr2Caractere("hello"), MUpsKrn.ComBStr2Caractere("HELLO")
MUpsOrb.AnnuaireLocal().EcrireEntree MUpsKrn.ComBStr2Caractere("guten tag"), MUpsKrn.ComBStr2Caractere("GUTEN TAG")
MUpsOrb.AnnuaireLocal().SupprimerEntree MUpsKrn.ComBStr2Caractere("hello"), False
MUpsOrb.AnnuaireLocal().RenommerEntree MUpsKrn.ComBStr2Caractere("guten tag"), MUpsKrn.ComBStr2Caractere("schluss"), False
AfficherAnnuaire MUpsOrb.AnnuaireLocal()

Set L = MUpsOrb.LireArborescenceAnnuaireGlobal(MUpsKrn.ComBStr2Caractere("))
Set C = L.ParcoursAuDebut(0)
Do Loop

Set A = Nothing
Set L = Nothing
Set MUpsOrb = Nothing
Set MUpsKrn = Nothing
Exit Sub

GestionErreur:
'=============
EcrireEcran Erreur UpsKrn-0 : L'exception suivante a été envoyée dans le source '" + Err.Source + "' :"
EcrireEcran Err.Description
End Sub