| View previous topic :: View next topic |
| Author |
Message |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Thu Jun 26, 2008 7:26 pm Post subject: [C++]GroupBox messages |
|
|
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... )
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Jun 26, 2008 8:09 pm Post subject: |
|
|
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 |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Jun 27, 2008 6:03 am Post subject: |
|
|
Its still not working.
Edit:
| Code: | | #define SetWindowLongPtrW SetWindowLongW |
Weird, I can't see the group box but I can see the child windows... =\
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Jun 27, 2008 10:15 pm Post subject: |
|
|
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...
I tried sending the message to both parent window and group box window, nither worked...
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Jun 27, 2008 10:32 pm Post subject: |
|
|
Try using BeginPaint and EndPaint, and then InvalidateRect / RedrawWindow.
_________________
- Retired. |
|
| Back to top |
|
 |
|