LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Window handle (hWnd) of string control/indicator?

Is it possible to get the window handle of a LabVIEW control? I know how to get the window handle of the VI (using FindWindowA in user32.dll) but I cannot figure out how to obtain a handle to an individual control, such as a string control or indicator. Any suggestions?
Thanks, Novak.
0 Kudos
Message 1 of 11
(6,140 Views)
> Is it possible to get the window handle of a LabVIEW control? I know
> how to get the window handle of the VI (using FindWindowA in
> user32.dll) but I cannot figure out how to obtain a handle to an
> individual control, such as a string control or indicator. Any
> suggestions?

You can't find the way to do it, because the LV controls are windowless.
You don't mention what it is you want it for, but many of the same
actions are possible using property nodes or the event structure. You
can also use ActiveX controls instead. Most of them are windowed, and
that will give you the HWND that you are looking for.

Post a question about what you are trying to do, if you are still stuck.

Greg McKaskle
Message 2 of 11
(6,142 Views)
Hi Greg,

I am using an activex control (IDL) that can attach to a text box so that it can print messages based on methods called on the activex control.

Could you give me an example of the three approaches mentioned: (i) using property nodes, (ii) event structure (iii) activex controls.

Instead of a string indicator I tried using a Microsoft Forms 2.0 textbox as an activex control but there appears to be no properties/methods that are of any use in obtaining a window handle to the control.

cheers,
Novak.
0 Kudos
Message 3 of 11
(6,142 Views)
> I am using an activex control (IDL) that can attach to a text box so
> that it can print messages based on methods called on the activex
> control.
>
> Could you give me an example of the three approaches mentioned: (i)
> using property nodes, (ii) event structure (iii) activex controls.
>
> Instead of a string indicator I tried using a Microsoft Forms 2.0
> textbox as an activex control but there appears to be no
> properties/methods that are of any use in obtaining a window handle to
> the control.
>

Let me make sure I know what you are wanting to do. You have an activeX
control that doesn't do its own display, but instead wants you to
provide it an HWND to a text box.

Hopefully the control has another way of getting the informatio
n. If
so, then you can catch an ActiveX event on the diagram and write the
string to the string indicator.

If there is no other way to get the information from the IDL control,
then I'd suggest either trying another ActiveX display, or use th Forms
2.0 and getting the HWND for the LV panel and getting the first child
window from there. You get the HWND for the panel from by its window
name. You can do this via DLL nodes and using windows SDK or look for
VI wrappers on the web.

Greg McKaskle
0 Kudos
Message 4 of 11
(6,142 Views)
Hi,

If you want 'fancy' text layout use Microsoft Rich Textbox Control. This
control does return a hWnd. It seems to work a lot like the Forms Texbox.

Regards,

Wiebe.


"Novak" wrote in message
news:506500000005000000E0AA0000-1031838699000@exchange.ni.com...
> Hi Greg,
>
> I am using an activex control (IDL) that can attach to a text box so
> that it can print messages based on methods called on the activex
> control.
>
> Could you give me an example of the three approaches mentioned: (i)
> using property nodes, (ii) event structure (iii) activex controls.
>
> Instead of a string indicator I tried using a Microsoft Forms 2.0
> textbox as an activex control but there appears to be no
> properties/methods that are of any use in obt
aining a window handle to
> the control.
>
> cheers,
> Novak.
0 Kudos
Message 5 of 11
(6,142 Views)
I was wondering if you ever figured out how to find the window handle of a string control/indicator? I am having the same problem. Thanks, Amy Young
0 Kudos
Message 6 of 11
(6,142 Views)
> I was wondering if you ever figured out how to find the window handle
> of a string control/indicator? I am having the same problem. Thanks,

ActiveX controls can be either windowed or windowless. LV native
controls are always windowless, and in fact aren't specific to windows
and are instead were written from scratch in C++.

This simply means that you need to access them through the VI Server
rather than using Windows messages or API calls.

Greg McKaskle
0 Kudos
Message 7 of 11
(6,142 Views)
Greg,
I've tried using the WinAPI call FindWindow() as you suggest to get the HWND of the front panel but it is not working for me. Maybe I'm having problems with the parameters. Are there examples of calling the WinAPI from a VI that might help me?
Thanks
0 Kudos
Message 8 of 11
(6,142 Views)
> I've tried using the WinAPI call FindWindow() as you suggest to get
> the HWND of the front panel but it is not working for me. Maybe I'm
> having problems with the parameters. Are there examples of calling
> the WinAPI from a VI that might help me?

This should work. Be sure that you use the complete Window title and
not just the VI name or title. I believe that there are VIs already
built by others that will return the HWND for a given VI name.

Greg McKaskle
0 Kudos
Message 9 of 11
(6,142 Views)
Mike,

Drop me a mail, and I send you a copy.

Regards,

Wiebe.

"mike leigh" wrote in message
news:5065000000050000001CE00000-1042324653000@exchange.ni.com...
> Greg,
> I've tried using the WinAPI call FindWindow() as you suggest to get
> the HWND of the front panel but it is not working for me. Maybe I'm
> having problems with the parameters. Are there examples of calling
> the WinAPI from a VI that might help me?
> Thanks
0 Kudos
Message 10 of 11
(6,142 Views)