From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows API dll (user32.dll) cause fatal error

Solved!
Go to solution
Hi,
On a setup, we using a touch screen. The LabView Software is running on full screen. I need to deactivage my front panel if the screensaver is on to prevent user start anyting. I use SystemParametersInfoA from user32.dll and this is working good, except, if I quit the software. "myexe a fin a error and need to close" (someting like that, my XP is in french).

I don't have issues in debug mode, this error happen in exe mode.

I use LV 8.6.1. Do you have any idea why?

Thank you
0 Kudos
Message 1 of 9
(5,071 Views)
I forgot, the error is comming when I close the front panel
0 Kudos
Message 2 of 9
(5,056 Views)
Integers are normally not 8-bit values with the Windows API. The MSDN page for that function indicates that three of those parameters are UINT. This refers to unsigned integers. You should be using a unsigned 32-bit integers, not 8-bit. The pvParam in this case needs to be a BOOL, which you can also use unsigned 32-bit integer.
0 Kudos
Message 3 of 9
(5,049 Views)

Thank, I will take care of this details. But, unfortunly, this not working.

 

uint32_t SystemParametersInfoA(uint32_t SPI, uint32_t 0, uint32_t *value, uint32_t False);

 

SPI = 114 = SPI_GETSCREENSAVERRUNNING

 

If *value != 0, screensaver ON, else scresaver OFF

 

Still have the fatal Windows error.

 

Thank

0 Kudos
Message 4 of 9
(5,041 Views)
Have you tried running it on another computer? I don't get a crash when I close the VI after it's been running.
0 Kudos
Message 5 of 9
(5,032 Views)
Solution
Accepted by topic author CFiset

CFiset wrote:

Thank, I will take care of this details. But, unfortunly, this not working.

 

uint32_t SystemParametersInfoA(uint32_t SPI, uint32_t 0, uint32_t *value, uint32_t False);

 

SPI = 114 = SPI_GETSCREENSAVERRUNNING

 

If *value != 0, screensaver ON, else scresaver OFF

 

Still have the fatal Windows error.

 

Thank


I noticed the Call Library Node having a rather strange path to user32.dll on the initial load. Do you happen to have copied that DLL somewhere and referencing it with full path in your VI?

 

That is a very big NO-NO! user32.dll and many other Windows system DLLs do weird things to the system and are utterly bad behavioured if you try to load another copy from somewhere else on disk than the system directory. Just change the library name to user32.dll only and let Windows pick the right DLL from its system directory.

 

Another problem with specifying the full path to a copy of such a DLL is that LabVIEW will think you need to have this specific DLL in a built application and will include it in the build. However your user32.dll is almost 200% VERY incompatible to just about any other Windows system out there, because of Windows version, Service Pack, and bug fix upgrades as well as different language versions of Windows.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
Message 6 of 9
(5,018 Views)

Thank rolfk,

 I just change the path from C:\Windows\System32\user32.dll to user32.dll. This work great.

 

Problem solved

 

Thank rolfk and smercurio_fc

Message Edited by CFiset on 08-11-2009 06:11 AM
Message Edited by CFiset on 08-11-2009 06:12 AM
0 Kudos
Message 7 of 9
(5,003 Views)

rolfk wrote:

I noticed the Call Library Node having a rather strange path to user32.dll on the initial load. Do you happen to have copied that DLL somewhere and referencing it with full path in your VI?


You know, I had seen the same thing but didn't think twice about it. I had thought it might have occurred when the VI was saved, or if the user was running a different OS, like Vista, or 7. Should've remembered we're talking about Windows here. 

0 Kudos
Message 8 of 9
(4,991 Views)

Hi.

 

I am kinda new to Labview and I had this problem while changing from version 2012 in my laptop to another PC with 2014. I attached the VI. 

 

My problem relays on the access violation related to the user32.dll. I can't find where to change the path to user32.dll or %windir%\System32\user32.dll as this knowledgebase (http://digital.ni.com/public.nsf/allkb/CE69D2C55480900486257B6A0037C327) sugests since I am not using a call library function node directly. 

 

I use the modules Mathscript RT and Control Design & Simulation. I also use VISA to comunicate with an Arduino via simple protocol I made. 

 

My program runs flawlessly on my laptop but when I try to use it in the other computer it crashes 10 sec after it starts. 

 

Some of the debugging I´ve made is to deattach my "Power Interface Circuit" to control a DC motor from the Arduino and this doesn´t seem to change anything. 

 

I would appreciate your help. Many thanks. 

0 Kudos
Message 9 of 9
(4,186 Views)