views:

209

answers:

0

hello,

I create MyWindow class derived from Window, and I capture the Window Messages refer nonclient area, for example WM_NCLBUTTONDOWN, it works :).

I want create my event and rise them when the message comes.

    public event MouseButtonEventHandler MouseButtonDownOnCaption;
    protected virtual void OnMouseButtonDownOnCaption(object sender, MouseButtonEventArgs e)
    {
        if (MouseButtonDownOnCaption != null)
        {
            MouseButtonDownOnCaption(this, e);
        }
    }

but I don't now how can I rise this event

private IntPtr HookHandler(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled){

switch (msg) { ... case WM_NCLBUTTONDOWN: if (wParam.ToInt32() == HTCAPTION) { OnMouseDown(new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left)); } ... }

This solution isn't works, becouse when I reading args, always e.LeftButton == MouseButtonState.Released

What I do wrong?

sorry for my English.