C++ SetSuspendState的问题
我编写了一个小应用程序,使计算机进入待机模式:C++ SetSuspendState的问题,c++,windows,windows-xp,standby,C++,Windows,Windows Xp,Standby,我编写了一个小应用程序,使计算机进入待机模式: #include "stdafx.h" #include <windows.h> #include <PowrProf.h> int _tmain(int argc, _TCHAR* argv[]) { SetSuspendState(FALSE, FALSE, FALSE); return 0; } #包括“stdafx.h” #包括 #包括 int _tmain(int argc,_TCHAR*argv
#include "stdafx.h"
#include <windows.h>
#include <PowrProf.h>
int _tmain(int argc, _TCHAR* argv[])
{
SetSuspendState(FALSE, FALSE, FALSE);
return 0;
}
#包括“stdafx.h”
#包括
#包括
int _tmain(int argc,_TCHAR*argv[]
{
设置SuspendState(假、假、假);
返回0;
}
我得到这个错误:
1> Standby.obj:错误LNK2001:未解析的外部符号_SetSuspendState@12
1> C:\Documents and Settings\Sobak\Desktop\Standby\Release\Standby.exe:致命错误LNK1120:1未解析的外部外部外部
我怎样才能修好它
附言。
我使用VisualStudio2005
提前谢谢。您应该将程序链接到
powrpof.lib
库。您可以通过添加以下字符串来完成此操作:
#pragma comment(lib, "PowrProf.lib")