开发者

Problem with SetSuspendState

开发者 https://www.devze.com 2023-01-08 12:51 出处:网络
I write a small application to enter the computer to Standby Mode: #include \"stdafx.h\" #include <windows.h>

I write a small application to enter the computer to Standby Mode:

#include "stdafx.h"
#include <windows.h>
#include <PowrProf.h>

int _tmain(int argc, _TCHAR* argv[])
{
   SetSuspendState(FALSE, FALSE, FALSE);

   return 0;
}

I get this error: 1>Standby.obj : error LNK2001: unresolved external symbol _SetSuspendState@12 1>C:\Documents and Settings\Sobak\Desktop\Standby\Release\Standby.exe : fatal error LNK1120: 1 unresolved ext开发者_运维问答ernalsexternals

How can I fix it?

P.S. I use Visual Studio 2005

Thank you in advance.


You should link your programm with the PowrProf.lib library. You could do it by adding the following string:

#pragma comment(lib, "PowrProf.lib")
0

精彩评论

暂无评论...
验证码 换一张
取 消