"The shell stopped unexpectedly and Explorer.exe was restarted."
Verwijderd
Wegens gebrek aan deplhi een vb versie, *GROOT* nadeel van vb is het totaal ontbreken van bitshift operatoren die juist in dit geval erg handig zijn. maargoed idee is hopelijk duidelijk, t is allemaal verre van optimaal maar het werkt 
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| Private Sub Command1_Click()
Dim strFrats As String
Dim strHex As String
Dim lngI As Long
strFrats = "E8329BFD4697D9EC37"
t = 1
Debug.Print "------------"
While (Len(strFrats) > 0)
strHex = Left$(strFrats, 2)
strFrats = Mid$(strFrats, 3)
lngI = lngI + (CLng("&h" & strHex) * t)
Debug.Print Chr(lngI And 127), lngI And 127
lngI = lngI \ 128
t = t * 2
If t = 512 Then t = 1
Wend
While (lngI <> 0)
Debug.Print Chr(lngI And 127), lngI And 127
lngI = lngI \ 128
Wend
End Sub |
Bedankt man, heb hem gelijk omgezet naar Delphi code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| function GetSMS(SMSHex: String): String;
var
sHex, Hex, Return: String;
x, y: Integer;
begin
Return := '';
sHex := SMSHex;
y := 1;
x := 0;
while (Length(sHex) > 0) do begin
Hex := Copy(sHex, 1, 2);
Delete(sHex, 1, 2);
x := x + StrToInt('$' + Hex) * y;
Return := Return + Chr(x and 127);
x := x div 128;
y := y * 2;
if y = 512 then y := 1;
end;
while (x <> 0) do begin
Return := Return + Chr(x And 127);
x := x div 128;
end;
Result := Return;
end; |
"The shell stopped unexpectedly and Explorer.exe was restarted."
Verwijderd
Overzichterlijker vooral, ik zie liever
dan
In het eerste geval zie je gelijk van oh het boeltje wordt 3 bits naar links opgeschoven, in het geval denk je "waar in de fock is die gast mee bezig!?". En een shift kost minder kloktikken dan 'n vermenigvuldiging maar dat maakt bij het verwerken van sms'jes niet zo heel veel uit..
code:
1
| blaat = blaat shl 3 |
dan
code:
1
| blaat = blaat * 8 |
In het eerste geval zie je gelijk van oh het boeltje wordt 3 bits naar links opgeschoven, in het geval denk je "waar in de fock is die gast mee bezig!?". En een shift kost minder kloktikken dan 'n vermenigvuldiging maar dat maakt bij het verwerken van sms'jes niet zo heel veel uit..
Het werkt niet perfect zie ik nu, doe maar es:
code:
1
| E8329BFD4697D9EC37E8329BFD4697D9EC37E8329BFD4697D9EC37 |
"The shell stopped unexpectedly and Explorer.exe was restarted."
Verwijderd
Whoops.. bugfix.. 
code:
1
2
3
4
5
| If t = 512 Then
Debug.Print Chr(lngI And 127), lngI And 127
t = 1
lngI = 0
End If |
Oke, ik heb een SMS gestuurd naar mezelf met als inhoud:
De bovenstaande functie geeft mij:
In mijn GSM staat nu:Dit is gewoon een test!!!
code:
1
| C4341D949E83CEE5FBFBED0695CB6E10BD3CA7874221 |
De bovenstaande functie geeft mij:
Dit is gew{[(9Y=y'
"The shell stopped unexpectedly and Explorer.exe was restarted."
Verwijderd
code:
1
2
3
4
5
6
| if Y = 128 then begin Y := 1; Return := Return + Chr(X and 127); X := X shr 7; end; |
ipv
code:
1
| if Y = 512 then Y := 1; |
Verwijderd
Deze code is ietsjes netter 
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| Option Explicit
Dim strFrats As String
Dim LngRest As Long
Dim LngRestBits As Long
Private Function GetNext(ByRef s As String) As Boolean
Dim lngI As Long
Dim strHex As String
If LngRestBits < 7 Then
strHex = Left$(strFrats, 2)
strFrats = Mid$(strFrats, 3)
lngI = LngRest + (CLng("&H" & strHex) * (2 ^ LngRestBits))
Else
lngI = LngRest
End If
LngRestBits = (LngRestBits + 1) Mod 8
s = Chr(lngI And 127)
LngRest = lngI \ 128
If Len(strFrats) = 0 And LngRest = 0 Then
GetNext = False
Else
GetNext = True
End If
End Function
Private Sub Command1_Click()
Dim s As String
strFrats = "C4341D949E83CEE5FBFBED0695CB6E10BD3CA7874221"
LngRest = 0
LngRestBits = 0
While (GetNext(s))
Debug.Print s;
Wend
End Sub |
Is er iemand die me kan vertellen of dit ook in Java werkt maar dan andersom?
De code zo niet natuurlijk, is Delphi. Je zult hem moeten vertalen.MisterLeurs schreef op 10 September 2003 @ 19:17:
Is er iemand die me kan vertellen of dit ook in Java werkt maar dan andersom?
"The shell stopped unexpectedly and Explorer.exe was restarted."
Pagina: 1