?
Solved

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

Posted on 2003-03-17
3
Medium Priority
?
224 Views
Last Modified: 2013-11-25
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
Comment
Question by:gogetters123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
Fischermaen earned 200 total points
ID: 8150223
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
 

Expert Comment

by:CleanupPing
ID: 8532222
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
 
LVL 6

Expert Comment

by:GPrentice00
ID: 8982945
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question