I want to execute a program (say test.exe). But I want to do it from inside a C++ file as I want to have a delay after the program executes, how can I execute a program on disk from inside cpp? it's on my comp, so it doesn't matter about security if i have to turn off some stuff...
tried
Code:
#include <windows.h>
#include <shellapi.h>
void main() {
char* URL = "C:\\test.exe>";
ShellExecute(NULL, "open", URL, NULL, NULL, SW_SHOWNORMAL);
}
but got errors:
t1.obj : error LNK2028: unresolved token (0A000017) "struct HINSTANCE__ * __stdcall ShellExecuteA(struct HWND__ *,char const *,char const *,char const *,char const *,int)" (?ShellExecuteA@@$$J224YGPAUHINSTANCE__@@PAUHWND__ @@PBD111H@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
t1.obj : error LNK2019: unresolved external symbol "struct HINSTANCE__ * __stdcall ShellExecuteA(struct HWND__ *,char const *,char const *,char const *,char const *,int)" (?ShellExecuteA@@$$J224YGPAUHINSTANCE__@@PAUHWND__ @@PBD111H@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
C:\Documents and Settings\Vindra\My Documents\Visual Studio 2005\Projects\time\Release\time.exe : fatal error LNK1120: 2 unresolved externals