home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Planet Source Code Jumbo …e CD Visual Basic 1 to 7
/
6_2008-2009.ISO
/
data
/
zips
/
Homam_Anti21381012252008.psc
/
Appender
/
frmMain.frm
< prev
next >
Wrap
Text File
|
2008-12-17
|
7KB
|
241 lines
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain
BackColor = &H00FFFFFF&
BorderStyle = 3 'Fixed Dialog
Caption = "Homam File Appender"
ClientHeight = 2370
ClientLeft = 45
ClientTop = 435
ClientWidth = 5250
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 178
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2370
ScaleWidth = 5250
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdBrowse
Caption = "..."
Height = 300
Index = 1
Left = 4880
TabIndex = 9
Top = 465
Width = 300
End
Begin VB.CommandButton cmdBrowse
Caption = "..."
Height = 300
Index = 0
Left = 4880
TabIndex = 8
Top = 105
Width = 300
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4800
Top = 1920
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
End
Begin VB.TextBox txtOut
Height = 285
Left = 600
Locked = -1 'True
TabIndex = 7
Text = "Fill both text boxes first"
Top = 1080
Width = 4230
End
Begin VB.TextBox txtFile
Height = 285
Index = 1
Left = 600
TabIndex = 5
Top = 480
Width = 4230
End
Begin VB.TextBox txtFile
Height = 285
Index = 0
Left = 600
TabIndex = 3
Top = 120
Width = 4230
End
Begin VB.CommandButton cmdExit
BackColor = &H80000005&
Cancel = -1 'True
Caption = "Exit"
Height = 375
Left = 1110
TabIndex = 1
Top = 1920
Width = 975
End
Begin VB.CommandButton cmdStart
BackColor = &H80000005&
Caption = "Start"
Default = -1 'True
Enabled = 0 'False
Height = 375
Left = 120
TabIndex = 0
Top = 1920
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Out:"
Height = 255
Left = 120
TabIndex = 6
Top = 1110
Width = 495
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "File2:"
Height = 255
Left = 120
TabIndex = 4
Top = 510
Width = 495
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "File1:"
Height = 255
Left = 120
TabIndex = 2
Top = 150
Width = 495
End
Begin VB.Line Line1
X1 = 0
X2 = 7560
Y1 = 1800
Y2 = 1800
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
' By Homam Babi - 2008
' humam_babi@hotmail.com
'
Option Explicit
Option Base 1
Private Sub cmdBrowse_Click(Index As Integer)
On Local Error Resume Next
CommonDialog1.ShowOpen
If Err Then
Err.Clear
Exit Sub
End If
txtFile(Index) = CommonDialog1.FileName
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub Form_Load()
SetIcon Me.hwnd, "AAA", True
End Sub
Private Sub cmdStart_Click()
If FileExists(txtFile(0).Text) = False Then
MsgBox "Can't find file:" & vbNewLine & txtFile(0).Text
Exit Sub
End If
If FileExists(txtFile(1).Text) = False Then
MsgBox "Can't find file:" & vbNewLine & txtFile(1).Text
Exit Sub
End If
If FileExists(txtOut.Text) = True Then
If MsgBox("will OutFile be overwritten?", vbApplicationModal Or vbDefaultButton2 Or vbQuestion Or vbYesNo) = vbNo Then
Exit Sub
End If
End If
cmdStart.Enabled = False
cmdExit.Enabled = False
txtFile(0).Enabled = False
txtFile(1).Enabled = False
txtOut.Enabled = False
Dim Dat() As Byte
Dim vSize1 As Long
Dim vSize2 As Long
If FileExists(txtOut.Text) = True Then Kill txtOut.Text: DoEvents
Open txtOut.Text For Binary Access Write As #1
vSize1 = FileLen(txtFile(0).Text)
vSize2 = FileLen(txtFile(1).Text)
Put #1, , vSize1
Put #1, , vSize2
Open txtFile(0).Text For Binary Access Read As #2
ReDim Dat(1 To vSize1)
Get #2, , Dat
Close #2
Put #1, , Dat
Open txtFile(1).Text For Binary Access Read As #2
ReDim Dat(1 To vSize2)
Get #2, , Dat
Close #2
Put #1, , Dat
Close #1
MsgBox "Mission accomplished!", vbApplicationModal Or vbInformation Or vbOKOnly
cmdExit.Enabled = True
cmdStart.Enabled = True
txtFile(0).Enabled = True
txtFile(1).Enabled = True
txtOut.Enabled = True
End Sub
Private Sub txtFile_Change(Index As Integer)
If (Len(Trim$(txtFile(0))) > 0) And (Len(Trim$(txtFile(1))) > 0) Then
txtOut.Text = App.Path & IIf(Left$(App.Path, 1) <> "\", "\", "") & "Data.hav"
cmdStart.Enabled = True
Else
txtOut.Text = "Fill both text boxes first"
cmdStart.Enabled = False
End If
End Sub
Private Function FileExists(ByVal strPathName As String) As Boolean
Dim intFileNum As Integer
On Error Resume Next
intFileNum = FreeFile
Open strPathName For Input As intFileNum
FileExists = (Err.Number = 0)
Close intFileNum
Err.Clear
End Function