开发者

how can i "screen scrape" other windows program in VB6?

I would like to monitor a process every second until it displays an expected "error" message.

how can i monitor something.exe and get notification via "screen scraping" the error message from so开发者_StackOverflow社区mething.exe all from my vb6 program ? is it possible to terminate or click the "okay" button from vb6 ?

is this sort of thing better suited for VB.net ?


Create a vb app that runs with a timer that fires at the desired frequency. Depending on the error that pops up, you may end up having to create this as a windows service to allow it to continue running (the main error window may lock access to other windows until dealt with).

Look at the API function EnumWindows. It will get you a collection of the windows/functions currently open. When a new window is added you can detect that a new error window has been displayed to the screen.

The error should bubble to the top automatically, but you can use the BringWindowToTop api call on the new window's hwnd just to be sure.

Not an exact fit but links for reference you can build from:

api help: http://www.freevbcode.com/ShowCode.Asp?ID=701

help in capturing the image: http://www.codeproject.com/KB/vb-interop/DesktopScreenshotInVB6.aspx

Killing the error message - you can try to use the api to click the button or alternately you can hard kill the app generating the error. quick kill via api:

SendMessage app_hWnd, WM_CLOSE, 0, 0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜