![]() |
|
#1
|
|||
|
|||
|
Does simulating click affect GetMessagePos()?
I want to select one item of CTreeCtrl by sending message
WM_LBUTTONDOWN to it, but the CTreeCtrl's message processing function uses API GetMessagePos() to fetch the last message's position which is always not the one corresponding to my simulating WM_LBUTTONDOWN. The CTreeCtrl's message processing function further uses CTreeCtrl::HitTest() to check whether that item was clicked, and inevitably HitTest() returns NULL. My code is as follows: Code:
POINT ap={0x0027, 0x0289}, cp={0x0025, 0x00AE};
ScreenToClient((HWND)hTreeView, &ap);
cp = ap;
SendMessage((HWND)hTreeView, WM_LBUTTONDOWN, MK_LBUTTON, cp.y<<16|cp.x);
I have used SetCursorPos() to check them. And I have also tried the following code to activate the tree item, yet it was selected but not activated(its corresponding code was not executed): Code:
SendMessage((HWND)hTreeView, TVM_SELECTITEM, TVGN_CARET, hLstRetract); simulating message, it only returns the position of the last physical message say one actual click. Does anyone have an idea to defeat GetMessagePos()? Thank you. |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simulating a Button Push | lilmeanman | General Discussion | 16 | 02-18-2005 09:24 |