Solved

How to pause and underlying process while using ShellExecute to launch a URL from VB 5

Posted on 1998-09-28
4
364 Views
Last Modified: 2013-12-03
I am trying to Shell to a specific URL with my default browser using ShellExecute from VB, however, I want to pause my VB processing until the Shelled browser process is complete.  From ShellExecute I can't seem to find anything to allow me to wait for the new process to complete before executing the rest of the VB procedure.  I was looking into ShellExecuteEx but am unsure of the VB declaration of the API and the ShellExecuteInfo structure?
0
Comment
Question by:peteyy
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 80 total points
ID: 1414869
Use ShellExecuteEx() instead.  When it returns you willl have a handle to the process that your started in the hProcess member of  SHELLEXECUTEINFO structure you passed to tshellExecuteEx().  use this handle in WaitForSingleObject().  The wait function will wait until the process finishes and terminates or until the time period you specify elapses (use an infinite wait time if you always want to wait for the process to finish.)
0
 
LVL 22

Expert Comment

by:nietod
ID: 1414870
Let me know if you have questions.
0
 

Author Comment

by:peteyy
ID: 1414871
Thanks for the information, it's very helpful, I just have one quick addition.  I've found structure definition for ShellexecuteInfo in C++, I was wondering what would be the conversion of the Structure to a Type declaration in VB 5.  Thanks again in advance

peteyy
0
 
LVL 22

Expert Comment

by:nietod
ID: 1414872
Doesn't VB include it somehow?

I don't know VB, but I can explain the C++ side and you can translate it to VB (I hope).
The  DWORD types (cbSize and dwHotKey) are 32 bit integers.
The ULONG type (fMask) is a 32 bit unsigned integer.
The HWND is a window handle (32 bit pointer)
The LPCSTR types are 32 bit pointers to character (byte) arrays.  The arrays are terminated with a NUL, that is 0, byte.  VB does not use strings like this, but It must have options for producing them.  This is the same type of strign that is passed to other windows API functions.
The int (hShow) is a 32 bit signed integer.
The LPVOID is a 32 bit pointer.
The HKEY is a handle to a registry key.
The HANDLE is a generic handle (32 bit pointer).

I hope that helps.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now