Binaire
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
binaire.exe
Fichier source
Dim MUpsKrn As IUpsKrn
Private Sub EcrireEcran(ByVal Libelle As String)
' ==============================================
Ecran.AddItem Libelle
End Sub
Private Sub Form_Load()
' =====================
Dim B As IUpsKrnBinaire
Dim L As Integer
On Error GoTo GestionErreur
Set MUpsKrn = CreateObject("UpsApp.UpsKrn")
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire : âêî"))
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire")).Additionner(MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere(
: âêî")))
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire"))
B.AdditionnerAffecter MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere(" : âêî"))
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire : âêî"))
Set B = B.Soustraire()
Set B = B.Soustraire()
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire : âêî"))
L =
MUpsKrn.Entier2ComInt(B.Longueur())
EcrireEcran FormatNumber(L)
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire : âêî")).Gauche(MUpsKrn.ComInt2Entier(4))
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire : âêî")).Droite(MUpsKrn.ComInt2Entier(4))
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire : âêî")).Milieu(MUpsKrn.ComInt2Entier(4),
MUpsKrn.ComInt2Entier(9))
EcrireEcran MUpsKrn.Caractere2ComBStr(MUpsKrn.Caractere11(B))
L =
MUpsKrn.Entier2ComInt(MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("A")).Unicode(MUpsKrn.ComInt2Entier(0)))
EcrireEcran FormatNumber(L)
Set B = MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere("Binaire"))
B.AdditionnerAffecter MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere(" : âêî"))
If MUpsKrn.Booleen2ComVariantBool(B.Egal(MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere(Binaire
: âêî")))) Then
EcrireEcran "B==Binaire : âêî"
End If
If MUpsKrn.Booleen2ComVariantBool(B.Different(MUpsKrn.Binaire2(MUpsKrn.ComBStr2Caractere(Binaire
: âêî")))) Then
EcrireEcran "B!=Binaire : âêî"
End If
Set B = 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