M
mottebelke
I want to use PostMessage to send a WM_LBUTTONUP message to a control
to simulate the clicking on that control.
The problem I have is that the function always returns an error: 87 -
Invalid parameter. This is even the case when I change the message to
WM_CLOSE for example.
I can't see where I went wrong.
[DllImport("coredll.dll")]
public static extern bool PostMessage
(
IntPtr hWnd, // handle to destination window
Int32 Msg, // message
Int32 wParam, // first message parameter
Int32 lParam // second message parameter
);
----
IntPtr hwnd=0;
if (storeObsButton != null)
{
// get hwnd of control
storeObsButton.Capture = true;
hwnd = GetCapture();
storeObsButton.Capture = false;
}
bool lngResult;
if (hwnd != IntPtr.Zero)
{
lngResult = PostMessage(hwnd, WM_LBUTTONUP, 0, 0);
}
----
to simulate the clicking on that control.
The problem I have is that the function always returns an error: 87 -
Invalid parameter. This is even the case when I change the message to
WM_CLOSE for example.
I can't see where I went wrong.
[DllImport("coredll.dll")]
public static extern bool PostMessage
(
IntPtr hWnd, // handle to destination window
Int32 Msg, // message
Int32 wParam, // first message parameter
Int32 lParam // second message parameter
);
----
IntPtr hwnd=0;
if (storeObsButton != null)
{
// get hwnd of control
storeObsButton.Capture = true;
hwnd = GetCapture();
storeObsButton.Capture = false;
}
bool lngResult;
if (hwnd != IntPtr.Zero)
{
lngResult = PostMessage(hwnd, WM_LBUTTONUP, 0, 0);
}
----