-
I am making a program for my friend but i dont want him to be able to distribute it, so i wanted to make it so when the program was done running it would delete itself, would i just use the command
Kill Self
?
That seems a little to easy...
Please help.. thanks!
-
use a batch file that delete your program and then delete itself.
Batch file can delete themself.
-
Something like this:
Code:
Open App.Path & "\tempdel.bat" For Output As #1
'Print #1, "@ECHO OFF" 'Turn this on if you want the user to see what your doing
Print #1, "IF EXIST " & """" & App.Path & "\myprog.exe" & """" & " DEL " & """" & App.Path & "\myprog.exe" & """"
Print #1, "Del """ & App.Path & "\tempdel.bat"""
Close #1
Than just Unload your program and Shell the bat file and the bat file will delete your program and then delete itself.
-
How would you unload the program then call the batch file?
I would advise including the "@echo off" bit, that way they don't get to see what's happening and interrupt it. Not like they'd be fast enough anyway though :)
-
Call it in the Unload Event.
Code:
'Private Sub Form_Unload(Cancel...)
Shell "Mybat.bat"
Unload Me
End
'End Sub
-
Hello;
The sugestion of a bat file is very good. But if he makes a copy of the installation disk before he istall it. This will let him install the software in another machine.
Try this:
1. Make the program look for a key file. Make a file that will be used by the system to verify that he is a valid copy.
Example
if dir("your_file")="" then
msgbox "This is a not valid copy"
end
end if
2. Create the key file by your self. Try making the file to be difucult to detect.
If he tries to install the program in another machine it will not work because the key file will not exist in that machine.
adcomp - Puerto Rico
[Edited by adcomp on 12-06-2000 at 07:39 AM]
-
i would put it in the Terminate event,
cuz it's after the Unload event,if you try to delete
in the Unload event, it won't work cuz your program
still running!!