The LoadModule function loads and executes an application or creates a new instance of an existing application.
This function is provided for compatibility with earlier versions of Windows. Win32-based applications should use the CreateProcess function.
DWORD LoadModule(
LPCSTR lpModuleName, |
// address of filename to load |
LPVOID lpParameterBlock |
// address of parameter block for new module |
); |
Windows NT: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEM32.
The LOADPARMS32 structure has the following form:
typedef struct tagLOADPARMS32 { LPSTR lpEnvAddress; // address of environment strings LPSTR lpCmdLine; // address of command line LPSTR lpCmdShow; // how to show new program DWORD dwReserved; // must be zero } LOADPARMS32;
Member |
Description |
lpEnvAddress |
Points to an array of null-terminated strings that supply the environment strings for the new process. The array has a value of NULL as its last entry. A value of NULL for this parameter causes the new process to start with the same environment as the calling process. |
lpCmdLine |
Points to a Pascal-style string that contains a correctly formed command line. The first byte of the string contains the number of bytes in the string. The remainder of the string contains the command line arguments, excluding the name of the child process. If there are no command line arguments, this parameter must point to a zero length string; it cannot be NULL. |
lpCmdShow |
Points to a structure containing two WORD values. The first value must always be set to two. The second value specifies how the application window is to be shown and is used to supply the wShowWindow member of the STARTUPINFO structure to the CreateProcess function. See the description of the nCmdShow parameter of the ShowWindow function for a list of acceptable values. |
dwReserved |
This parameter is reserved; it must be zero. |
Set all unused members to NULL, except for lpCmdLine, which must point to a null-terminated string if it is not used.
If the function succeeds, the return value is greater than 31.
If the function fails, the return value is an error value, which may be one of the following:
Value |
Meaning |
0 |
The system is out of memory or resources. |
ERROR_BAD_FORMAT |
The .EXE file is invalid (non-Win32 .EXE or error in .EXE image). |
ERROR_FILE_NOT_FOUND |
The specified file was not found. |
ERROR_PATH_NOT_FOUND |
The specified path was not found. |
Win32-based applications should use the CreateProcess function. In the Win32 API, the implementation of the LoadModule function calls CreateProcess. The following section describes how each parameter for CreateProcess is formed:
CreateProcess parameter |
Value |
lpszImageName |
LoadModule lpModuleName parameter. |
lpszCommandLine |
LoadModule lpParameterBlock->lpCmdLine. |
lpsaProcess |
NULL. |
lpsaThread |
NULL. |
fInheritHandles |
FALSE. |
fdwCreate |
0. |
lpvEnvironment |
LoadModule lpParameterBlock->lpEnvAddress. |
lpszCurDir |
NULL. |
lpsiStartInfo |
The structure is initialized to zero. The cb member is set to the size of the structure, and the wShowWindow member is set to the value of the second word of the LoadModule lpParameterBlock->lpCmdShow parameter. |
lppiProcInfo.hProcess |
The handle is immediately closed. |
lppiProcInfo.hThread |
The handle is immediately closed. |
CreateProcess, GetSystemDirectory, GetWindowsDirectory, ShowWindow, STARTUPINFO, WinExec
file: /Techref/os/win/api/win32/func/src/f54.htm, 9KB, , updated: 2000/4/7 12:19, local time: 2024/8/31 19:28,
18.218.231.89:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/techref/os/win/api/win32/func/src/f54.htm"> LoadModule</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
The Backwoods Guide to Computer Lingo |
.