Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[help] error C2448: 'GetAsyncKeyState' :

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Wed Dec 03, 2008 12:14 am    Post subject: [help] error C2448: 'GetAsyncKeyState' : Reply with quote

error C2448: 'GetAsyncKeyState' : function-style initializer appears to be a function definition

I r searched all on the interwebs and can't find the problem..
GetAsyncKeyState(VK_F4){
bExit = true;
}
GetAsyncKeyState(VK_F5){
bExit = false;
}

_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Dec 03, 2008 12:52 am    Post subject: Reply with quote

You're using it like you're defining a function, just like the error says.

You forget the if statement. You're not checking the return at all, just simply calling it.
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Wed Dec 03, 2008 1:59 am    Post subject: Reply with quote

Are people just trolling this section now? It is getting ridiculous.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Dec 03, 2008 5:46 am    Post subject: Reply with quote

At least he gave him an answer and wasn't just like YOU NOOB LEARN TO USE IF

anyways. You know your problem now.

_________________
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Wed Dec 03, 2008 10:37 am    Post subject: Reply with quote

I did use IF, but then I get diff errors...

1>.\lolkeyz.cpp(31) : error C2059: syntax error : 'if'
1>.\lolkeyz.cpp(31) : error C2143: syntax error : missing ';' before '{'
1>.\lolkeyz.cpp(31) : error C2447: '{' : missing function header (old-style formal list?)
1>.\lolkeyz.cpp(35) : error C2059: syntax error : 'if'
1>.\lolkeyz.cpp(35) : error C2143: syntax error : missing ';' before '{'
1>.\lolkeyz.cpp(35) : error C2447: '{' : missing function header (old-style formal list?)

if(GetAsyncKeyState(VK_F5)){
bExit = true;
keyDown();
}
if(GetAsyncKeyState(VK_F4)){
bExit = false;
keyUp();
}

and if i do

if(GetAsyncKeyState(VK_F5))
bExit = true
keyDown();
if(GetAsyncKeyState(VK_F4))
bExit = false
keyUp();

1>.\lolkeyz.cpp(31) : error C2059: syntax error : 'if'
1>.\lolkeyz.cpp(34) : error C2059: syntax error : 'if'

_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Wed Dec 03, 2008 10:42 am    Post subject: Reply with quote

Code:
if(GetAsyncKeyState(VK_F5) < 0){
   bExit = true;
   keyDown();
}
if(GetAsyncKeyState(VK_F4) < 0){
   bExit = false;
   keyUp();
}
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Wed Dec 03, 2008 12:30 pm    Post subject: Reply with quote

ehh, that gives

Code:
1>.\lolkeyz.cpp(31) : error C2059: syntax error : 'if'
1>.\lolkeyz.cpp(31) : error C2143: syntax error : missing ';' before '{'
1>.\lolkeyz.cpp(31) : error C2447: '{' : missing function header (old-style formal list?)
1>.\lolkeyz.cpp(35) : error C2059: syntax error : 'if'
1>.\lolkeyz.cpp(35) : error C2143: syntax error : missing ';' before '{'
1>.\lolkeyz.cpp(35) : error C2447: '{' : missing function header (old-style formal list?)


Code:

// lolkeyz.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"
#include <windows.h>
BOOL bExit = false;
using namespace lolkeyz;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
   // Enabling Windows XP visual effects before any controls are created
   Application::EnableVisualStyles();
   Application::SetCompatibleTextRenderingDefault(false);

   // Create the main window and run it
   Application::Run(gcnew Form1());
   return 0;
}
void keyDown(){
   while(bExit){
   keybd_event(VK_SPACE, 0, 0, 0);
   }
}
void keyUp(){
   while(!bExit){
   keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0);
   }
}

if(GetAsyncKeyState(VK_F5) < 0){
   bExit = true;
   keyDown();
}
if(GetAsyncKeyState(VK_F4) < 0){
   bExit = false;
   keyUp();
}

_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Dec 03, 2008 12:33 pm    Post subject: Reply with quote

Learn the syntax instead of asking us to fix your code... your conditions aren't even in any code block.

And don't use managed C++, it sucks, better use C++, or if you prefer .NET then C#, but not C++.NET.
Back to top
View user's profile Send private message
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Wed Dec 03, 2008 12:35 pm    Post subject: Reply with quote

Well, I put it in void GetKeys(); and now I get linker errors.

1>main.obj : error LNK2028: unresolved token (0A00000A) "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "void __clrcall CheckKey(void)" (?CheckKey@@$$FYMXXZ)
1>main.obj : error LNK2028: unresolved token (0A00000B) "extern "C" void __stdcall keybd_event(unsigned char,unsigned char,unsigned long,unsigned long)" (?keybd_event@@$$J216YGXEEKK@Z) referenced in function "void __clrcall keyDown(void)" (?keyDown@@$$FYMXXZ)
1>main.obj : error LNK2019: unresolved external symbol "extern "C" void __stdcall keybd_event(unsigned char,unsigned char,unsigned long,unsigned long)" (?keybd_event@@$$J216YGXEEKK@Z) referenced in function "void __clrcall keyDown(void)" (?keyDown@@$$FYMXXZ)
1>main.obj : error LNK2019: unresolved external symbol "extern "C" short __stdcall GetAsyncKeyState(int)" (?GetAsyncKeyState@@$$J14YGFH@Z) referenced in function "void __clrcall CheckKey(void)" (?CheckKey@@$$FYMXXZ)

_________________
qwerty147 wrote:

ghostonline wrote:

what world are you in?

bera

but i live in NZ
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Wed Dec 03, 2008 2:03 pm    Post subject: Reply with quote

Link to user32.lib in project settings or add #pragma comment(lib, "user32.lib") to the top of your source code.. and stop using c++.net Rolling Eyes
Back to top
View user's profile Send private message
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Wed Dec 03, 2008 2:39 pm    Post subject: Reply with quote

if(GetAsnycKeyState(VK_F5))
{
bExit = true;
}
if(GetAsyncKeyState(VK_F4))
{

bExit = false;

}
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Dec 03, 2008 3:49 pm    Post subject: Reply with quote

1. Don't use managed C++, there's no support for it. Use native C++, or C#.

2. You just have your shit laying around, it's not within any code block...

3. Go do some reading, and learn the damn basics already.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites