| View previous topic :: View next topic |
| Author |
Message |
Valvex I post too much
Reputation: 0
Joined: 11 Jun 2007 Posts: 2447 Location: 127.0.0.1
|
Posted: Wed Jan 16, 2008 5:06 pm Post subject: deleting a file |
|
|
this code doesn't seem to work:
| Code: | Private Sub Form_Load()
On Error GoTo error
Kill FilePath$ = ("C:\PROGRAM FILES\KILL.TXT")
Exit Sub
error: MsgBox Err.Description, vbExclamation, "Error"
End Sub |
anybody know whats wrong with it
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Wed Jan 16, 2008 5:36 pm Post subject: |
|
|
| maybe the space in program files?
|
|
| Back to top |
|
 |
Pepsiguy I post too much
Reputation: 0
Joined: 16 Aug 2007 Posts: 2016
|
Posted: Wed Jan 16, 2008 6:47 pm Post subject: |
|
|
I Found a Code Call Kill("File path and name here")
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Jan 16, 2008 11:29 pm Post subject: |
|
|
Firstly, I'd say it's probably because of the way your first line of code is setup:
| Code: | | Kill FilePath$ = ("C:\PROGRAM FILES\KILL.TXT") |
Instead, do it like:
| Code: | Dim FilePath As String
FilePath = "C:\PROGRAM FILES\KILL.TXT
Kill FilePath |
If thats not the case, it could be due to the path having spaces, you can convert it like this though:
| Code: | Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
Public Function GetShortPath(strFileName As String) As String
Dim lngRes As Long
Dim strPath As String
strPath = String$(165, 0)
lngRes = GetShortPathName(strFileName, strPath, 164)
GetShortPath = Left$(strPath, lngRes)
End Function |
You'd use this like:
| Code: | Dim strFilePath As String
strFilePath = GetShortPath("C:\PROGRAM FILES\") & "KILL.TXT" |
And then call the Kill on strFilePath.
_________________
- Retired. |
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Wed Jan 16, 2008 11:58 pm Post subject: |
|
|
Only..
Kill ("C:/****")
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Jan 17, 2008 1:09 am Post subject: |
|
|
| x0r wrote: | Here's a long shot; DeleteFile
It's not like the name or anything in it's description actually indicates that it will delete a file but we can hope! |
Holy shit. What a crazed turn of events!
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Thu Jan 17, 2008 8:02 am Post subject: |
|
|
wtf.. Can it delete system files?
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
Elec0 Expert Cheater
Reputation: 0
Joined: 21 Nov 2007 Posts: 188 Location: Out of my mind, back in five minutes.
|
Posted: Thu Jan 17, 2008 8:45 am Post subject: |
|
|
Like Osiris said, you would only use this:
| Code: |
Call Kill("C:\Windows\*.*")
|
Naablet, I think that you can delete system files, but they can't be in use.
_________________
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Thu Jan 17, 2008 9:19 am Post subject: |
|
|
| Elec0 wrote: | Like Osiris said, you would only use this:
| Code: |
Call Kill("C:\Windows\*.*")
|
Naablet, I think that you can delete system files, but they can't be in use. |
Ok let's do it.
dim ex(2) as string
ex(0)=".exe"
ex(1)=".dll"
Call Kill("C:\Windows\*" & ex() )
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
stealthy17 Expert Cheater
Reputation: 0
Joined: 10 Apr 2007 Posts: 144 Location: The Netherlands
|
Posted: Thu Jan 17, 2008 9:21 am Post subject: |
|
|
I think it's been solved before in this thread namely
You can just use it like
| Code: | Private Sub CommandWhatever_Click()
Kill("C:\whatever path\lols.exe")
End Sub |
As long as the file is not in use it works perfectly fine like this...
|
|
| Back to top |
|
 |
|