Solved

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

Posted on 1998-09-28
4
357 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
Comment Utility
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
Comment Utility
Let me know if you have questions.
0
 

Author Comment

by:peteyy
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

6 Experts available now in Live!

Get 1:1 Help Now