LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi doesn't work anymore after building the application as .exe

Hi,

 

I would like to shutdown my computer (W7 32bits) with an LabVIEW app.

For this i am using the "system exec.vi" from LabVIEW Toolbox.

I am using LabVIEW 2013 SP1 and I have administrators right on my computer.

My app contains:

1 VI Shutdown.vi

1 FGV getting elapsed time

2 .ctl

1 .ico

 

Problem :

My application works fine in the LabVIEW developpement system (Lauch Shutdown.vi to execute)

When i ask the app to shutdown the computer i have a Window popup which appear saying "Windows is going to shut down in less than a minute"

But after building my app as .exe and runnig it (Lauch Shutdown.exe to execute)

When i ask the app to shutdown the computer... Window popup doens't appear... and computer didn't shutdown !

 

I did so many trials like

* add "cmd /c" previous"shutdown /f /s /t xxx" command

* add "/n" at the end

* tried : Wait until completion = true/false

 

When the .exe is runnig and the command shutdown is asked, i can see a cmd window oppening and closing (same as .vi executing) but seems like the command line is not executed using .exe because Windows popup dosn't show up.

It is so weird VI works perfectly as expected and doesn't work after building the app...

 

Anyone already got similiar problems ?

Any help would be nice !

 

BR,

Vincent

0 Kudos
Message 1 of 15
(5,147 Views)

you may need to "Run <YourApp>as administrator" to gyrate through the Win OS access circus.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 15
(5,142 Views)

Thank you Jeff but i already tried this... ;(

It doesn't work.

 

BR,

Vincent

0 Kudos
Message 3 of 15
(5,133 Views)

Thanks aputman but this thread is relative to W2K and WXP OS. (more than 10 years old topic 🙂 )

Moreover, on W7 administrators users can shutdown their computer from a cmd line, an exe or VI.

I have tested same cmd line in a new empty project and windows popup appear shutting down W7... lauching VI or EXE.

 

Are threre known issues using system exec.vi and Event Loop ?

A capture of my code below attached...

 

BR,

Vincent

0 Kudos
Message 5 of 15
(5,110 Views)

Smiley Frustrated  My bad.  In my laziness, i didn't read the thread or try the VI.  Smiley Frustrated

aputman
0 Kudos
Message 6 of 15
(5,093 Views)

Are you getting any errors?

 

It looks like you've tried everything I had to do to get things to work.  But there might be something hidden in the error cluster.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 15
(5,090 Views)

Hello Vincent,

 

I've not yet confirmed that this is the case for your application, but by default the shutdown command requires that the instance of the cmd interface be elevated to admin, not just the application that invoked it.  This is an intentional feature of Windows UAC. 

 

I believe that if you want your application to be able to invoke other applications with elevated privileges, you'll need to ship it with a signed and modified manifest as per this help document:

 

LabVIEW Help: Windows Security Page (Application Properties Dialog Box)

http://zone.ni.com/reference/en-XX/help/371361K-01/lvdialog/windows_security_page/

 

Configuring your manifest for "highestAvailable" permissions might do the trick - I believe the command prompt should inherit the default priority of the calling process.  Again, I've not tried this for the shutdown command.

 

Also, have you taken a look at the outputs of the sysexec function?  Does LabVIEW return any errors, and do you see any information returned via STDOUT/STDERR?

 

Best Regards,

 

Tom L.
Message 8 of 15
(5,085 Views)

Hello Tom,

 

I think that manifest file could be the answer !! No time to test this today. I will feedback this issue as soon i fixed it... And give you kudos 😉

 

For your information, STDOUT/STDERR print nothing (blank) which mean everything is fine.

 

BR,

Vincent

0 Kudos
Message 9 of 15
(5,050 Views)

Hello !

 

Long time no feedback but this morning i spent few time on this manifest file and... i am getting mad ! Even if i think it is the good solution i can't manage to implement it.

 

Here is my cmd line :

"C:\Users\....\Microsoft SDKs\Windows\v7.0A\Bin\x64\mt.exe" -inputresource:"C:\....\myApp.exe" -out:myApp.manifest

 

cmd line returns :

Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.

 

But no manifest file appears...

What am i doing wrong ?!

 

BR,

Vincent

0 Kudos
Message 10 of 15
(4,940 Views)