Hi,
I'm trying to use some power management features with windowsx xp
and I have visual studio .net 2003 installed.
As per documentation of ACPI, you can
use the power options by including the Powrprof.h file and use the
Powrprof.lib file in your project, which I did, but when I build, it
compiles fine but I get this Link error.. :
error LNK2019: unresolved external symbol "long __stdcall
CallNtPowerInformation(enum POWER_INFORMATION_LEVE,void*,usigned
long,void*,unsignedlong)"
(?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K@Z)
referenced in
function _main
fatal error LNK1120: 1 unresolved externals
The code is as shown below :...
Any Ideas on what I'm missing here... please help...
Thanks,
Regards,
AS.
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <lmaccess.h>
#include <powrprof.h>
int _tmain(int argc, _TCHAR* argv[])
{
SYSTEM_POWER_CAPABILITIES cap;
NTSTATUS status;
status = CallNtPowerInformation(
SystemPowerCapabilities,
NULL,
0,
&cap,
sizeof(cap));
return 0;
}
Jeff Partch [MVP] - 02 Oct 2004 01:41 GMT
> Hi,
>
[quoted text clipped - 15 lines]
> The code is as shown below :...
> Any Ideas on what I'm missing here... please help...
I suspect that you need to link against Powrprof.lib.

Signature
Jeff Partch [VC++ MVP]
Nate - 18 Oct 2004 22:17 GMT
I am having the same issue. Powrprof.lib is listed in my IDE to be linked.
Any other ideas?
Thanks.
Nate
> > Hi,
> >
[quoted text clipped - 17 lines]
>
> I suspect that you need to link against Powrprof.lib.
Guest - 03 Jan 2005 12:18 GMT
Your problem is that you didn't put the 'extern "C" {}' around the #include<pawrprof.h>.
I had the same problem and that fixed it.
Good luck!
--Ed
> Hi,
> > > I'm trying to use some power management features with windowsx xp
[quoted text clipped - 32 lines]
> > return 0;
> }
User submitted from AEWNET (http://www.aewnet.com/)
Guest - 31 May 2005 06:27 GMT
Hi,
U can use the LoadLibrary to load the Powrprof.lib and get a pointer to that function
with GetProcAddress function.
i have used it n its wrking fine.
Regards,
VK
> Hi,
>
[quoted text clipped - 41 lines]
> return 0;
> }
User submitted from AEWNET (http://www.aewnet.com/)