Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Using kernel32.dll Functions in LabVIEW 8.5.1 Returns 0 Under Windows Vista

Primary Software: LabVIEW Development Systems>>Professional Development System
Primary Software Version: 8.5.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have created an executable in LabVIEW 8.5.1 that use a Call Library Function Node to call the SetSystemTime function of the kernel32.dll library.

The executable uses the SetSystemTime function do modify the date and the time of the Operating System.
If I run the executable under Windows XP the function returns 1 and the date and the time are modified. When I run it under Windows Vista the function returns 0 and there are no changes in the date and time.



Solution:
The reason why SetSystemTime function returns 0 under Windows Vista is because this Operating System introduced higher security standards compared to Windows XP.

The SetSystemTime function requires Administrator rights to run correctly.
Every time an application requiring Administrator rights is started, UAC ( User Account Control ) will bug with this message: Windows needs your permission to continue.
Only if this pop-up is shown an application will use a user's full administrator access token.

If the UAC prompt doesn't shows up, that means the application won't run with Administrator privileges even if you logged on as a user belonging to the Administrator group. Vista does this automatically for UAC compliant tools. However, with legacy applications Vista often fails to detect if Administrator privileges are required.
In order to work correctly the executable needs to be elevated to run as Administrator rights.

To do this follow these steps:

  • Right click on the executable file and select Properties from the menu.
  • Click on the Compatibility tab.
  • Check the Run this program as an administrator checkbox.
  • Click the Apply button and then the OK button.

 

 



Related Links:
Vista’s UAC: 8 ways how to elevate an application to run it with Administrator rights

Attachments:





Report Date: 07/18/2008
Last Updated: 07/25/2008
Document ID: 4NH6I253

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit