Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1998-09-28
4
Medium Priority
?
412 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 320 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

926 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