简体   繁体   中英

Windows Form Automation in C++ using low level WinAPI Calls?

I am working on a project that is supposed to take a program written in C++ using Windows forms (a basic calculator taking two ints, an operator and has an equals button) and automates it using C++ and low level WinAPI calls.

I have been googling a bit, but most of the references I find on this are fairly old and I want to make sure I'm going in the right direction. I see OLE Automation but not sure if that's the right direction

What I do know: I cannot use Reflection, any 3rd party library including Visual Studio's UI/Testing automation assemblies.

I assume whatever I use I will launch the application, get the window by it's title, get each element by the element name somehow, simulate a click, read the calculated value, etc. It's just getting there that is the problem

It sounds like you're familiar with the basics of window handles and such so I'll skip that part, but here are some pointers to help you get started:

To find the form's control windows - EnumChildWindows()

To send messages to each of those windows - SendMessage()

Finally, a list of the messages you can send to buttons - Button Messages (for your program check out the BM_CLICK message in particular)

You can find MSDN references for each of the other controls' messages by goggling "msdn edit control (etc.) messages".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM