Article ID: 105116
Article Last Modified on 8/30/2004
119591 How to Obtain Microsoft Support Files from Online Services
Declare Function SpawnAndWait& Lib "RUNLIB.DLL" (ByVal parenthwnd%, ByVal lpszOp$, ByVal lpszFile$, ByVal lpszParams$, ByVal lpszDir$, ByVal nShow%) DWORD SpawnAndWait(hwnd, lpszOp, lpszFile, lpszParams, lpszDir, fsShowCmd) HWND hwnd /* Handle of parent window */ LPCSTR lpszOp /* Address of string for operation to perform */ LPCSTR lpszFile /* Address of string for filename */ LPCSTR lpszParams /* Address of string for executable-file parameters */ LPSCTR lpszDir /* Address of string for default directory */ int fsCmdShow /* Whether file is shown when opened */The SpawnAndWait function executes and waits for termination of the specified application or associated file.
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.
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.
DWORD SpawnAndWaitIndirect(lpSpawnWait)
LPSPAWNWAIT lpSpawnWait /* Far reference to SPAWNWAIT structure
typedef struct tagSPAWNWAIT
{
HWND hwnd;
LPCSTR lpszOp;
LPCSTR lpszFile;
LPCSTR lpszParams;
LPCSTR lpszDir;
int fsShowCmd;
LPMSGPROC lpmsgproc;
} SPAWNWAIT;
Member Description
hwnd Handle of parent window
lpszOp Address of string for operation to perform
lpszFile Address of string for filename
lpszParams Address of string for executable-file parameters
lpszDir Address of string for default directory
fsShowCmd Whether file is shown when opened
lpmsgproc Address of application provided MessagePump (must load
DS on entry)
void CALLBACK MessagePump(lpmsg)
LPSMG lpsg /* Long pointer to MSG to process
Message Proc is a place holder for an application-provided callback
function (which must load DS on entry) that will process messages retrieved
in RunLib's PeekMessage loop. It allows the calling application to do
modeless dialog box and accelerator message processing.
void CALLBACK MyMessagePump(LPMSG lpmsg)
{
if(!TranslateMDISysAccel(hClient, lpsmg) &&
!TranslateAccelerator(hFram, hAccel, lpsmg))
{
TranslateMessage(lpsmg);
DispatchMessage(lpmsg);
}
}
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.
Keywords: kb16bitonly kbfile kbsample KB105116