LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Kernel32.dll - GetTickCount

Solved!
Go to solution

I am trying to learn how to use the kernel32 dll. The issue I am having is that the *.vi works fine but the *.exe throw a crash report when calling kernel32. If anyone has any ideas, it would be great to hear from you.

 

I can't find much information on the access violation and why it is only applicable for the *.exe file and not the *.vi file.

 

davidfox_0-1678986861985.png

 

0 Kudos
Message 1 of 14
(2,796 Views)

Try Access Violation 0xC0000005 Crash When Launching LabVIEW Executable

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 14
(2,781 Views)

Same error as the first time...

davidfox_0-1678989565675.png

 

0 Kudos
Message 3 of 14
(2,773 Views)

What is the 2nd dll call?

 

George Zou
0 Kudos
Message 4 of 14
(2,764 Views)

The second call is user32.dll

 

davidfox_0-1678990504918.png

 

0 Kudos
Message 5 of 14
(2,762 Views)

Here is a snippet for you all. Just a very simple Windows activity counter. 

deletemeSnip.png

0 Kudos
Message 6 of 14
(2,759 Views)

Change the Library path in the Call Library Node explicitly to kernel32.dll once and then save your VI!

 

It will revert to a full path but store only the library name. When you enter a full path, the Application Builder will take that as a hint that the DLL is application private and include it in the exe build (into the data subfolder). This is not only a violation of your Windows license if you distribute it, but it is also causing havoc since the kernel object management in your local copy does not match the one in the system directory.

 

As a quick fix right now just go into the data folder of your build app and delete the kernel32.dll in there. That will fix the crash (until you rebuild the executable if you don’t change the library name).

 

A DLL from the <system> folder, especially when it is a Windows one, should NEVER be included in your application build! 

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 14
(2,751 Views)

@david.fox wrote:

Here is a snippet for you all. Just a very simple Windows activity counter. 

deletemeSnip.png


What Rolf said...

 

But also just FYI, I'm pretty sure that LabVIEW's built-in "Tick Count (ms)" function is in fact just a call to GetTickCount(). There shouldn't be much reason to not just use that.

0 Kudos
Message 8 of 14
(2,731 Views)

Rolf,

The NI Tick Count is great and useful. But this application is to monitor keyboard/mouse idle time. If there is another way to do this, I would be more than happy to hear about it. As of now though, it appears the kernal and user32 is all that is able to count this for me.

0 Kudos
Message 9 of 14
(2,721 Views)

Correct. It does store it in the data folder and carries into the installation process too. Like you suggest, I would rather use the files located in the proper windows system folders on the target machine(s) rather than carrying them with the builds. But, to remark about that, this was the original setup and this setup was what made me start looking at the error. I have narrowed it down though. It is not the kernal that is causing the error. The error is coming from user32. I am a bit at a loss for how to get this working though. I am thinking that there may be another possibility to solve this problem. If it works, I'll post it to let you and any future reader know the solution.

0 Kudos
Message 10 of 14
(2,717 Views)