urgent help vs2008 build errors

I face errors while compiling code shown below. it gives unexpected errors..what could be the reason?


#define _WIN32_WINNT 0x0602
#include
#include
#include
#include


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

static ULONG isConnectedStandby(PVOID Context, ULONG Type, PVOID Setting);

ULONG isConnectedStandby(PVOID Context, ULONG Type, PVOID Setting)
{
switch(Type)
{
case PBT_APMSUSPEND:
printf( "PBT_APMSUSPEND");
break;
case PBT_APMRESUMESUSPEND:
printf( "PBT_APMRESUMESUSPEND");
break;
case PBT_APMRESUMEAUTOMATIC:
printf( "PBT_APMRESUMEAUTOMATIC");
break;
default:
printf( "DEFAULT");
break;
}
return 0;
}


static _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS testCallback = {
isConnectedStandby,
nullptr
};


int __cdecl main()
{


HPOWERNOTIFY RegistrationHandle;

printf("Hello world
");

PowerRegisterSuspendResumeNotification(
DEVICE_NOTIFY_CALLBACK,
&testCallback,
&RegistrationHandle
);
/*
while(true) {
Sleep(1000);
}
*/
return 0;
}




1>------ Rebuild All started: Project: test1, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'test1', configuration 'Debug|Win32'
1>Compiling...
1>standby.cpp
standby.cpp(33) : error C2146: syntax error : missing ';' before identifier 'testCallback'
standby.cpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
standby.cpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
standby.cpp(34) : error C2440: 'initializing' : cannot convert from 'ULONG (__cdecl *)(PVOID,ULONG,PVOID)' to 'int'
1> There is no context in which this conversion is possible
standby.cpp(36) : error C2065: 'nullptr' : undeclared identifier
standby.cpp(36) : error C2078: too many initializers
standby.cpp(48) : error C2065: 'DEVICE_NOTIFY_CALLBACK' : undeclared identifier
standby.cpp(47) : error C3861: 'PowerRegisterSuspendResumeNotification': identifier not found





Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion