Results 1 to 7 of 7

Thread: .Exe being executed only by another app *Resolved*

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    251

    .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.

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    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.


  3. #3
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    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

  4. #4
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    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.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    251

    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

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    I would go with what SLH suggested. here's the full code:

    in test1:
    VB Code:
    1. Shell "text2.exe -password".

    in startup of test2:
    VB Code:
    1. If Trim(Command) <> "-password" Then
    2.   'the password is wrong, so dont run
    3.   Unload Me       '(you only need this line if this is run in a form)
    4.   Exit Sub
    5. End If

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    251

    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
  •  



Click Here to Expand Forum to Full Width