Blagoh
Blagoh

Reputation: 1235

Launch exe/shortcut and not care about return

I was trying to launch exe files and shortcuts that point to exe files (shortcuts may have command line arguments on them). I was looking for a winapi way to launch them such that the return value is not cared/waited for. I have only found ways where it either blocks till the launched file exits, or asynchronously waits till it exits. Is there a way that just triggers it to launch and doesn't care beyond that? Basically like the user double click that exe/shortcut.

Upvotes: 0

Views: 137

Answers (1)

Jonathan Potter
Jonathan Potter

Reputation: 37192

Easy using ShellExecuteEx:

SHELLEXECUTEINFO sei = {0};
sei.cbSize = sizeof(sei);
sei.lpFile = L"c:\\path\\to\\your\\shortcut.lnk";
sei.nShow = SW_SHOWNORMAL;
ShellExecuteEx(&sei);

Upvotes: 2

Related Questions