LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

win32 winspool dll call for printer status question

Solved!
Go to solution

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.

Veni Vidi Duci
0 Kudos
Message 1 of 8
(5,684 Views)

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.

Message 2 of 8
(5,673 Views)

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.

Veni Vidi Duci
0 Kudos
Message 3 of 8
(5,665 Views)
Solution
Accepted by topic author DB_IQ

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.

Message 4 of 8
(5,653 Views)

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.

0 Kudos
Message 5 of 8
(5,642 Views)

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.

Veni Vidi Duci
0 Kudos
Message 6 of 8
(5,638 Views)

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!

Rolf Kalbermatter
My Blog
Message 7 of 8
(5,565 Views)

Thanks for the heads up.

I typed in the driver into the properties tab and everything came up as expected.

Veni Vidi Duci
0 Kudos
Message 8 of 8
(5,520 Views)