// 注意这里是向本进程的ListView窗口发送NM_DBLCLK通知,通过WM_NOTIFY消息,WM_NOTIFY不能跨进程,主要是因为SendMessage发送WM_NOTIFY消息最后一个LPARAM参数是个指针。 // MSDN上有明确说明:For Microsoft Windows 2000 and later systems, the WM_NOTIFY message cannot be sent between processes。 int nId = ::GetDlgCtrlID(HWND_LISTVIEW); // HWND_LISTVIEW为ListView的窗口句柄 NMITEMACTIVATE nmitem = {0}; nmitem.hdr.code = NM_DBLCLK; nmitem.hdr.hwndFrom = HWND_LISTVIEW; nmitem.hdr.idFrom = nId; nmitem.iItem = 5; nmitem.iSubItem = 1; // 这里模拟点击ListView的第6行第2列 ::SendMessage(::GetParent(HWND_LISTVIEW), WM_NOTIFY, (WPARAM)nId, (LPARAM)&nmitem);