Solved

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

Posted on 1998-09-28
4
371 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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 …

777 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