I want to open an executable file that have no \".exe\" extension with ShellExecute. I can use CreateProcess but I prefer to use ShellExecute. There is any way to do it?
You use the lpClass member of the SHELLEXECUTEINFO structure to say, "I want you to treat this file as if it were an EXE, even though it doesn't look like one from the extension."
int _tmain(int argc, _TCHAR* argv[])
{
SHELLEXECUTEINFO sei = {0};
sei.cbSize = sizeof(sei);
sei.nShow = SW_SHOWNORMAL;
sei.lpFile = TEXT("myprogram.wrongextension");
sei.fMask = SEE_MASK_CLASSNAME;
sei.lpVerb = TEXT("open");
sei.lpClass = TEXT("exefile");
ShellExecuteEx(&sei);
return 0;
}