Add Bytes
Copy selfCode:Public Sub AddBytes(Path As String, Amount As Long) fsiz = ShowFileSize(Path) Open Path For Binary As #1 For a = 1 To Amount Put #1, fsiz - 1 + a, 0 Next Close End Sub Function ShowFileSize(file) Dim fs, f, s Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile(file) ShowFileSize = f.Size End Function Private Sub Form_Load() Call AddBytes("C:\Test.exe", 500000) End Sub
Find Windows, System, & Temp DirCode:'*needs to be compiled before it copies its self Public Sub CopySelf(Path As String, NewName As String) MyPath = App.Path & "\" & App.EXEName & ".EXE" NewLocation = Path & "\" & NewName On Error Resume Next If LCase(MyPath) <> LCase(NewLocation) Then FileCopy MyPath, NewLocation End If End Sub Private Sub Form_Load() Call CopySelf("C:\", "test.exe") End Sub
Hide App.Code:Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Public Function WindowsPath() As String Dim WindirS As String * 255 Dim TEMP TEMP = GetWindowsDirectory(WindirS, 255) WindowsPath = Left(WindirS, TEMP) End Function Public Function SystemPath() As String Dim WindirS As String * 255 Dim TEMP TEMP = GetSystemDirectory(WindirS, 255) SystemPath = Left(WindirS, TEMP) End Function Public Function TempPath() As String Dim WindirS As String * 255 Dim TEMP TEMP = GetTempPath(255, WindirS) TempPath = Left(WindirS, TEMP) End Function Private Sub Form_Load() MsgBox WindowsPath MsgBox SystemPath MsgBox TempPath End Sub
Code:Me.Hide Me.visible = False App.Title = vbNullString App.TaskVisible = False


LinkBack URL
About LinkBacks
Reply With Quote