| View previous topic :: View next topic |
| Author |
Message |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Sun Jun 22, 2008 10:25 pm Post subject: [C++]Undeclared Identifier |
|
|
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 |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Jun 22, 2008 10:30 pm Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Jun 22, 2008 10:35 pm Post subject: Re: [C++]Undeclared Identifier |
|
|
| 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.
_________________
- Retired. |
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Sun Jun 22, 2008 10:38 pm Post subject: |
|
|
@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 |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sun Jun 22, 2008 10:59 pm Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Jun 22, 2008 11:14 pm Post subject: |
|
|
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 |
|
 |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Sun Jun 22, 2008 11:15 pm Post subject: |
|
|
| It's so hard to read without the code tags.
|
|
| Back to top |
|
 |
|