Win32 Printing Status Check
C#
1
Posts
1
Posters
0
Views
1
Watching
-
I am using below code to check printing status but it always returns 0. It would be great if you can help me . i think there is some problem in the way i am using GetPrinter method
[DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
private static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, Int32 pDefault);/// <summary> /// Close Win32 printer /// </summary> /// <param name="printer"></param> /// <returns></returns> \[DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)\] public static extern bool ClosePrinter(IntPtr printer); \[DllImport("winspool.Drv", EntryPoint = "GetPrinterDataA", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)\] public static extern uint GetPrinterData( \[In\] IntPtr hPrinter, \[In, MarshalAs(UnmanagedType.LPWStr)\] string pValueName, \[Out, Optional\] uint pType, \[Out, Optional\] IntPtr pData, uint nSize, \[Out\] uint pcbNeeded ); \[DllImport("winspool.Drv", EntryPoint = "GetPrinterA", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)\] public static extern bool GetPrinter( IntPtr hPrinter, int dwLevel /\* changed type from Int32 \*/, IntPtr pPrinter, int dwBuf /\* chagned from Int32\*/, out int dwNeeded /\* changed from Int32\*/ );
[StructLayout(LayoutKind.Sequ
ential)]
internal struct PRINTER_INFO
{
public IntPtr pServerName;
public IntPtr pPrinterName;
public In