Отправляет email-рассылки с помощью сервиса Sendsay

Программирование. Форум !!!

Запуск с параметром коммандной строки

Hello comp,

Не могу запустить приложение c параметрами в коммандной строке. Делаю следующее:

ShellExecute(0, NULL, path+"app.exe", path+"app.exe H___H", NULL, SW_SHOWNORMAL);
Но приложение как будто вовсе не запускается, хотя если 4-й параметр сделать
NULL, то запускается.
Такой вот заморочь.

Ответить   Fri, 8 Sep 2006 00:44:54 +0400 (#588039)

 

Ответы:

Здравствуйте, Safonov Denis!

Прототип функции (из MSDN):
HINSTANCE ShellExecute(HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd);
Вызов, имхо, должен быть таким:
ShellExecute(NULL, NULL, path+"app.exe", "H___H", path, SW_SHOWNORMAL);

And remember - respect is everything.
AleX.

Ответить   Fri, 8 Sep 2006 08:50:23 +0400 (#588099)

 

Hello, Deni_S!

Попробуй так:
ShellExecute(0, "open", path+"app.exe", "H___H", NULL, SW_SHOWNORMAL);

Для второго параметра:
The following verbs are commonly used.
edit
Launches an editor and opens the document for editing. If lpFile is not a
document file, the function will fail.
explore
Explores the folder specified by lpFile.
find
Initiates a search starting from the specified directory.
open
Opens the file specified by the lpFile parameter. The file can be an
executable file, a document file, or a folder.
print
Prints the document file specified by lpFile. If lpFile is not a document
file, the function will fail.
NULL
For systems prior to Microsoft Windows 2000, the default verb is used if
it is valid and available in the registry. If not, the "open" verb is used.

For Windows 2000 and later systems, the default verb is used if available.
If not, the "open" verb is used. If neither verb is available, the system
uses the first verb listed in the registry.

Четвертый параметер: параметры к твоей апликухе.

Ответить   "Vladimir V.Petrov" Fri, 8 Sep 2006 10:18:11 +0300 (#588472)