Custom controls in AUT and Winrunner customization
I need to write custom extensions (in a DLL, probably) to get at string data within some custom controls. I'm guessing that I will need to use the "MIC" api? My biggest question: Since my AUT and the WinRunner executor are two seperate windows processes, how can I pass string data from my AUT to my WinRunner script? (In Win32, you have to go out of your way to sneak strings, or any pointed-to data, for that matter, accross the process boundary.)
Out AUT has a grid window, the grid being a proprietary custom control. Since our grid does its own drawing and is not a "standard" control, WinRunner sees it as one big giant blob. (e.g. When I record a script, WinRunner sees x,y mouseclick pixel locations, not grid cell addresses.) For many years we have been using QA Partner/SilkTest. QAP had the same issue. The way we got around this was to use the QAP "customization API" to write some helper functions to expose info about the grid. We were able to drive the current selection rectangle around the grid using arrow keys, page up/down, etc. But, we needed to use the helper function to actually get the contents of the currently-selected cell, and to get the row/column headers (since these couldn't be independently selected via keystrokes). Now, QA Partner's extension kit provided an "ASSIST" library that had an external function registrar. Our EXE simply registered C functions with this registrar. At runtime, the QAP script could call these functions, no problem. I think QAP used an RPC mechanism to make the call. This would also take care of marshalling parameters and return values back and forth between QAP and the AUT.
We are moving off of QA Partner and over to WinRunner, so we will need to port the existing QAP scripts over to WinRunner. Thus we will also need to recreate the helper functions in a way that they can be called by WinRunner. In the example of my "GetCellContents" function, I need to be able to ask the AUT, whether directly or via an intermediate DLL, to return a string to my WinRunner script....
Can anyone offer advice of how to approach this? I have found the WinRunner customization guide to be less than helpful. WinRunner Support says that I'm on my own....
Again, at the risk of repeating myself... the issue I have is with data visibility between processes. I know how to write a DLL, export its functions, etc.
Re: Custom controls in AUT and Winrunner customization
To "sneak strings across the process boundary" (aptly put!) the usual method is to subclass the window, which means put a callback function in place of the normal windowproc. You can use the function SetWindowLong for this.
Your callback function should pass any messages it doesnt use on to the original windowproc.
Once the callback function is installed, you can pass a message to the control with SendMessage.
The rest is just fiddly detail :_)