请问这个怎么运行?
#include<windows.h>
#include<stdlib.h>
#include<tchar.h>
#include "stdafx.h"
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,int nCmdShow)
{
if(__argc == 1){
TCHAR szPathOrig[_MAX_PATH], szPathClone[_MAX_PATH];
GetModuleFileName(NULL, szPathOrig, _MAX_PATH);
GetTempPath(_MAX_PATH, szPathClone);
GetTempFileName(szPathClone, __TEXT("Del"), 0, szPathClone);
CopyFile(szPathOrig, szPathClone, FALSE);
HANDLE hfile = CreateFile(szPathClone, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL);
TCHAR szCmdLine[512];
HANDLE hProcessOrig = OpenProcess(SYNCHRONIZE, TRUE, GetCurrentProcessId());
wsprintf(szCmdLine, __TEXT("%s %d \"%s\""), szPathClone, hProcessOrig, szPathOrig);
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
CreateProcess(NULL, szCmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
CloseHandle(hProcessOrig);
CloseHandle(hfile);
}
else{
HANDLE hProcessOrig = (HANDLE) _ttoi(__targv[1]);
WaitForSingleObject(hProcessOrig, INFINITE);
CloseHandle(hProcessOrig);
DeleteFile(__targv[2]);
}
return 0;
}
错误
错误 1 error C2146: syntax error : missing ';' before identifier 'WinMain' c:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\2\2\2.cpp 6
错误 2 error C2065: 'HINSTANCE' : undeclared identifier c:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\2\2\2.cpp 6
错误 3 error C2146: syntax error : missing ')' before identifier 'hInstance' c:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\2\2\2.cpp 6
错误 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\2\2\2.cpp 6
错误 5 error C2059: syntax error : ')' c:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\2\2\2.cpp 8
错误 6 error C2143: syntax error : missing ';' before '{' c:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects\2\2\2.cpp 9