|
-
Oct 2nd, 2008, 10:30 PM
#1
Thread Starter
Addicted Member
[RESOLVED] [2008] Preventing form from loading unless specific file exists
How can I prevent my form from running unless a specific file is on
the users pc? I need to make sure it's my software and not any exe
with the same name? Perhaps a md5 hash check or something? So far
this is all I have but want to have a better check or prevent the software
from running.
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.FileExists("C:\Program Files\XYZ\xyz.exe") Then
Me.Show()
Else
MsgBox("You Need To Install XYZ To Continue")
Application.Exit()
End If
End Sub
Last edited by cmmorris1; Oct 2nd, 2008 at 10:34 PM.
-
Oct 2nd, 2008, 10:38 PM
#2
Re: [2008] Preventing form from loading unless specific file exists
Handle the Startup event of your application. NOTE: the application, NOT the form. You can then set e.Cancel to True to prevent the application running.
-
Oct 2nd, 2008, 10:41 PM
#3
Thread Starter
Addicted Member
Re: [2008] Preventing form from loading unless specific file exists
Thanks buddy, I was also looking for code that would do a file size check perhaps or what would be the best way for the program to check the file existence? an md5 hash check? I want the main form load event to check for the software and make sure it's not a phony .exe in the location posing as
the real one? How can I be sure?
-
Oct 2nd, 2008, 10:57 PM
#4
Thread Starter
Addicted Member
Re: [2008] Preventing form from loading unless specific file exists
Nevermind. Thanks jmcilhinney for your help, I think this is going to be ok. I think the other type of check is going overboard at this point.
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|