I have written a VC++ 6.0 application which monitors and interacts with third party Windows applications. Specifically, it screen scrapes the graphics in the application window and, based on what it finds, sends mouse events to check boxes and push buttons to drive the application. Everything works fine for the first application I tried, but the second application doesn't seem to recognize and process the mouse clicks. The screen scraping works for the second application, but not the mouse clicks.
Is there some other way this application could get and process mouse clicks other than the normal message processing?
If so, is there any way I can simulate that process in my program?
Are there other messages I could send which would work?
Below is the pertinent code used to accomplish this (commented lines were tried but did not fix the problem).
// Get a handle to the window based on the window class and name.
HWND hWindow = FindWindow( className, windowName );
CWnd* pWindow = CWnd::FromHandle( hWindow );
if ( ( pWindow != NULL ) && ( IsWindow( pWindow->m_hWnd ) == TRUE ) )
// ... Screen scrape the window to determine the button location
WPARAM wParam = MK_LBUTTON;
LPARAM lParam = buttonX + 65536 * buttonY;
// pWindow->PostMessage( WM_MOUSEMOVE, 0, lParam );
pWindow->PostMessage( WM_LBUTTONDOWN, wParam, lParam );
pWindow->PostMessage( WM_LBUTTONUP, wParam, lParam );