views:

291

answers:

0

Hi! I want to double click one row of a SysListView32 via another application. My codes are as follows:

NMHDR  *pnmhdr = (NMHDR*)VirtualAllocEx(hProcess, NULL, sizeof(NMHDR), MEM_COMMIT, PAGE_READWRITE);
NMHDR nh;   
nh.hwndFrom = listview;   
nh.idFrom = ::GetDlgCtrlID(listview);
nh.code = NM_DBLCLK;
WriteProcessMemory(hProcess, pnmhdr, &nh, sizeof(NMHDR), NULL);
::SendMessage(::GetParent(listview), WM_NOTIFY, (WPARAM)listview, (LPARAM)pnmhdr);

But,it doesn't work. What's wrong with my code?

I have tried the methods mentions here and also failed: http://stackoverflow.com/questions/974722/send-a-double-click-to-a-listview-c-not-net