MessageBeep
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
int __cdecl WinMainCRTStartup(void)
{
MessageBeep(0);
ExitThread(0);
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
void StartPrg(TCHAR *szModule, TCHAR *szCmdLine)
{
//STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
TCHAR szBuff[260];
//si.cb = sizeof(si);
// Start the child process.
if (!CreateProcess(szModule, // No module name (use command line)
szCmdLine, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
NULL, // Pointer to STARTUPINFO structure
&pi) // Pointer to PROCESS_INFORMATION structure
)
{
wsprintf(szBuff, L"CreateProcess failed (%d).\n", GetLastError());
MessageBox(0, szBuff, L"StartPrg", MB_OK);
return;
}
/*
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
*/
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
StartPrg(L"\\Windows\\calc.exe", NULL);
return 0;
}