CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 1999
    Location
    Atlanta, GA
    Posts
    2

    Using the Shell command

    I would like to know if anyone has a good example of a program that calls another exe. Once the exe get teminated, how can you check for this so that the program can then call on another program or perform another task. Any help would be appreciated.


  2. #2
    Guest

    Re: Using the Shell command

    This is an example of using Shell to execute Windows Calculator:

    private lngGetCalc as Long 'to work with calculator
    public Sub LoadCalculator()
    Dim lngResult as Long
    ' Check if Calculator is active
    If IsWindow(lngGetCalc) then
    Exit Sub
    else
    lngGetCalc = Shell("calc.exe", 1)
    End If
    lngResult = SetWindowPos&(lngGetCalc, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE)
    End Sub



    Vlad



  3. #3
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Using the Shell command

    just type in
    Shell "c:\windows\notepad.exe", vbNormalFocus



    to run notepad


  4. #4
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Using the Shell command

    Vlad, next time please declare everything, because your code is incomplete , these declarations are missing:

    public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (byval hwnd as Long, byval hWndInsertAfter as Long, byval x as Long, byval y as Long, byval cx as Long, byval cy as Long, byval wFlags as Long) as Long
    public Declare Function IsWindow Lib "user32" Alias "IsWindow" (byval hwnd as Long) as Long






  5. #5
    Guest

    Re: Using the Shell command

    this isan easy one dude, if i understand you right, put in the following code for the forms terminate procedure:
    shell "C:\whatever\whatever.exe", VbNormalFocus
    so that way, when you close your prorgam, it will execute another


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