Article ID: 105116 - Last Review: August 30, 2004 - Revision: 3.2 RunWait.exe - DLL Provides Synchronous Spawn FunctionThis article was previously published under Q105116 On This PageSUMMARY
The sample RunWait.exe demonstrates how to use TOOLHELP.DLL to provide a
dynamic-link library (DLL) function that spawns applications and waits for
their termination before returning from the function call. The sample is
compatible with Visual Basic (VB) and Windows 3.0. The sample loads a
hidden task at DLL startup time to own the Toolhelp callback.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center: RunWait.exe (http://download.microsoft.com/download/platformsdk/sample58/3.1/w31/en-us/runwait.exe) For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591
(http://support.microsoft.com/kb/119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
The following is the VB function declaration (this must be on a single line in VB): Parameter Description
hwnd Identifies the parent window. This window receives any message
boxes an application produces (for example, for error
reporting).
lpszOp Points to a null-terminated string specifying the operation to
perform. This string can be "open" or "print". If this parameter
is NULL, "open" is the default value.
lpszFile Points to a null-terminated string specifying the file to
open.
lpszParams Points to a null-terminated string specifying parameters
NULL; "open" is the default value. Passed to the application
when the lpszFile parameter specifies an executable file. If
lpszFile points to a string specifying a document file, this
parameter is NULL.
lpszDir Points to a null-terminated string specifying the default
directory.
fsShowCmd Specifies whether the application window is to be shown when
the application is opened. See ShowWindow for valid values.
Returns
HIWORD == hInstance of started application. Values less than 32 are errors
returned from ShellExecute. 0xFFFF is a general error.
LOWORD == Return code of spawned application. 0xFFFF is a general error.
CommentsThe file specified by the lpszFile parameter can be a document file or an executable file. If it is a document file, this function opens or prints it, depending on the value of the lpszOp parameter. If it is an executable file, this function opens it, even if the string "print" is pointed to by lpszOp.WARNING: This function will not wait on applications such as Word and Excel that respond to the DDE broadcast made by ShellExecute or the second instance of multiple data applications. WARNING: This function supports only one block at a time per task. Calling tasks should not call this function when it has a prior pending SpawnAndWait call. Sample Codelpmsgproc should be set to NULL if it is not used. RunLib will do a default TranslateMessage/DispatchMessage instead. The following is an example of a message processing function for a MDI application: Returns
HIWORD == hInstance of started application. Values less than 32 are errors
returned from ShellExecute. 0xFFFF is a general error.
LOWORD == Return code of spawned application. 0xFFFF is a general
error.
CommentsThe file specified by the lpszFile parameter can be a document file or an executable file. If it is a document file, this function opens or prints it, depending on the value of the lpszOp parameter. If it is an executable file, this function opens it, even if the string "print" is pointed to by lpszOp.WARNING: This function will not wait on applications such as Word and Excel that respond to the DDE broadcast made by ShellExecute or the second instance of multiple data applications. WARNING: This function supports only one block at a time per task. Calling tasks should not call this function when it has a prior pending SpawnAndWait call. APPLIES TO
| Article Translations
|

Back to the top
