Results 1 to 8 of 8

Thread: [RESOLVED] (VB6) ShellExecute - A Problematic thing !!

  1. #1

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Resolved [RESOLVED] (VB6) ShellExecute - A Problematic thing !!

    Hi All,,

    Thing I am doing -
    I need to open a outprocess exe, based on some parameters.
    I did it by using ShellExecute function as bellow -

    ret = ShellExecute(hwnd, "Open", App.Path & "\test.exe", strParameter, vbNullString, SW_SHOWNORMAL)

    the strParameter I passed is the value to text file which is opened from within this Exe.

    Now, as a second step I want to check if the exe is loaded or not.
    and if its loaded then I want to restore the exe back to topmost.

    can I get some help to workaround with this,,,,




    Thanks in advance to all of u.....

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: (VB6) ShellExecute - A Problematic thing !!

    Hai amolt,

    FindWindow()

    Thre is another option which i have never tried.
    GetModuleUsage()

    http://search.msdn.microsoft.com/Def...us&refinement=
    Last edited by Fazi; Sep 5th, 2008 at 01:55 AM.

  3. #3

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Re: (VB6) ShellExecute - A Problematic thing !!

    Hi Fazi,,

    Thanks for reply,,,
    I did it already using FindWindow .. need to work bit more with FindWindow.

    The main problem I had is that my called VB Application have dynamic caption.
    Secondly I am not able to search for called application from class as my calling VB Applications (through called application get open) open windows are also of same class.

    So, for this I Enumerated among all open windows and read each windows title by GetWindowText api, then I done a matching with this title.
    If its found then to go for show application to foreground stuff.

    As searching I read from MSDN that AppActivate method can be used to activate application, the MSDN says that this function can also accept the return value of Shell function as

    MyAppID = Shell("C:\WORD\WINWORD.EXE", 1) ' Run Microsoft Word.
    AppActivate MyAppID ' Activate Microsoft Word.


    I tried with this by passing the return value of ShellExecute function, but nothing happens.
    Could you please tell me that -
    What is the difference between return values of ShellExecute and Shell function ?

    Is the way I am working with right now "FindWindow" is correct or shall I make use of AppActivate too ?


    Regds,

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: (VB6) ShellExecute - A Problematic thing !!

    Do all the title changes or a partial caption remain all the time ?

    YOu can even try with a partial caption
    http://www.vbforums.com/archive/index.php/t-316924.html

  5. #5
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: (VB6) ShellExecute - A Problematic thing !!

    To bring the window to the foreground you can also use the SetForegroundWindow API.


    Has someone helped you? Then you can Rate their helpful post.

  6. #6

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Resolved Re: (VB6) ShellExecute - A Problematic thing !!

    Hi All

    I ll be back after a long time on this issue as engaged in solving other issues, after this one .....

    Need to say that this thing is solved!!!! Hurray !!

    I checked for every window opened and after matching its caption to my parameter .... then if the window to whom I am looking was found just use ShowWindow ... it works!!

    Thanks to all of you!!!

  7. #7

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Question Re: (VB6) ShellExecute - A Problematic thing !!

    Hey I cannot see the Resolved Option to Mark this thread resolved !!!!!!!!

  8. #8
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: (VB6) ShellExecute - A Problematic thing !!

    You can't find the "Mark thread resolved" option in the "Thread tools" menu?


    Has someone helped you? Then you can Rate their helpful post.

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