Click here to Skip to main content
15,906,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Cannot automate/simulate listview click of another process


I am developing an automation tool. I want to click listview item of another process
programatically. I have partially succeeded in doing(works with non-MFC but not working with MFC target application).I am getting a slightly different output.I used NMITEMACTIVATE(I have also used PostMessage Instead of SendMessage in the
code below).
C++,Win32
Small code detail:

C++
NMITEMACTIVATE nmbh;
		nmbh.hdr.code = NM_DBLCLK;
		nmbh.hdr.hwndFrom=g_hWnd;
		nmbh.hdr.idFrom=GetDlgCtrlID(g_hWnd);
		nmbh.iItem=itemval;
		nmbh.iSubItem=0;
		nmbh.uNewState=0;
		nmbh.uOldState=0;
		nmbh.uChanged=0;
		nmbh.uKeyFlags=0;
	        SendMessage(GetParent(g_hWnd), WM_COPYDATA,(WPARAM)g_hWnd,(LPARAM)&nmbh);
Posted

1 solution

Use PostThreadMessage to message to another thread/process:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644946(v=vs.85).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900