Can I get window id/hwnd values from Windows?
I am trying to use QTP on an application developed in Uniface. The problem is: the windows and winobjects and winedit values of window id and hwnd change. So, the window id/hwnd value does not match that recorded in the object repository. Thus, the object is not found and script does not work. QTP will not let me use GetROProperty. I can't use Regex since QTP says it is a constant.
What I would like to do is find a way to get hwnd/window id from the newest run of the application. I could then write code to change the object hwnd/window id in the repository to the value of the latest run.
Is there a possibility that values like hwnd/window id might be available say in the registry? or perhaps a temp file? where I could get the value using VBscript? Using QTP to get the value of window id/hwnd simply does not work.
Re: Can I get window id/hwnd values from Windows?
Things don't work this way. HWND's are dynamically allocated at runtime by the operating system and ALWAYS change between runs. You can NEVER rely on them to be the same.
In most cases, window ID's are static, however, there are window types where they change dynamically as well. The same goes for window classes - most are static but some change slightly between runs.
This is why you must use other properties to identify a window (i.e. text/title, etc).
Experimentation is your friend in this case.