Inspired by MrBcx's Hide Console Window thread and Kliu's hideexec , here is an application to run hidden console applications. C code is the output of BCX Basic :
#include <windows.h>
int __cdecl __getmainargs(int*, char***, char***, int, int*);
int WINAPI WinMain (HINSTANCE hInst,HINSTANCE hPrev,LPSTR CmdLine,int CmdShow)
{
PROCESS_INFORMATION procinfo={0};
STARTUPINFO startinfo={0};
BOOL ProcResult= {0};
DWORD ExitCode= {0};
int argc,i;
char** argv;
char** env;
int doWildCard = 0;
__getmainargs(&argc,&argv,&env,0,&doWildCard);
ZeroMemory(&startinfo,sizeof(startinfo));
startinfo.cb=sizeof(startinfo);;
startinfo.dwFlags=STARTF_USESHOWWINDOW;
startinfo.wShowWindow=SW_HIDE;
ProcResult=CreateProcess(NULL,argv[1],NULL,NULL,FALSE,CREATE_NO_WINDOW|NORMAL_PRIORITY_CLASS,NULL,NULL, &startinfo, &procinfo);
ExitCode=0x10000;
ProcResult=(ProcResult!=0);
for(i=0; i<ProcResult; i++){
WaitForSingleObject(procinfo.hProcess,INFINITE);
GetExitCodeProcess(procinfo.hProcess, &ExitCode);;
CloseHandle(procinfo.hProcess);
CloseHandle(procinfo.hThread);
}
return ExitCode;
}