Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio Exe Issue, 12 32
link access with Quickbooks 9 56
Create an excel spreadsheet that reads and inserts data 5 63
Problem to file 3 82
This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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