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++]WM_DESTROY
Goto page 1, 2  Next
 
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 12:37 pm    Post subject: [C++]WM_DESTROY Reply with quote

I keep trying WM_DESTROY and its not working... my syntax:

. . .
void destroy(HWND hWnd){
WM_DESTROY(HWND hWnd);
}
. . .
if(GetAsyncKeyState(VK_F12){
destroy();
}
. . .


Why isn't it working?

_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Jun 22, 2008 12:44 pm    Post subject: Reply with quote

WM_DESTROY is a window message, not a function.
_________________
- 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 12:49 pm    Post subject: Reply with quote

EDIT: NVM fixed.
_________________
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 1:26 pm    Post subject: Reply with quote

WM_DESTROY(HWND hWnd);

Even if that was a function you don't CALL a function like that. You would call it just

Function(hWnd);

When you declare a function you do (TYPE varname)

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

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jun 22, 2008 4:13 pm    Post subject: Reply with quote

It's a windows message, use Post/SendMessage... though you really shouldn't be throwing WM_DESTROY's around.
Back to top
View user's profile Send private message
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

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

I'm just wondering and correct me if I'm wrong, but because you declared the function as

Code:


void WM_DESTORY (HWND hWnd);



it should be

Code:

. . .

if ( GetAsyncKeyState ( VK_F12 ) [b])[/b] {
     destroy( your_hWnd_here );
}

. . .
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:19 pm    Post subject: Reply with quote

nwongfeiying wrote:
I'm just wondering and correct me if I'm wrong, but because you declared the function as

Code:


void WM_DESTORY (HWND hWnd);



it should be

Code:

. . .

if ( GetAsyncKeyState ( VK_F12 ) [b])[/b] {
     destroy( your_hWnd_here );
}

. . .


Again, WM_DESTORY is not a function, it is a window message that is handled by a windows message pump. It is a raised event when the window is being told to destroy itself. (Called when DestroyWindow() is called on the given hWnd.)

If you want to achieve the effect of what you are attempting to do, just use DestroyWindow. In the case of what is posted here:

Code:
if( GetAsyncKeyState( VK_F12 ) ){
    DestroyWindow( hWnd );
}


More info if you need it:

WM_DESTROY message:
http://msdn.microsoft.com/en-us/library/ms632620(VS.85).aspx

DestroyWindow API:
http://msdn.microsoft.com/en-us/library/ms632682(VS.85).aspx

Creating and Destroying windows:
http://msdn.microsoft.com/en-us/library/ms632598(VS.85).aspx

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

Joined: 11 Apr 2007
Posts: 380
Location: En san salvador, El Salvador

PostPosted: Tue Jun 24, 2008 12:01 pm    Post subject: Reply with quote

i will go offtopic with this question but
i always get an error when trying to use GetAsyncKeyState
i dont know if this problem is because im using vs 2005

_________________


Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Jun 24, 2008 5:23 pm    Post subject: Reply with quote

avril18 wrote:
i will go offtopic with this question but
i always get an error when trying to use GetAsyncKeyState
i dont know if this problem is because im using vs 2005


You probably declared the import wrong.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jun 24, 2008 10:20 pm    Post subject: Reply with quote

avril18 wrote:
i will go offtopic with this question but
i always get an error when trying to use GetAsyncKeyState
i dont know if this problem is because im using vs 2005


How about you post the damn error so we have a clue?
Back to top
View user's profile Send private message
avril18
Master Cheater
Reputation: 0

Joined: 11 Apr 2007
Posts: 380
Location: En san salvador, El Salvador

PostPosted: Wed Jun 25, 2008 5:15 pm    Post subject: Reply with quote

if i put:
if ( GetAsyncKeyState ( VK_F12 ))
Windows::Forms::MessageBox::Show("hello;)","grats!!");
else
Windows::Forms::MessageBox::Show("Sad ","Error");

i get an error saying:

error C2065: 'VK_F12' : undeclare identifier
error C3861: 'GetAsyncKeyState': identifier not found

_________________


Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Wed Jun 25, 2008 5:27 pm    Post subject: Reply with quote

avril18 wrote:
if i put:
if ( GetAsyncKeyState ( VK_F12 ))
Windows::Forms::MessageBox::Show("hello;)","grats!!");
else
Windows::Forms::MessageBox::Show(":( ","Error");

i get an error saying:

error C2065: 'VK_F12' : undeclare identifier
error C3861: 'GetAsyncKeyState': identifier not found


Include the right header?

Though you're using managed C++, so you'll probably have to declare the imports. Look up "P/Invoke C++.NET on Google" or something of the likes.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
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 Jun 25, 2008 8:05 pm    Post subject: Reply with quote

avril18 wrote:
if i put:
if ( GetAsyncKeyState ( VK_F12 ))
Windows::Forms::MessageBox::Show("hello;)","grats!!");
else
Windows::Forms::MessageBox::Show("Sad ","Error");

i get an error saying:

error C2065: 'VK_F12' : undeclare identifier
error C3861: 'GetAsyncKeyState': identifier not found


include windows.h



samuri25404 wrote:
avril18 wrote:
if i put:
if ( GetAsyncKeyState ( VK_F12 ))
Windows::Forms::MessageBox::Show("hello;)","grats!!");
else
Windows::Forms::MessageBox::Show("Sad ","Error");

i get an error saying:

error C2065: 'VK_F12' : undeclare identifier
error C3861: 'GetAsyncKeyState': identifier not found


Include the right header?

Though you're using managed C++, so you'll probably have to declare the imports. Look up "P/Invoke C++.NET on Google" or something of the likes.


You dont't need to Pinvoke under managed C++ if I remember right.
Back to top
View user's profile Send private message
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Wed Jun 25, 2008 10:32 pm    Post subject: Reply with quote

Ain't Visual C++ just great?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Jun 26, 2008 12:55 am    Post subject: Reply with quote

nwongfeiying wrote:
Ain't Visual C++ just great?


being sarcastic towards something that isn't the source of the problem is pretty awesome.
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
Goto page 1, 2  Next
Page 1 of 2

 
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