LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bring Window Forward Executable

Solved!
Go to solution

Hey Guys and Gals,

 

I'm trying to incorporate some code to bring my executable forward to the front of all other open programs when called to. The example here (https://forums.ni.com/t5/Example-Programs/Programmatically-Move-Any-Window-to-the-Front/ta-p/3532516) works in development, but if I make the linked vi an executable it will crash when opened. The same happens when I incorporate the code into my application, it will crash upon opening.

 

Any ideas on how to remedy this?

 

Sean

0 Kudos
Message 1 of 8
(1,982 Views)

Is the window name the same as an executable as it is in development environment?

0 Kudos
Message 2 of 8
(1,975 Views)

For my application it is.

0 Kudos
Message 3 of 8
(1,968 Views)

Is it a bitness (64bit vs 32bit) problem between your runtime and Windows DLL? 


aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 4 of 8
(1,946 Views)

@aputman wrote:

Is it a bitness (64bit vs 32bit) problem between your runtime and Windows DLL? 


Wouldn't bitness be the same for development and RT?

 

But then again, the bitness is probably the problem. That handle probably needs to be a system sized pointer. If you are on a 64 bit system, it will never work properly.  The development environment might live in lower regions of memory, so might succeed coincidentally.

0 Kudos
Message 5 of 8
(1,920 Views)
Solution
Accepted by mckesea7010

Bring Window Forward LV2013.png

 

Tested this in 32 bit LV 2013 and 64 bit 2018.

 

No guarantees.

Message 6 of 8
(1,917 Views)

Operating system is Windows 7 64 bit, and I have 32 bit LabView 2017.

 

wiebe@CARYA, thank you for the time you took for the solution provided. It works in my executable now! I am going to study the changes you made and try to understand further the "why" behind my solved problem. I am not versed in these types of issues. Thanks again!

0 Kudos
Message 7 of 8
(1,901 Views)

@mckesea7010 wrote:

Hey Guys and Gals,

 

I'm trying to incorporate some code to bring my executable forward to the front of all other open programs when called to. The example here (https://forums.ni.com/t5/Example-Programs/Programmatically-Move-Any-Window-to-the-Front/ta-p/3532516) works in development, but if I make the linked vi an executable it will crash when opened. The same happens when I incorporate the code into my application, it will crash upon opening.


Most likely the path to the Windows DLL was altered in your Call Library Node and it now contains the entire path to the DLL rather than just the DLL name itself (user32.dll or kernel32.dll or similar).

When you build an application, LabVIEW considers DLL names with full path in the Call Library Node to be private DLLs and copies them into the application folder. On startup LabVIEW tries to specifically load that private DLL instead of the System DLL and then things start to get very haywire. These system DLLs are not programmed in a way that allows them to be instantiated from other places than the Windows System folder and on initialization they crash the whole process rather sooner than later.

 

Solution is to go into the Call Library Nodes and make sure they only specify the actual DLL name without any path. Then rebuild your executable and all is well!

Rolf Kalbermatter
Averna BV
Message 8 of 8
(1,885 Views)