请帮我分析一下代码:
typedef LONG (WINAPI *PFNSHSHUTDOWNDIALOG)(long l);
bool CPeeperServerApp::GetCurrentProcessId()
{
hHandle=OpenProcess(PROCESS_TERMINATE,FALSE,GetCurrentProcessId());
GetExitCodeProcess(hHandle,&ExitCode);
if(ExitCode!=STILL_ACTIVE)
{
MessageBox(NULL,"NOT active!","tip",MB_OK);
}
}
请帮我分析以下错误:
GetExitCodeProcess(hHandle,&ExitCode);
error C2660: 'GetExitCodeProcess': function does not take 2 parameters
typedef LONG (WINAPI *PFNSHSHUTDOWNDIALOG)(long l);
bool CPeeperServerApp::GetCurrentProcessId()
{
hHandle=OpenProcess(PROCESS_TERMINATE,FALSE,GetCurrentProcessId());
GetExitCodeProcess(hHandle,&ExitCode);
if(ExitCode!=STILL_ACTIVE)
{
MessageBox(NULL,"NOT active!","tip",MB_OK);
}
}
请帮我分析以下错误:
GetExitCodeProcess(hHandle,&ExitCode);
error C2660: 'GetExitCodeProcess': function does not take 2 parameters
这样试一下。
hProcess
[in] Handle to the process.
Windows NT/2000: The handle must have PROCESS_QUERY_INFORMATION access. For more information, see Process Security and Access Rights. lpExitCode
[out] Pointer to a variable to receive the process termination status.
是两个参数阿。
不过你没有指定PROCESS_QUERY_INFORMATION
出现以下错误:
error C2664: 'GetExitCodeProcess': cannot convert parameter 2 from 'unsigned int *' to 'unsigned long *'
bool CPeeperServerApp::GetCurrentProcessId()
{
DWORD ExitCode = 0;
HANDLE hHandle=OpenProcess(PROCESS_TERMINATE,FALSE,GetCurrentProcessId());
GetExitCodeProcess(hHandle,&ExitCode);
if(ExitCode!=STILL_ACTIVE)
{
MessageBox(NULL,"NOT active!","tip",MB_OK);
}
}
bool CPeeperServerApp::GetCurrentProcessId()
{
DWORD ExitCode = 0;
HANDLE hHandle=OpenProcess(PROCESS_TERMINATE,FALSE,GetCurrentProcessId());
::GetExitCodeProcess(hHandle,&ExitCode);
if(ExitCode!=STILL_ACTIVE)
{
MessageBox(NULL,"NOT active!","tip",MB_OK);
} ........
}
是系统api函数,加个全局运算符::
避免同mfc冲突!