|
-
Feb 12th, 2004, 07:45 PM
#1
Thread Starter
Addicted Member
.Exe being executed only by another app *Resolved*
Hey guys!
For example lets say that I have two files: test1.exe and test2.exe.
I would like to make the test2.exe only run if its called by test1.exe...
So, if I click twice in test2.exe nothing will happen... Only if the test1.exe call it using the shellexecute or something similar...
Is there a way to do that?
Thanks in advance,
Elminster
Last edited by Elminster; Feb 13th, 2004 at 04:38 AM.
-
Feb 12th, 2004, 08:13 PM
#2
Not NoteMe
Probably the easiest way would be to have test2.exe only run if it's parameters are a certain 'secret' value.
In text1.exe you'd do something like ShellExecute "text2.exe -password". -password would be accessed using the command$ variable in test2.exe (i *think*).
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Feb 12th, 2004, 10:56 PM
#3
Yeah you could do that quite easily. Create a common txt file that both test1.exe and test2.exe are linked too. Then say test2 was ready to be activated then test1 would write a password or something to the txt file, so that when test2 was clicked it would access that txt file check the password if the password was right then run. Yuo would then have to get test2 to delete the txt file if the password was correct so that you could start over again.
there is a better way but its too good to tell ...lol
-
Feb 12th, 2004, 11:55 PM
#4
test1.exe
Code:
Private Sub Command1_Click()
dim open
Open "c:\password.txt" For Output As #1
Print #1, "password"
Close #1
Shellex "c:\test1.exe"
End Sub
test2.exe
Code:
Private Sub Form_Initialize()
Me.Hide
Open "c:\password.txt" For Input As #1
Input #1, getpassword
Close #1
If getpassword = "password" Then
Form1.Show
Kill "c:\password.txt"
Else
GoTo End1
End If
End1:
End Sub
Last edited by Jmacp; Feb 13th, 2004 at 12:08 AM.
-
Feb 13th, 2004, 04:37 AM
#5
Thread Starter
Addicted Member
Thanks guys!
Thats sounds pretty good!
I would never think in something like this.
Its simple and should work really well!
Really thanks guys!
Elminster
-
Feb 13th, 2004, 05:01 AM
#6
I would go with what SLH suggested. here's the full code:
in test1:
VB Code:
Shell "text2.exe -password".
in startup of test2:
VB Code:
If Trim(Command) <> "-password" Then
'the password is wrong, so dont run
Unload Me '(you only need this line if this is run in a form)
Exit Sub
End If
-
Feb 13th, 2004, 07:25 AM
#7
Thread Starter
Addicted Member
Thanks
Wow, I like that one too... 
I think its more secure. I will try that.
Really thanks,
Elminster
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
|