|  |  | 
Suche Visual-Basic Code| Re: CRC CCITT Algo für VB6 |  |  |  |  | Autor: LonelySuicide666 |  | Datum: 30.12.06 18:16 |  | 
 |  | 'Code der Klasse "CRC16" 
 Option Explicit
 
 Private Declare Function WideCharToMultiByte Lib "kernel32.dll" (ByVal CodePage As Long, ByVal dwFlags As Long, lpWideCharStr As Any, ByVal cchWideChar As Long, lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
 
 Private CRCTbl(255) As Integer, Poly As Integer
 Private bIndirect As Boolean, Init As Integer
 Private Final As Integer, bReverseData As Boolean, bReverseCRC As Boolean
 
 
 Private Sub Class_Initialize()
 Init = &HFFFF
 Poly = &H1021
 Final = &H0
 bReverseData = False
 bReverseCRC = False
 
 ClacCRCTable Poly
 End Sub
 
 
 Public Property Get Polynom() As Integer
 Polynom = Poly
 End Property
 Public Property Let Polynom(ByVal NewPoly As Integer)
 Poly = NewPoly
 End Property
 
 Public Property Get IndirectInit() As Boolean
 IndirectInit = bIndirect
 End Property
 Public Property Let IndirectInit(ByVal bIndirectInit As Boolean)
 bIndirect = bIndirectInit
 End Property
 
 Public Property Get InitValue() As Integer
 InitValue = Init
 End Property
 Public Property Let InitValue(ByVal NewInitValue As Integer)
 Init = NewInitValue
 End Property
 
 Public Property Get FinalValue() As Integer
 FinalValue = Final
 End Property
 Public Property Let FinalValue(ByVal NewFinalValue As Integer)
 Final = NewFinalValue
 End Property
 
 Public Property Get ReverseData() As Boolean
 ReverseData = bReverseData
 End Property
 Public Property Let ReverseData(ByVal bReverseDataValue As Boolean)
 bReverseData = bReverseDataValue
 End Property
 
 Public Property Get ReverseCRC() As Boolean
 ReverseCRC = bReverseCRC
 End Property
 Public Property Let ReverseCRC(ByVal bReverseCRCValue As Boolean)
 bReverseCRC = bReverseCRCValue
 End Property
 
 
 Private Sub ClacCRCTable(ByVal p As Integer)
 Dim I As Integer, HexInt As Integer, j As Byte
 
 Poly = Polynom
 
 For I = 0 To 255
 If I And &H80 Then
 HexInt = ((I And &H7F) * &H100) Or &H8000
 Else
 HexInt = ((I And &H7F) * &H100)
 End If
 
 For j = 1 To 8
 If HexInt And &H8000 Then
 If HexInt And &H4000 Then
 HexInt = ((HexInt And &H3FFF) * 2) Or &H8000
 Else
 HexInt = ((HexInt And &H3FFF) * 2)
 End If
 HexInt = HexInt Xor Polynom
 Else
 If HexInt And &H4000 Then
 HexInt = ((HexInt And &H3FFF) * 2) Or &H8000
 Else
 HexInt = ((HexInt And &H3FFF) * 2)
 End If
 End If
 Next j
 
 CRCTbl(I) = HexInt
 Next I
 End Sub
 
 
 Private Function Reflect(ByVal rIn As Integer, Optional ByVal bReflect As Integer = 16) As Integer
 Dim I As Integer, rOut As Integer, K As Integer
 Dim TmpInt As Integer, j As Integer, HiBit As Integer
 
 j = 1
 HiBit = 2 ^ (bReflect - 1)
 I = HiBit
 
 For K = 0 To bReflect - 1
 If rIn And I Then
 rOut = rOut Or j
 End If
 
 I = I / 2 And Not HiBit
 
 TmpInt = (j And &H3FFF) * 2
 If j And &H4000 Then
 j = TmpInt Or &H8000
 Else
 j = TmpInt
 End If
 Next K
 Reflect = rOut
 End Function
 
 may be the force with you |  |  | 
 |  | Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
 
 
  Einloggen  |  Neu registrieren | 
   |  | 
Neu! sevCoolbar 3.0  
 Professionelle Toolbars im modernen Design!
 
Mit sevCoolbar erstellen Sie in wenigen Minuten ansprechende und moderne Toolbars und passen diese optimal an das Layout Ihrer Anwendung an (inkl. große Symbolbibliothek) - für VB und MS-AccessWeitere InfosTipp des Monats  Oktober 2025 Matthias KozlowskiUmlaute konvertieren
 Ersetzt die Umlaute in einer Zeichenkette durch die entsprechenden Doppelbuchstaben (aus ä wird ae, usw.)Access-Tools Vol.1  
 Über 400 MByte Inhalt
 
Mehr als 250 Access-Beispiele, 25 Add-Ins und ActiveX-Komponenten, 16 VB-Projekt inkl. Source, mehr als 320 Tipps & Tricks für Access und VB
Nur 24,95 EURWeitere Infos | 
|  |  | Copyright ©2000-2025 vb@rchiv Dieter Otter
 Alle Rechte vorbehalten.
 
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.
 Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel
 
 |  |