• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Visual basic program upon close kills its child program that was started using ShellExecute

I have created a visual basic program that requires me to openup a URL
in a browser. And as soon as the browser is opened, my program should
close.

I have used shellexecute() command for it. This shellexecute is being
invoked in a timer Sub. In order to make sure that the processor has
enough time to complete the shellexecute before it runs rest of the
code and closes the parent program, I have put in wait.

However, for some reason, when my visual basic program closes, IT
KILLS THE BROWSER WINDOW AS WELL!!!!

This is a very critical project for me and request an immediate
response from whosoever can help.

Thanks in advance for your help. Please email me at
sanjog_aul@yahoo.com

Sanjog


P.S. The command used is as follows:

Dim hWndDeskTop As Long
            Dim lRetval As Long
           
            hWndDeskTop = GetDesktopWindow()
            lRetval = ShellExecute(hWndDeskTop, "Open", gstrSSPath &
"\Homepage.htm", "", vbNullString, vbNormalFocus)
0
gogetters123
Asked:
gogetters123
1 Solution
 
FischermaenCommented:
Hi gogetters,

I think the problem is the desktop hwnd. Try following code-snippet. It works fine on my windows XP:

Call ShellExecute(0, _
                  "Open", _
                  gstrSSPath & "\Homepage.htm", _
                  vbNullString, _
                  vbNullString, _
                  0)
End

I have put this code in the Form_Load-Event - so my window opens the browser and immedeatly closes itself.

good luck

Andy
0
 
CleanupPingCommented:
Hi gogetters123,
This old question (QID 20553106) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept Fischermaen's as Answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GPrentice00
Cleanup Volunteer
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now