peters
November 5th, 2001, 06:56 PM
My code needs to push the OK button in a doalog box that it finds on the screen - put up by another app.
Any idea how to do this?
Peter
Any idea how to do this?
Peter
| // JP opened flex table
Click to See Complete Forum and Search --> : how to programmatically push the OK button in a dialog box peters November 5th, 2001, 06:56 PM My code needs to push the OK button in a doalog box that it finds on the screen - put up by another app. Any idea how to do this? Peter Korween November 8th, 2001, 06:06 AM Hi, There are two ways to create controls in Win programming : either you create your control with assistance of resource editor , or you create in source code object from CButton class(MFC), or child window (Win API). Bye antony holmes November 8th, 2001, 06:36 AM Hi, Firstly you will need to get a handle of the Window which has the OK button on it. You could use the FindWindow function for this. Then you will need to know the control ID. There is a good chance that this is IDOK. Then call PostMessage to emulate the button press, as below. CWnd *win=CWnd::FindWindow(NULL, "parent window text") ; win->PostMessage(WM_COMMAND, IDOK, 0L ) ; If the control ID is not IDOK and then you should be able to find the control ID using Spy++ Regards Tony codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved. |