Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with SetSuspendState

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 externalsexternals

How can I fix it?

P.S. I use Visual Studio 2005

Thank you in advance.

like image 963
Leonid F. Avatar asked Nov 28 '25 19:11

Leonid F.


1 Answers

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

#pragma comment(lib, "PowrProf.lib")
like image 160
Kirill V. Lyadvinsky Avatar answered Nov 30 '25 10:11

Kirill V. Lyadvinsky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!