[SDL] Tom Wilson or every friend help me

Tom Wilson t.wilson at hazid.com
Sun Jul 17 03:18:20 PDT 2005


许戟 wrote:
> Hi every friend:
> 
>      I have a trouble that when I draw  SDL surface onto MFC Control ,I cant get message from the control such as 
> 
> WM_LBUTTONDOWN and WM_MOUSEMOVE , how can let the control receive it's message after SDL surface mask on it.
>      
>      The way draw surface is take from Tom Wilson's SDLChildWindow demo .
> 
>      thank  Tom Wilson and thank every friends!
>      



You need to make your own WndProc that forwards these messages to the
button.  As the SDL child window is On-top of the button and receives
the messages.

You need to somehow get the handle of the button. Lets call this hwndButton.

so, for example:


LRESLUT WINAPI ForwardingProc(HWND window, UINT msg, WPARAM wParam,
LRESULT lResult){
	
	return ::SendMessage(hwndButton, msg, wParam, lParam);

}

And then the child window can be told about this function with the function:

SDL_ChildWindow::set_user_proc(LRESULT (*usr_proc)(HWND hwnd_from, UINT
message, WPARAM wParam, LPARAM lParam));

However, your forwarding proc cannot be a class member.  This is a bad
limitation.  I soon realised this method is extremely rubbish. So I have
some code that uses the current window and will not stop the messages
getting through to the window.  It's much simplified.

I will post this code on my web site later today and re-do the
description text on the SDL web site.  I will probably remove the old
SDL_ChildWindow code.

(I have been meaning to do this for about 2 years! :-)  )

I'll let you know when it's all packaged up.


- Tom



> 	
>                Jack xuji
>         xuji at hz.cn
>           2005-07-17
> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 
> 
> 






More information about the SDL mailing list