Sign in to follow this  
Followers 0
exolon

Methods for interacting with custom MFC controls

1 post in this topic

#1 ·  Posted (edited)

Hi,

I've seen a couple of threads on the topic of interacting with custom MFC controls.

So far, I haven't seen any successful methods described, so I thought we could maybe improve on that here?

The reason I've started looking at this is that I've been teaching a course involving assembly language for a simulated CPU. I wanted to use AutoIt to construct a simplistic test program to help students evaluate their programs (and so I could mark assignments quicker and more accurately!), but sadly the emulator is built with some kind of MFC custom controls inside MDI child windows, which return nothing via ControlGetText(). The controls appear to be of class AfxFrameOrView42s, which I suppose is some base class they extend.

I'm going to investigate (with some dread) MFC more. Until then, I have a couple of basic questions:

  • Are there other Windows messages that MFC controls might respond to with their text?
  • If the control uses some kind of drawing canvas, is it possible to retrieve the canvas handle and the text objects which have been rendered to it?
  • Other techniques... a proprietary tool called ScreenScraper successfully retrieved the window contents, albeit only the text visible at the scroll location onscreen. However, it was fast and accurate, which suggests that it wasn't using OCR. I'd like to be able to distribute simple test scripts without relying on that proprietary library, though.
[edit]

Other possibilities maybe worth exploring are DLL calls into the MFC libraries to access the MFC document/view objects, or maybe some COM object for same?

[edit 2]

While I'm at it, it looks like I might be able to hook the GDI drawing calls, and catch the strings drawn to the target window's DC (a bare list of machine registers and contents)... but that seems slightly... awful. But if it's the only way...

Edited by exolon

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0