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 


[C++]Undeclared Identifier

 
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: Sun Jun 22, 2008 10:25 pm    Post subject: [C++]Undeclared Identifier Reply with quote

I know my code isn't wrong, as I took part of it from x0rs adkiller.

Anyway, it gives undeclared identifier for hWnd and other stuff. I included
#include <windows.h>
#include <tchar.h>
#include "stdafx.h"

and all of the code is correct. help?

_________________
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
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sun Jun 22, 2008 10:30 pm    Post subject: Reply with quote

Some code would be nice (not your includes, the line(s) where your getting the error)...
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Jun 22, 2008 10:35 pm    Post subject: Re: [C++]Undeclared Identifier Reply with quote

ElectroFusion wrote:
I know my code isn't wrong, as I took part of it from x0rs adkiller.

Anyway, it gives undeclared identifier for hWnd and other stuff. I included
#include <windows.h>
#include <tchar.h>
#include "stdafx.h"

and all of the code is correct. help?


If the code errors saying undeclared identifier for 'hWnd' spelled just like that, that would be the code is attempting to use an undefined variable, not type. Meaning you need to add the following to the code.

Code:
HWND hWnd;

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ElectroFusion
Grandmaster Cheater
Reputation: 0

Joined: 17 Dec 2006
Posts: 786

PostPosted: Sun Jun 22, 2008 10:38 pm    Post subject: Reply with quote

@Wiccaan: I did that.

@oib: #include <windows.h>
#include <tchar.h>

int _tmain(int argc, _TCHAR* argv[], _TCHAR* envp[])
{
HWND hWnd;
LONG gwlStyle;


UNREFERENCED_PARAMETER(argc)
UNREFERENCED_PARAMETER(argv)
UNREFERENCED_PARAMETER(envp)

hWnd = FindWindow(_T("AdSpace"), NULL);
if (hWnd != NULL)
{
_tprintf(_T("AdSpace hWnd = 0x%08X\n"), hWnd);
_tprintf(_T("\tKilling AdSpace window %s!\n"), (SendMessage(hWnd, WM_DESTROY, 0, 0) == 0) ? _T("successful") : _T("failed"));
}
else
_ftprintf(stderr, _T("Could not find AdSpace window!\n"));

hWnd = FindWindow(_T("MapleStoryClass"), NULL);
if (hWnd != NULL)
{
_tprintf(_T("MapleStory hWnd = 0x%08X\n"), hWnd);
gwlStyle = GetWindowLong(hWnd, GWL_STYLE);
if (gwlStyle != 0)
{
_tprintf(_T("\tMapleStory window style = 0x%08X\n"), gwlStyle);
gwlStyle |= WS_OVERLAPPEDWINDOW;
if (SetWindowLong(hWnd, GWL_STYLE, gwlStyle) != 0)
_tprintf(_T("\t\tSuccessfully applied WS_OVERLAPPEDWINDOW to MapleStory window!"));
else
_ftprintf(stderr, _T("\t\tCould not apply new MapleStory window style!"));
}
else
_ftprintf(stderr, _T("\tCould not retrieve MapleStory window style!"));
}
else
_ftprintf(stderr, _T("Could not find MapleStory window!"));
return EXIT_SUCCESS;
}

as an example. it gives tons of undeclared identifiers.

im using Microsoft Visual Express 2008 C++

_________________
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
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sun Jun 22, 2008 10:59 pm    Post subject: Reply with quote

I hope you aren't planning on releasing that under your name >.>

Also post your errors. I had to comment out the UNREF PARAM shit in VC++ o.o

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Jun 22, 2008 11:14 pm    Post subject: Reply with quote

Your error is not because of hWnd, it is because of whats before the line using it. Read the errors more closely:

error C2064: term does not evaluate to a function taking 1 arguments
error C2146: syntax error : missing ';' before identifier 'hWnd'

Code:
UNREFERENCED_PARAMETER(argc)
UNREFERENCED_PARAMETER(argv)
UNREFERENCED_PARAMETER(envp)

hWnd = FindWindow(_T("AdSpace"), NULL);


You are missing ' ; ' after each UNREFERENCED_PARAMETER.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Sun Jun 22, 2008 11:15 pm    Post subject: Reply with quote

It's so hard to read without the code tags.
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