LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Don't include USER32.DLL in built application

Hello,

I would like to avoid including USER32.DLL in the installer for my built application. I am using several Windows API functions from USER32.DLL, and as soon as I select the top-level VI, an entry for USER32.DLL shows up if I click the "Files" button on the "Installer Settings" tab. I want to just use the local version of the DLL once it's installed.

I'm using another windows DLL, and it somehow isn't getting included - I think because in the "Call Library Function" configuration dialog there is no path, just the file name. If I try to delete the path from my calls to USER32.DLL (i.e. delete "C:\WINNT\System32\"), it automatically re-appears once I close and reopen the dialog box. I've also tried using just "USER32.*", but the path still gets added automatically.

Any ideas?

TIA,

Jaegen
0 Kudos
Message 1 of 4
(4,100 Views)
I made a VI using CloseWindow from USER32.DLL. I used the browse button to find the DLL saved the VI and closed LV. Then I reopened the VI and deleted the path, saved it and closed LV. After the next reopen the path was away. All tested with LV 7.1.1.

If you use adifferent version which one do you use?
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 4
(4,059 Views)
Waldemar,

Thank you very much for your insight.

This is a very interesting/intriguing problem ... Please bear with me as I try to describe it:

It seems that LV is treating DLLs exactly as it would a sub-VI. Once one VI which uses a DLL is loaded into memory, all other VIs which use a DLL with the same name, regardless of the path used, use the same DLL. I was trying to delete the path in one VI, while other VIs with the path were in memory. Therefore, as soon as I clicked OK, LV just went ahead and added the path again. However, if I loaded the VIs separately, I was able to delete the path. I was tipped off when I did this with only one sub-VI, then loaded the top-level VI and was presented with the warning that "USER32.DLL" was actually found at "C:\WINNT\system32\USER32.DLL" for the VI I had changed.

Now of course the problem arose as to how I delete the path for a DLL call when the VI has two separate calls to the same DLL (i.e. if I delete the path for one, while the other still has the path, it won't be deleted). I had to mangle the name in one call ("C:\WINNT\system32\xUSER32.DLL"), delete the path in the other ("USER32.DLL"), then delete the path in the first. Likewise, when one VI with a call to the DLL uses a sub-VI which also calls the DLL, I had to go through this process with all the calls in all the VIs.

I hope I'm making sense. I was able to eventually get the paths permanently deleted from every call, and "USER32.DLL" no longer appears when I go to build an executable.

I'm not sure if this is a bug per se. I'm not sure what else LV could do, other than display a warning dialog when you click OK on the DLL config dialog. However, it would be nice if the application builder allowed DLLs to not be included (even if it thinks they need to be).

By the way, I did work out a very interesting work-around for this before realizing the details I described above: I included a batch file in the installer, which I called using the "Run executable after installation" option, which cd'ed to the install path, deleted USER32.DLL, then deleted itself (I didn't know this was possible until now).

I did however discover a bug in the application builder help documentation:

On the page titled "Advanced Installer Settings Dialog Box (Windows, Professional System Only)", the "- Executable" paragraph states "The file must be one of the files that you install in the Installer directory you selected in the Installer Settings tab." This is not the case. It should read:

"The file must be one of the files copied to the *Install Directory* using the "Installation Destination Settings" dialog. (Click the "Files..." button on the "Installer Settings" tab)."

Note "Install Directory", not "Installer directory".

Hopefully this all makes sense and is informative.

Cheers,

Jaegen
Message 3 of 4
(4,049 Views)
I was recently involved in another thread about App Builder and DLL.

I don't use custom build DLLs in our projects so I have not to much experience with it. It seems, that App Builder will include the DLL if there is an absolute path in the Configure Node Dialog or the DLL is not found in the folders the OS will look. Otherwise the DLL and all its sub DLLs will be ignored in the build. For me this makes sense.

I have given out the rule to all my programmers never to use a absolut path in the Configure Node Dialog. All system DLLs are there and the custom build DLLs are where the app is installed.

Your "C:\WINNT\..." path would not work on XP machines since it will install to "C:\Windows\..." by default. And I have setup a test system where the OS is on D:\ and the program files are on E:\ so the path would be "D:\WINNT\..." and "E:\Program Files\...". And the later one is depended of the OS language. On my German Windows it is named "Programme". So never rely on any paths regarding where OS files are and your application will be installed.
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 4 of 4
(4,042 Views)