...">

Problem with SetSuspendState

I am writing a small application to enter the computer in 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: LNK2001 error: unresolved external symbol _SetSuspendState @ 12 1> C: \ Documents and Settings \ Sobak \ Desktop \ Standby \ Release \ Standby.exe: fatal error LNK1120: 1 unresolved external_examples

How can i fix this?

PS I am using Visual Studio 2005

Thanks in advance.

+3
source share
1 answer

You must link your program to the library PowrProf.lib. You can do this by adding the following line:

#pragma comment(lib, "PowrProf.lib")
+5
source

Source: https://habr.com/ru/post/1755844/


All Articles