Kirjautuminen

Haku

Tehtävät

Keskustelu: Koodit: VB6: Heksaeditori

moptim [10.12.2006 19:19:45]

#

Simppeli heksaeditori. Tarvitset yhden TextBoxin ja kaksi CommandButtonia. Ja TextBoxin MultiLine pitää olla True.

Form_Load

'Heksaeditori VB:lle
'Made by KingOfTheWorld

Private Sub Form_Load()
  Command1.Move 0, 0, Me.Width / 2, 567
  Command2.Move Me.Width / 2, 0, Me.Width, 567
  Command1.Caption = "Avaa"
  Command2.Caption = "Tallenna"
  Text1.Move 0, 567, Me.Width, Me.Height
  Me.Caption = "Heksaeditori VB:lle, made by KingOfTheWorld"
  Command1_Click
End Sub

Command1_Click

Private Sub Command1_Click()
  Dim Filu As String
  Dim FiluNro As Long
  'avataan
  Text1 = ""
  'tyhjäksi
  Filu = InputBox("Mikä tiedosto?", "Annappa joku filu")
  FiluNro = FreeFile
  Open Filu For Input As #FiluNro
  Do While Not EOF(FiluNro)
    Line Input #FiluNro, rivi
    For i = 1 To Len(rivi)
      Text1 = Text1 & Hex(Asc(Mid(rivi, i, 1))) & " "
    Next i
    rivi = ""
    'varalta
  Loop
  Close #FiluNro
End Sub

Command2_Click

Private Sub Command2_Click()
  'kirjoitetaan
  On Error Resume Next
  Dim Filu As String
  Dim FiluNro As Long
  Dim ASCOhjelma As String
  Dim Pala As Variant
  FiluNro = FreeFile
  Filu = InputBox("Joku tiedosto", "Filu kiitos!")
  Pala = Split(Text1, " ")
  Do
    ASCOhjelma = ASCOhjelma & Chr(Val(Pala(Numero)))
    Numero = Numero + 1
    DoEvents
  Loop Until Err
  Err.Clear
  Open Filu For Output As #FiluNro
  Print #FiluNro, ASCOhjelma
  Close #FiluNro
End Sub

Vastaus

Aihe on jo aika vanha, joten et voi enää vastata siihen.

Tietoa sivustosta