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++]GroupBox messages

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Symbol
I'm a spammer
Reputation: 0

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

PostPosted: Thu Jun 26, 2008 7:26 pm    Post subject: [C++]GroupBox messages Reply with quote

From some reason I don't get messages from group box child windows. =|
I hate calling ChildWindowFromPoint, which I used last time I used a group box, so I tried calling SetWindowLong with the 2nd parameter being GWL_WNDPROC, but then its not even shown... (tried sending WM_CREATE messages or calling ShowWindow, nothing... Neutral)

My code..:
Code:
LRESULT CALLBACK Test(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   switch (Msg)
   {
...
...
   }
   return DefWindowProc(hwnd, Msg, wParam, lParam);
}
...
...
...
SetWindowLongA(GroupWnd, GWL_WNDPROC, (LONG)&Test);


Is there anything wrong in 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: Thu Jun 26, 2008 8:09 pm    Post subject: Reply with quote

Firstly, use SetWindowLongPtr.

Quote:
Note This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Microsoft Windows, use the SetWindowLongPtr function.


Next you don't need &. You can use (LONG)(LONG_PTR) to remove warnings if you wish like this:

Code:
lpOldWndProc = (WNDPROC)(LONG_PTR)SetWindowLongPtr(hWnd, GWL_WNDPROC, (LONG)(LONG_PTR)WndProc);

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Symbol
I'm a spammer
Reputation: 0

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

PostPosted: Fri Jun 27, 2008 6:03 am    Post subject: Reply with quote

Its still not working.

Edit:
Code:
#define SetWindowLongPtrW SetWindowLongW

Surprised

Weird, I can't see the group box but I can see the child windows... =\
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: Fri Jun 27, 2008 9:43 pm    Post subject: Reply with quote

Symbol wrote:
Its still not working.

Edit:
Code:
#define SetWindowLongPtrW SetWindowLongW

Surprised

Weird, I can't see the group box but I can see the child windows... =\


The macro is like that due to the compiler settings, if you told it to adjust to compile for x64 bit it would use a different macro. Which is why they say to use SetWindowLongPtr over SetWindowLong macros.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Symbol
I'm a spammer
Reputation: 0

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

PostPosted: Fri Jun 27, 2008 10:15 pm    Post subject: Reply with quote

Ok.
But do you have any idea what the group box isn't redrawing itself?
I tried calling SetWindowLong after the group box was created and drawn, but then it never got WM_PAINT/WM_DRAWITEM message, and when I moved a window over it, well, it disappeared ofcourse... Confused
I tried sending the message to both parent window and group box window, nither worked...
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: Fri Jun 27, 2008 10:32 pm    Post subject: Reply with quote

Try using BeginPaint and EndPaint, and then InvalidateRect / RedrawWindow.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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