На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

WinExec



The WinExec function runs the specified application.

This function is provided for compatibility with earlier versions of Windows. For Win32-based applications, use the CreateProcess function.

UINT WinExec(

LPCSTR lpCmdLine, // address of command line
UINT uCmdShow // window style for new application
);


Parameters

lpCmdLine

Points to a null-terminated character string that contains the command line (filename plus optional parameters) for the application to be executed. If the name of the executable file in the lpCmdLine parameter does not contain a directory path, Windows searches for the executable file in this sequence:

1. The directory from which the application loaded.
2. The current directory.
3. The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
4. The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
5. The directories listed in the PATH environment variable.



uCmdShow

Specifies how a Windows-based application window is to be shown and is used to supply the wShowWindow member of the STARTUPINFO parameter to the CreateProcess function. For a list of the acceptable values, see the description of the nCmdShow parameter of the ShowWindow function. For a non-Windows - based application, the PIF file, if any, for the application determines the window state.



Return Values

If the function succeeds, the return value is greater than 31.
If the function fails, the return value is one of the following error values:

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.


Remarks

Win32-based applications should use the CreateProcess function rather than this function. The WinExec function exists in Win32 to provide compatibility with earlier versions of Windows. For more information about how the WinExec function is implemented, see the Remarks section of the LoadModule function.
In Win32, the WinExec function returns when the started process calls the GetMessage function or a time-out limit is reached. To avoid waiting for the time out delay, call the GetMessage function as soon as possible in any process started by a call to WinExec.

See Also

CreateProcess, GetMessage, GetSystemDirectory, GetWindowsDirectory, LoadModule, ShowWindow


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

WinExec



Функция WinExec выполняет определенное приложение.

Эта функция предусмотрена для совместимости более ранними версиями Окна. Для базирующихся приложений Win32, используйте функцию CreateProcess.

UINT WinExec(

LPCSTR lpCmdLine, // АДРЕС командного стиля окна линии UINT uCmdShow // для нового приложения
);


Параметры

lpCmdLine

Точки на недействительный расторгнутую символьную строку, что содержит командную линию (filename плюс дополнительные параметры) для приложения, которое нужно выполняться. Если имя выполняемого файла в параметре lpCmdLine не содержит путь директория, Окно ищет выполняемый файл в этой последовательности:

1. Директорий из которого приложение загружалось.
2. Текущий директорий.
3. Системный директорий Окна. Функция GetSystemDirectory извлекает путь этого директория.
4. Директорий Окна. Функция GetWindowsDirectory извлекает путь этого директория.
5. Директории указывались в переменной среды ПУТИ.



uCmdShow

Определяет как прикладное окно базирующегося Окна должно быть показано и использовано, чтобы поставлять член wShowWindow параметра STARTUPINFO в функцию CreateProcess. Для списка приемлемых величин, смотри описание параметра nCmdShow функции ShowWindow. Для не-Окна - основавшее приложение, файл PIF, если имеется в наличии, для приложения определяет состояние окна.



Обратные Величины

Если функция добивается успеха, обратная величина больше, чем 31.
Если функция терпит неудачу, обратная величина - одна из следующих величин ошибки:

Значение Величины
0 Система - из памяти или ресурсов.
ERROR_BAD_FORMAT файл .EXE недействителен (non-Win32 .EXE или ошибка в образе .EXE).
ERROR_FILE_NOT_FOUND определенный файл не был обнаружен.
ERROR_PATH_NOT_FOUND определенный путь не был обнаружен.


Замечания

базирующиеся приложения Win32 должны использовать функцию CreateProcess а не эту функцию. Функция WinExec существует в Win32, чтобы обеспечивать совместимость более ранними версиями Окна. Более подробно о том, как функции WinExec осуществлен, смотри секцию Замечаний функции LoadModule.
В Win32, функциональном возврате WinExec когда начатый процесс называет функцию GetMessage или предел задержки достигнут. Для того, чтобы избегать ждать время задержки, назовите функцию GetMessage как можно скорее в любом процессе начатом вызовом на WinExec.

Смотри Также

CreateProcess, GetMessage, GetSystemDirectory, GetWindowsDirectory, LoadModule, ShowWindow


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz