LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hwnd in windows 7

Shivels

Hi guys and gals,

 

I have a strange issue I can't seem to figure out.  I have some subvis which I downloaded from the fourm.  The subvis allow you to paste the output of a cmd prompt into an indicator on the LabVIEW front panel.  The subivs ran find under WinXP, but under Windows 7, LabVIEW is unable to locate the hwnd of the command prompt.  I am using System exec to open a cmd prompt.  If I set the "run minimized" option to T under Windows 7, the program is able to find the hwnd but the cmd prompt is display on the screen.  If I set the "run minimized" option to F, the program is unable to find the hwnd under Windows 7 but can find the hwnd under WinXP.  Does anybody know what might be the issue.  I think maybe the inner workings of USER32.dll might have changed, but I can't find any solid information.

 

Cheers,

0 Kudos
Message 1 of 7
(3,626 Views)

Well, it appears than when you try to run cmd.exe minimized in Win7, no window opens at all, which would explain why you don't get a window handle.

0 Kudos
Message 2 of 7
(3,620 Views)

The cmd window dosen't open because I run the System Exec command with the "Run minimized" option as true.  If I run it with false, the cmd window is shown and I can get the hwnd.  But in WinXP, I can run it minimized and still get the hwnd to the command.  That is what confuses me.  I'm wondering if it something changed in how the USER32.dll searches for window handles in Windows 7. 

0 Kudos
Message 3 of 7
(3,608 Views)

The window is not being created.  If you use Notepad, everything will work as you expect.  Something specific to how the command prompt is called causes the window to be created differently.  In XP, it appears the window is still created, it is just hidden, but in Windows 7 it is not created.  You can see the process is running in task manager.  I got a list of all windows, hidden and visible, and the command prompt window is no where to be found.

 

Using notepad, you will see notepad shows up on the taskbar, even minimized.  Going back to LabVIEW 8.6, it appears that the command window never shows up on te taskbar when you set to run minimized.

 

I'm curious if NI is launching the process in a manner that could be replicated outside of LabVIEW.  They used to use a CIN node for System Exec, but now the block diagram is password protected.

0 Kudos
Message 4 of 7
(3,598 Views)

Interesting.  I wonder what happend between Vista and 7 because it works in Vista.  I wonder if it has something to do with the UAC in windows 7 or possibly the run as administrator option since the cmd prompt in windows 7 is named "Administrator: C:\system32\cmd"  I'll keep digging into it and see what I come up with.

 

Cheers,

Shivels

0 Kudos
Message 5 of 7
(3,580 Views)

It is not just Admin mode, as I tested in normal mode as well.

0 Kudos
Message 6 of 7
(3,569 Views)

I think I know what might be the problem, but I have no idea (as of yet) how to fix it.  This link explains the conhost.exe that runs under cmd.exe and its changes from previous versions of windows to windows 7.

 

http://www.howtogeek.com/howto/4996/what-is-conhost.exe-and-why-is-it-running/

 

I wonder if I might have to get the hwnd of the conhost window instead of the cmd window.

 

Cheers,

Shivels

0 Kudos
Message 7 of 7
(3,547 Views)