I tried to use the OpenPrinter2 function to get an printer handle, but it seems to be missing in Winspool.h.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd162752(v=vs.85).aspx
Windows 7 Prof 64 bit
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)