Home > Software engineering >  Turn to help translate this paragraph of vba code into vb6 code, thank you
Turn to help translate this paragraph of vba code into vb6 code, thank you

Time:03-01

Here is a list of modules in vba code, help help convert vb6 code
 
Sub Txt2Jpg (inFileFullName As String, outFileFullName As String)
Dim () As a Byte, (b) the As Byte
Dim As Long, I j As Long
Dim FileNo As Long
FileNo=FreeFile

The Open inFileFullName For Binary As FileNo
ReDim a (LOF FileNo () - 1)
The Get FileNo,,
aThe Close FileNo

ReDim (b (UBound (a) + 1) * 3/4-1)
For I=LBound (a) To UBound (a)
If a (I) & gt;=65 And a (I) & lt; Then=90
A (I)=a (I) - 65
ElseIf a (I) & gt;=97 And a (I) & lt; Then=122
A (I)=a (I) - 71
ElseIf a (I) & gt;=48 And a (I) & lt; 57 Then=
A (I)=a (I) + 4
43 Then ElseIf a (I)=
A (I)=62
47 Then ElseIf a (I)=
A (I)=63
End the If
Next

For I=LBound (a) To UBound (a) Step 4

J=(I/4) * 3
B (j)=a (I) * 4 + a (I + 1) \ 16
B (j + 1)=(a (I + 1) Mod) 16 * 16 + a (I + 2)/4
B (j + 2)=(a (I + 2) Mod 4) * 64 + a (I + 3)
Next

FileNo=FreeFile
The Open outFileFullName For Binary As FileNo
Put FileNo,, b
The Close FileNo
End Sub
Sub Main ()
Dim vFileDLG As FileDialog
Dim vSeled As the Variant
Dim strPath As String
The Set vFileDLG=Application. FileDialog (msoFileDialogFolderPicker)
With vFileDLG
. The Title="Eersoft - select the output file save folder"
Getpath: If the Show=1 Then
StrPath=. SelectedItems. Item (1)
StrPath=strPath & amp; The IIf (Right $(strPath, 1)="", ""," \ ")
The Else
If MsgBox (" deposit output file folders, no need to choose? If you do not select program will exit, ", vbQuestion + vbYesNo, "Eersoft - select the output file storage folder")=vbYes Then
GoTo getpath
The Else
The Exit Sub
End the If
End the If
End With

The Set vFileDLG=Application. FileDialog (msoFileDialogFilePicker)
With vFileDLG
. The Title="Eersoft - select files need to transform"
. Filters. The Add "text", "*.txt
"Getfile: If the Show=1 Then
For Each vSeled In. SelectedItems
Call Txt2Jpg (CStr (vSeled), strPath & amp; GetNameForFullName (CStr (vSeled) & amp; ". JPG ")
Next vSeled
MsgBox "all files already conversion is complete,", vbInformation + vbOKOnly, "Eersoft - conversion completed
"The Else
If MsgBox (" need to convert file, no need to choose? If you do not select program will exit, ", vbQuestion + vbYesNo, "Eersoft - need to convert files")=vbYes Then
GoTo getfile
The Else
The Exit Sub
End the If

End the If
End With
The Set vFileDLG=Nothing
End Sub
The Function getNameForFullName (strPath As String) As String
Dim SRR
SRR=Split (strPath, "")
GetNameForFullName=Split (SRR (UBound (SRR)), ". ") (0)
End the Function
  • Related