AnsweredAssumed Answered

vrf Window Handles

Question asked by g.nied on Apr 14, 2002
Ian,

there is no easy way to accomplish this task.
However there is a way but it is compliated...
First of all you have to find some window handles of the vee software. I use
the following way to find them:

1) get the process ID of the current thread (Kernel.GetCurrentProcessId)
2) loop through all desktop windows and compair their process ID
(User.GetWindowThreadProcessId) with mine until it matches
3) This is now the VEE_hWnd
4) Get the class name of this window (might be HPEE or AgilentVEE)
(User.GetClassNameA)
5) append the string "_CHILD2" for the new class to search for
6) Find first child Window of VEE_hWnd of that class with
User.FindWindowExA. This is the interior window of VEE (without title and
toolbar). Store it as VEE_hWnd1.
7) Find first child Window of VEE_hWnd1 of that class with
User.FindWindowExA. This is the window of the VEE edit region. Store it as
VEE_hWnd2.
8) Now get the first child window of VEE_hWnd2 with
User.GetWindow(A,GW_CHILD). When your VEE program is running its execution
window is the upmost window and therefore found as fist child of VEE_hWnd2.
Store it as VEE_Main_hWnd.
9) The first child window of VEE_Main_hWnd is the interior of the execution
window and I store it as VEE_Main_client_hWnd


If these handles are found you can find the window handle of a user functon
as follws:

1) get the position of your user function. This is in coordinates wich are
relative to the VEE Execution Window, so you need to transform them with:
     User.ClientToScreen(VEE_Main_Client_hWnd,lpPoint)
2) Now you can use the User.WindowFromPoint(x,y) function, to find the
window handle of the UserFunction.
Special care must be taken, if the upper left corner of the panel is out of
view (x or y < 0). In this case you can read out the panel size and this way
calculate the coords of the lower right corner and find its owner window the
same way.

Did that help?

     Georg Nied
Software-Development
Test and Measurement
51149 Cologne  Germany
g.nied@gn-software.de


-----Original Message-----
From: owner-vrf@lvld.agilent.com [mailto:owner-vrf@lvld.agilent.com]On
Behalf Of WILLIAMS,IAN (A-Scotland,ex1)
Sent: Wednesday, April 10, 2002 12:40 PM
To: 'Vrf (E-mail)'
Subject: vrf Window Handles


Hi All,

Does anybody have a simple method of returning the window handle of a user
function panel? I have tried using the API function FindWindowA with a class
name of AgilentVEE_CHILD and some valid text. However this doesn't work!

=====================================================================
  Ian Williams,                      Phone : +44 (0)131 335 7724
  EPSG51M,                          Telnet: 313-5724
  Agilent Technologies UK Ltd,
  South Queensferry,
  Scotland, EH30 9TG                Email: ian_williams2@agilent.com
=====================================================================



---------------------------------------------------------------------
This is the "vrf" maillist, managed by Majordomo.  To send messages to
this maillist, just email to "vrf@lvld.agilent.com".  Subscriptions and
unsubscriptions are done through the address "vrf-request@lvld.agilent.com".
If you need details, just send a message containing the text "help"
to "vrf-request@lvld.agilent.com".
---------------------------------------------------------------------

---------------------------------------------------------------------
This is the "vrf" maillist, managed by Majordomo.  To send messages to
this maillist, just email to "vrf@lvld.agilent.com".  Subscriptions and
unsubscriptions are done through the address "vrf-request@lvld.agilent.com".
If you need details, just send a message containing the text "help"
to "vrf-request@lvld.agilent.com".
---------------------------------------------------------------------

Outcomes