08-11-2015 12:36 PM
Hello,
I apologize because I don't fully understand Win32.
I have the full development system for LabVIEW 2014 and would like to access the Win32 API.
I am trying to write a function to determine if a printer is out of ink or offline for whatever reason.
I see the MSDN Winspool library has the functions I need.
According to the MSDN, the dll is Winspool.drv.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd162751(v=vs.85).aspx
I tried to do a call library function in LabVIEW, but it is looking for DLL's and does not recognize the Winspool.drv
Are there built in methods in LabVIEW to access the Winspool, or does anyone know what the correct dll (and location) I need to call is?
Ultimately what I want to do is open printer -> get jobs -> get status -> close printer.
Sounds simple enough.
Thank you in advance for any advice.
Solved! Go to Solution.
08-11-2015 12:57 PM
What OS are you using? I have used several of those functions in 32-bit LV on Win7 32-bit with no problem. Winspool.drv is the library name that I use and all of the functions appear as expected.
08-11-2015 01:03 PM - edited 08-11-2015 01:04 PM
Hello,
I have Windows 7 64bit version.
I grabbed the winspool.drv from the system32 folder.
Am I using the correct call method?
I tried adding the winspool.drv using the Call Libary Method. The function name drop down is not being populated by any of the library functions. I did get an error on importing the file stating that the library selected is not valid for the current platform.
08-11-2015 01:32 PM
Are you using a 32-bit or 64-bit version of LabVIEW? If you're using the 32-bit version, you shouldn't try to load the 64-bit version of the DLL. Amazingly, the System32 directory is for 64-bit DLLs, and the SysWOW64 directory is for 32-bit DLLs. If you installed the 32-bit version of LabVIEW, try winspool.drv from SysWOW64.
08-11-2015 01:36 PM
Using 64-bit LV and Win7 it also works just fine, are you simply putting 'Winspool.drv' into the Library name or path control? Make sure you set the calling convention to WinAPI.
08-11-2015 01:37 PM - edited 08-11-2015 01:39 PM
You'd think it would be the other way around with 32bit stuff in System32, etc.
I can import functions using the winspool.drv from the SysWOW64.
I am using 32 bit LabVIEW and 64 bit Windows.
Now I just got to do some r&r and figure this out.
Thanks.
08-12-2015 03:57 AM - edited 08-12-2015 04:00 AM
You should in the Call Library Node never enter the full path to a DLL which resides in the Windows System directory. Just enter the DLL name alone without any path information and LabVIEW/Windows will load the DLL from the system driectory that matches the bitness of the LabVIEW application.
This is especially important since if you ever want to run this software on a 32 bit Windows system the correct system directory will be System32 and SysWOW64 doesnt even exist.
Also when you ever decide to build an application, the full path will make the Application Builder believe that the DLL is a private copy of your application and will add it to the application build. Copying howerver system DLLs to a different computer is not only violating your Windows license but also a pretty sure path into disaster!
08-12-2015 10:17 AM
Thanks for the heads up.
I typed in the driver into the properties tab and everything came up as expected.