set event button click

  • Thread starter Thread starter Elmar Jacobs
  • Start date Start date
E

Elmar Jacobs

hi folk,
how can I realize that in a function a can activate the button click event.
so that i can simulat an button click sequenz with changing of the button
bitmaps?

thanks a lot,
elmar
 
You can try *posting* a WL_LBUTTONDOWN message, followed by WM_LBUTTONUP
after a short delay. The messages need to be posted to the button's HWND and
the appropriate coordinates need to be put into LPARAM. Don't forget to call
Update on the button between the messages, or the button will not repaint
 
Thanks a lot for the answer.

But I use C# and there I don't know how I can get access to the win system
msg, for example button down.

elmar
 
hi alex,

thanks a lot for the answer alex. therby i become knowledge about the
OpenNETCF functions GetCapture() and PostMessage(). These function were
until now totally unknown.

Really thanks alex :)))))

here the code i use in c#

/// <summary>

/// Window mouse click event list

/// </summary>

private enum WindowMsgs: int {
WM_LBUTTONDBLCLK = 0x0203,

WM_LBUTTONDOWN = 0x0201,

WM_LBUTTONUP = 0x0202,

WM_MBUTTONDBLCLK = 0x0209,

WM_MBUTTONDOWN = 0x0207,

WM_MBUTTONUP = 0x0208,

WM_RBUTTONDBLCLK = 0x0206,

WM_RBUTTONDOWN = 0x0204,

WM_RBUTTONUP = 0x0205,

}
I was not able to implement this msgs in the Win32Window class in
....\OpenNETCF\Smart Device Framework\Source\OpenNETCF\Win32.WindowHelper.cs

/// <summary>

/// Simulate a Click event on position x, y

/// </summary>

private void simulatedClickEvent( int xpos, int ypos) {
IntPtr hWnd = OpenNETCF.Win32.Win32Window.GetCapture();
OpenNETCF.Win32.Win32Windows.PostMessage(hWnd, <class>.WM_LBUTTONDOWN,
(IntPtr) OpenNETCF.Win32.Core.MK_LBUTTON, (IntPtr) (xpos | (ypos << 16)));
OpenNETCF.Win32.Win32Windows.PostMessage(hWnd, <class>.WM_LBUTTONUP,
(IntPtr) OpenNETCF.Win32.Core.MK_LBUTTON, (IntPtr) (xpos | (ypos << 16)));
}
 
Back
Top