Liste
Commande de compilation
Dans le menu Project - References de Visual Basic,
il faut importer les déclarations du module Up ! Kernel en
cochant la case correspondante.
Commande d'enregistrement des ActiveX
upsvtm Com=Charger
Commande d'exécution
liste.exe
Fichier source
Const ClonageObjetSeul As Integer = 1
Const ClonageObjetsDirects As Integer = 2
Const ClonageRecursif As Integer = 3
Dim MUpsKrn As IUpsKrn
Private Sub EcrireEcran(ByVal Libelle As String)
' ==============================================
Ecran.AddItem Libelle
End Sub
Private Sub EcrireListe(ByVal M As IUpsKrnCaractere, ByVal
L As IUpsKrnListe)
' ===========================================================================
Dim C As IUpsKrnCaractere
On Error GoTo GestionErreur
EcrireEcran MUpsKrn.Caractere2ComBStr(M)
Set C = L.ParcoursAuDebut(0)
Do
EcrireEcran MUpsKrn.Caractere2ComBStr(C)
If C.Identique(L.DernierElement()) Then
End If
Set C = L.Suivant(0)
Loop
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 EcrireListeInverse(ByVal M As IUpsKrnCaractere,
ByVal L As IUpsKrnListe)
'
==================================================================================
Dim C As IUpsKrnCaractere
Dim I As Integer
On Error GoTo GestionErreur
EcrireEcran MUpsKrn.Caractere2ComBStr(M)
I = L.AllouerIterateur
Set C = L.ParcoursALaFin(I)
Do
EcrireEcran MUpsKrn.Caractere2ComBStr(L.Element(I))
If C.Identique(L.PremierElement()) Then
End If
Set C = L.Precedent(I)
Loop
L.LibererIterateur I
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 L2 As IUpsKrnListe
Dim A As IUpsKrnCaractere
Dim B As IUpsKrnCaractere
Dim C As IUpsKrnCaractere
Dim D As IUpsKrnCaractere
Dim E As IUpsKrnCaractere
Dim F As IUpsKrnCaractere
Dim G As IUpsKrnCaractere
Dim H As IUpsKrnCaractere
On Error GoTo GestionErreur
Set MUpsKrn = CreateObject("UpsApp.UpsKrn")
Set L = MUpsKrn.Liste1(MUpsKrn.Caractere, MUpsKrn.ComBStr2Caractere("A"))
Set L = L.Additionner(MUpsKrn.ComBStr2Caractere("B"))
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("C")
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("D")
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("E")
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("F")
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("G")
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("H")
L.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("I")
EcrireListe MUpsKrn.ComBStr2Caractere("Suivant()"), L
EcrireListeInverse MUpsKrn.ComBStr2Caractere("Precedent()"), L
EcrireListe MUpsKrn.ComBStr2Caractere("-()"), L.Soustraire()
EcrireListe MUpsKrn.ComBStr2Caractere("Gauche(3)"),
L.Cloner(MUpsKrn.ObjetNul, ClonageObjetSeul).Gauche(MUpsKrn.ComInt2Entier(3))
EcrireListe MUpsKrn.ComBStr2Caractere("Droite(3)"),
L.Cloner(MUpsKrn.ObjetNul, ClonageObjetSeul).Droite(MUpsKrn.ComInt2Entier(3))
EcrireListe MUpsKrn.ComBStr2Caractere("Milieu(2,3)"),
L.Cloner(MUpsKrn.ObjetNul, ClonageObjetSeul).Milieu(MUpsKrn.ComInt2Entier(2),
MUpsKrn.ComInt2Entier(3))
Set C = MUpsKrn.ComBStr2Caractere("a")
Set L2 = MUpsKrn.Liste1(MUpsKrn.Caractere, C)
L2.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("b")
L2.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("c")
L2.AdditionnerAffecter C
L2.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("b")
L2.AdditionnerAffecter MUpsKrn.ComBStr2Caractere("c")
EcrireListe MUpsKrn.ComBStr2Caractere("Inserer(2)"),
L.Cloner(MUpsKrn.ObjetNul, ClonageObjetSeul).Inserer(L2,
MUpsKrn.ComInt2Entier(2))
EcrireEcran "Compter(0)"
EcrireEcran Str$(MUpsKrn.Entier2ComInt(L2.Compter(C,
MUpsKrn.ComInt2Entier(0))))
EcrireEcran "
EcrireEcran "Compter(1)"
EcrireEcran Str$(MUpsKrn.Entier2ComInt(L2.Compter(C,
MUpsKrn.ComInt2Entier(2))))
EcrireEcran "
EcrireListe MUpsKrn.ComBStr2Caractere("Remplacer(0)"),
L2.RemplacerTous(C, MUpsKrn.ComBStr2Caractere("x"),
MUpsKrn.ComInt2Entier(0))
EcrireListe MUpsKrn.ComBStr2Caractere("Remplacer(1)"),
L2.RemplacerTous(C, MUpsKrn.ComBStr2Caractere("x"),
MUpsKrn.ComInt2Entier(1))
EcrireEcran "Rechercher(0)"
EcrireEcran Str$(MUpsKrn.Entier2ComInt(L2.Rechercher(C,
MUpsKrn.ComInt2Entier(0))))
EcrireEcran "
EcrireEcran "Rechercher(1)"
EcrireEcran Str$(MUpsKrn.Entier2ComInt(L2.Rechercher(C,
MUpsKrn.ComInt2Entier(1))))
EcrireEcran "
EcrireListe MUpsKrn.ComBStr2Caractere("Supprimer(0)"),
L2.SupprimerTous(C, MUpsKrn.ComInt2Entier(0))
EcrireListe MUpsKrn.ComBStr2Caractere("Supprimer(1)"),
L2.SupprimerTous(C, MUpsKrn.ComInt2Entier(1))
EcrireEcran "L[0]"
EcrireEcran MUpsKrn.Caractere2ComBStr(L.Index(MUpsKrn.ComInt2Entier(0)))
EcrireEcran "L[2]"
EcrireEcran MUpsKrn.Caractere2ComBStr(L.Index(MUpsKrn.ComInt2Entier(2)))
EcrireEcran "PremierElement()"
EcrireEcran MUpsKrn.Caractere2ComBStr(L.PremierElement())
EcrireEcran "DernierElement()"
EcrireEcran MUpsKrn.Caractere2ComBStr(L.DernierElement())
EcrireEcran "NumeroElement()"
EcrireEcran Str$(MUpsKrn.Entier2ComInt(L.NumeroElement(0)))
EcrireListe MUpsKrn.ComBStr2Caractere("AjouterAuDebut()"),
L.AjouterAuDebut(MUpsKrn.ComBStr2Caractere("X"))
EcrireListe MUpsKrn.ComBStr2Caractere("AjouterALaFin()"),
L.AjouterALaFin(MUpsKrn.ComBStr2Caractere("Y"))
Set A = MUpsKrn.ComBStr2Caractere("A")
Set B = MUpsKrn.ComBStr2Caractere("B")
Set C = MUpsKrn.ComBStr2Caractere("C")
Set D = MUpsKrn.ComBStr2Caractere("D")
Set E = MUpsKrn.ComBStr2Caractere("E")
Set F = MUpsKrn.ComBStr2Caractere("F")
Set G = MUpsKrn.ComBStr2Caractere("G")
Set H = MUpsKrn.ComBStr2Caractere("H")
Set L = MUpsKrn.Liste1(MUpsKrn.Caractere, A)
L.AdditionnerAffecter B
L.AdditionnerAffecter C
L.AdditionnerAffecter D
L.AdditionnerAffecter E
L.AdditionnerAffecter F
Set L2 = MUpsKrn.Liste1(MUpsKrn.Caractere, A)
L2.AdditionnerAffecter B
L2.AdditionnerAffecter D
L2.AdditionnerAffecter F
L2.AdditionnerAffecter G
L2.AdditionnerAffecter H
EcrireListe MUpsKrn.ComBStr2Caractere("Union()"), L.Union(L2)
EcrireListe MUpsKrn.ComBStr2Caractere("Intersection()"),
L.Intersection(L2)
EcrireListe MUpsKrn.ComBStr2Caractere("Soustraction()"),
L.Soustraction(L2)
EcrireListe MUpsKrn.ComBStr2Caractere("Exclusion()"), L.Exclusion(L2)
Set L = Nothing
Set L2 = Nothing
Set A = Nothing
Set B = Nothing
Set C = Nothing
Set D = Nothing
Set E = Nothing
Set F = Nothing
Set G = Nothing
Set H = 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