Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

xcvdata (winspool)
 
.
Summary
This allows you to communicate with a print monitor

C# Signature:

[DllImport("winspool.drv", SetLastError=true)]
static extern bool XcvData(IntPtr hXcv, [MarshalAs(UnmanagedType.LPWStr)] string pszDataName, IntPtr InputData, uint cbInputData,
              IntPtr OutputData, uint cbOutputData,out uint cbOutputNeeded,out uint dwStatus);

VB Signature:

Declare Function XcvData Lib "winspool.drv" (TODO) As TODO

User-Defined Types:

PRINTER_DEFAULTS

Notes:

None.

Sample Code:

     const  uint SERVER_ACCESS_ADMINISTER   = 0x00000001;

     string szIPAddress="";
     string xcvName = String.Format(",XcvPort {0}", portName);

     IntPtr buf= Marshal.AllocHGlobal(256);
     IntPtr hXcv = IntPtr.Zero;

     PRINTER_DEFAULTS Defaults = new PRINTER_DEFAULTS();
     Defaults.pDatatype = 0 ;
     Defaults.pDevMode = 0;
     Defaults.DesiredAccess = SERVER_ACCESS_ADMINISTER;

     // Handle to a local machine
     if (OpenPrinter(xcvName,out hXcv, ref Defaults ))
     {
        uint cbOutputNeeded;
        uint dwStatus;
        // hXvc contains an Xcv data handle to a local TCPMON port
        if (XcvData(hXcv, "IPAddress", IntPtr.Zero, 0, buf, 256, out cbOutputNeeded, out dwStatus))
        {
           szIPAddress= Marshal.PtrToStringAuto(buf);
           Console.Write(szRet);
        }

     }

     ClosePrinter(hXcv);

     if (buf != IntPtr.Zero)
        Marshal.FreeHGlobal(buf);

Documentation
XcvData on MSDN
Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions