in reply to Simulating mouse clicks in Windows

Have you tried capturing the sequence of messages sent and recieved when you click the button with the mouse and then emulating that sequence?

I'd start capturing when the app doesn't have focus, and the pointer is off the apps window. Then bring the mouse over the window to the button and click. If seen dialog procedures for controls that only start taking notice of msgs once they receive a mouseover msg, and the stop again once they receive a mouseout.

If you started by sending the full sequence captured and it works, then you can start omitting stuff until it stops working again. I've never tried this from perl, but it's worth a shot maybe.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Replies are listed 'Best First'.
Re: Re: Simulating mouse clicks in Windows
by tall_man (Parson) on May 30, 2003 at 00:14 UTC
    Thanks, BrowserUK.

    I am trying your approach, but every little thing that is done in Windows produces an overwhelming flood of messages,so it's hard to sort the wheat from the chaff. Here is a sequence:

    <00010> 0003009C P WM_MOUSEMOVE fwKeys:0000 xPos:67 yPos:7 <00011> 0003009C P WM_MOUSEMOVE fwKeys:0000 xPos:47 yPos:5 <00012> 0003009A S WM_PARENTNOTIFY fwEvent:WM_LBUTTONDOWN xPos:87 yPos +:8 <00013> 0003009A R WM_PARENTNOTIFY <00014> 00030098 S WM_PARENTNOTIFY fwEvent:WM_LBUTTONDOWN xPos:92 yPos +:13 <00015> 00030098 R WM_PARENTNOTIFY <00016> 000200AE S WM_PARENTNOTIFY fwEvent:WM_LBUTTONDOWN xPos:92 yPos +:13 <00017> 000200AE R WM_PARENTNOTIFY <00018> 00030096 S WM_PARENTNOTIFY fwEvent:WM_LBUTTONDOWN xPos:92 yPos +:13 <00019> 00030096 R WM_PARENTNOTIFY <00020> 0003009C S WM_MOUSEACTIVATE hwndTopLevel:00030096 nHittest:HTC +LIENT uMsg:WM_LBUTTONDOWN <00021> 0003009A S .WM_MOUSEACTIVATE hwndTopLevel:00030096 nHittest:HT +CLIENT uMsg:WM_LBUTTONDOWN <00022> 00030098 S ..WM_MOUSEACTIVATE hwndTopLevel:00030096 nHittest:H +TCLIENT uMsg:WM_LBUTTONDOWN <00023> 000200AE S ...WM_MOUSEACTIVATE hwndTopLevel:00030096 nHittest: +HTCLIENT uMsg:WM_LBUTTONDOWN <00024> 00030096 S ....WM_MOUSEACTIVATE hwndTopLevel:00030096 nHittest +:HTCLIENT uMsg:WM_LBUTTONDOWN <00025> 00030096 R ....WM_MOUSEACTIVATE fuActivate:MA_NOACTIVATE <00026> 000200AE R ...WM_MOUSEACTIVATE fuActivate:MA_NOACTIVATE <00027> 00030098 R ..WM_MOUSEACTIVATE fuActivate:MA_NOACTIVATE <00028> 0003009A R .WM_MOUSEACTIVATE fuActivate:MA_NOACTIVATE <00029> 0003009C R WM_MOUSEACTIVATE fuActivate:MA_NOACTIVATE <00030> 0003009C P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:47 yPos:5 <00031> 00030096 S WM_WINDOWPOSCHANGING lpwp:0140FCC0 <00032> 00030096 R WM_WINDOWPOSCHANGING <00033> 00030096 S WM_WINDOWPOSCHANGED lpwp:0140FCC0 <00034> 000200AE S .WM_WINDOWPOSCHANGING lpwp:0140FBA0 <00035> 000200AE R .WM_WINDOWPOSCHANGING <00036> 00030096 R WM_WINDOWPOSCHANGED <00037> 00030096 S WM_ACTIVATEAPP fActive:True dwThreadID:00000000 <00038> 00030096 R WM_ACTIVATEAPP <00039> 00030096 S WM_NCACTIVATE fActive:True <00040> 00030096 R WM_NCACTIVATE <00041> 00030096 S WM_ACTIVATE fActive:WA_ACTIVE fMinimized:False hwnd +Previous:(null) <00042> 00030096 S .WM_SETFOCUS hwndLoseFocus:(null) <00043> 00030096 S ..WM_KILLFOCUS hwndGetFocus:000200AE <00044> 00030096 R ..WM_KILLFOCUS <00045> 000200AE S ..WM_SETFOCUS hwndLoseFocus:00030096 <00046> 000200AE R ..WM_SETFOCUS <00047> 00030096 R .WM_SETFOCUS <00048> 00030096 R WM_ACTIVATE <00049> 000200AE S WM_KILLFOCUS hwndGetFocus:000200AE <00050> 000200AE R WM_KILLFOCUS <00051> 000200AE S WM_SETFOCUS hwndLoseFocus:000200AE <00052> 000200AE R WM_SETFOCUS <00053> 0003009C P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:47 yPos:5 <00054> 0003009C P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:47 yPos:5 <00055> 0003009C P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:47 yPos:5 <00056> 0003009C P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:47 yPos:5 <00057> 0003009C P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:47 yPos:5 <00058> 0003009C P WM_MOUSEMOVE fwKeys:MK_LBUTTON xPos:47 yPos:5 <00059> 0003009C P WM_LBUTTONUP fwKeys:0000 xPos:47 yPos:5 <00060> 0003009C S WM_CAPTURECHANGED hwndNewCapture:00000000 <00061> 0003009C R WM_CAPTURECHANGED <00062> 0003009C P WM_MOUSEMOVE fwKeys:0000 xPos:47 yPos:5 <00063> 0003009C S WM_WINDOWPOSCHANGING lpwp:0140F880 <00064> 0003009C R WM_WINDOWPOSCHANGING
    What it looks like to me is that there is a cascade of WM_PARENTNOTIFY messages from the lowest child up the parent tree. Then there is a cascade of WM_MOUSEACTIVATE messages up the tree (each returning a MA_NOACTIVATE). I don't think the WM_WINDOWPOSCHANGING messages matter, but the WM_ACTIVATEAPP and WM_SETFOCUS messages at the top level probably do.

    Pretty messy, but I'll keep working on it.