RE: Microsoft.WindowsCE.Forms.Message to get Parent Control?

From: Alex Yakhnin [MVP] (a.yakhnin_at_online.att.net)
Date: 08/24/04


Date: Tue, 24 Aug 2004 08:31:04 -0700

You can identify the control by its window handle which you can get by using
Control.Capture - GetCapture combination. Take a look at my post that shows
how to create pseudo Win. Proc for a particular control:

http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=9a05b2dc-c79f-4cd8-af17-aa485fada5c7

--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org
"Andrew Martin" wrote:
> I have implemented a custom DateTimePicker control with OpenNETCF
> IMessageFilter:
> 
> public bool PreFilterMessage(ref Microsoft.WindowsCE.Forms.Message m)
> {   // Add MsgWindowTest.PreFilterMessage implementation
>     if (m.Msg == (int)WinAPI.eWM.WM_LBUTTONDOWN)
>     {
> 	// Get the low and high order words (X, Y coordinates)
> 	int x = DateTimePicker.DateTimePicker.Get_X_LParam(m.LParam.ToInt32());
> 	int y = DateTimePicker.DateTimePicker.Get_Y_LParam(m.LParam.ToInt32());
> 
> 	if (this.hourRectangle.Contains(x, y))
>              // The hour has focus
>     }
> }
> 
> I then use a numericUpDown to increment the date part that has focus. 
> The issue is that I have 2 controls on my custom control - and m.Msg
> returns the X,Y for whichever control is clicked (the DateTimePicker
> which I want...and the NumericUpDown which I don't).  Is there any way
> to determine the control that the X,Y belongs to from this message?
> 
> Microsoft.WindowsCE.Forms.Message m
> 
> m.HWnd;
> m.LParam;
> m.Msg;
> m.Result;
> m.WParam;
> 
> Thanks for your help.
> -a
>