CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: question

  1. #1
    Join Date
    Jul 2001
    Posts
    430

    question

    In ABC program, I use 'shell' to run b.exe program. How to close the program b.exe in ABC program. thanks


  2. #2
    Join Date
    Jul 1999
    Posts
    84

    Re: question

    Use the kill option in the shell statement
    Shell(path of b.exe -kill)

    Thanks
    Harini

  3. #3
    Join Date
    Oct 1999
    Posts
    191

    Re: question

    thanks

    but It didn't work. Maybe my code is not correct.

    Dim RetVal
    RetVal = Shell("C:\temp.exe" - Kill)

    Please tell me what was wrong. thanks




  4. #4
    Join Date
    Jul 1999
    Posts
    84

    Re: question

    Hello,

    Give it as Shell("C:\Temp.exe -kill")

    Thanks
    Harini

  5. #5
    Join Date
    Jun 2001
    Location
    Memphis, TN
    Posts
    146

    Re: question

    This is easy and will work if it is a typical Windows app that you are trying to close.


    retval = Shell("notepad.exe", 1)
    SendKeys "%{F4}"








  6. #6
    Join Date
    Jul 2001
    Posts
    430

    Re: question

    thanks.

    It still didn't work. Instead of closing the .exe file, it opened another one.

    my os: windows 98
    version: vb 6

    I don't know why.


  7. #7
    Join Date
    Jul 1999
    Posts
    84

    Re: question

    Hello,

    Try writing the path of the string along with the kill option into a string and then pass it to shell

    dim strPath as string

    strPath="C:\temp.exe" + " -kill"
    result=shell(strpath)





    Thanks
    Harini

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

Featured