Visual C++

Moderators: Lundin
Number of threads: 379
Number of posts: 695

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
urgent help vs2008 build errors Posted by leo2008 on 11 Nov 2012 at 8:05 PM
I face errors while compiling code shown below. it gives unexpected errors..what could be the reason?


#define _WIN32_WINNT 0x0602
#include <Windows.h>
#include <powrprof.h>
#include <stdio.h>
#include <tchar.h>


#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\n");

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





Report
Re: urgent help vs2008 build errors Posted by common995 on 12 Nov 2012 at 3:40 AM
Wonderful.

Share a website with you ,

( http://www.commonprosperity.org/ )

Believe you will love it.

We accept any form of payment.
Attachment: 17.jpg (176246 Bytes | downloaded 27 times)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.