Desktop Functions: Smart Device Functions:
|
Search Results for "print" in [All]mpr
RESOURCETYPE_PRINT,
// RESOURCETYPE_PRINT = 2,
Print = 2,
RESOURCETYPE_PRINT,
RESOURCETYPE_PRINT = 0x00000002,
RESOURCETYPE_PRINT = &H2 localName is the local name for the network resource (drive or printer)
PRINT = 0x00000002, shlwapi6: AssocCreate
"print", null, ref size);
"print", sb, ref size);
Console.WriteLine(".doc is printed by : {0}", sb.ToString());
Console.WriteLine("No command line is associated to .doc print verb."); winmmnetapi32
''' Admin, Accounts, Print, or Server Operator group membership is required to successfully execute NetMessageBufferSend on a remote server.
PrintQueueServer = 0x00000200,
MicrosoftFileAndPrintServer= 0x00004000,
SV_TYPE_PRINTQ_SERVER = 0x00000200, 10: NetServerGetInfo
PrintQueueServer = 0x00000200,
MicrosoftFileAndPrintServer= 0x00004000, 11: NetShareAdd
STYPE_PRINTQ = 1,
' <summary>Printer Share</summary>
Printer = 1 12: NetShareCheck
STYPE_PRINTQ = 1, 13: NetShareEnum
STYPE_PRINTQ = 1, 14: NetUseAdd Constants15: GUID_DEVCLASS
public static readonly Guid GUID_DEVCLASS_DOT4PRINT = new Guid("{0x49ce6ac8, 0x6f86, 0x11d2, {0xb1, 0xe5, 0x00, 0x80, 0xc7, 0x2e, 0x74, 0xa2}}");
public static readonly Guid GUID_DEVCLASS_PNPPRINTERS = new Guid("{0x4658ee7e, 0xf050, 0x11d1, {0xb6, 0xbd, 0x00, 0xc0, 0x4f, 0xa3, 0x72, 0xa7}}");
public static readonly Guid GUID_DEVCLASS_PRINTER = new Guid("{0x4d36e979, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}");
public static readonly Guid GUID_DEVCLASS_PRINTERUPGRADE = new Guid("{0x4d36e97a, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}"); 16: NERR_
/// <summary> 2150 - The printer does not exist. </summary>
/// <summary> 2151 - The print job does not exist. </summary>
/// <summary> 2152 - The printer destination cannot be found. </summary>
/// <summary> 2153 - The printer destination already exists. </summary>
/// <summary> 2154 - The printer queue already exists. </summary>
/// <summary> 2155 - No more printers can be added. </summary>
/// <summary> 2156 - No more print jobs can be added. </summary>
/// <summary> 2157 - No more printer destinations can be added. </summary>
/// <summary> 2158 - This printer destination is idle and cannot accept control operations. </summary>
/// <summary> 2159 - This printer destination request contains an invalid control function. </summary>
/// <summary> 2160 - The print processor is not responding. </summary>
/// <summary> 2162 - This operation cannot be performed on the print destination in its current state. </summary>
/// <summary> 2163 - This operation cannot be performed on the printer queue in its current state. </summary>
/// <summary> 2164 - This operation cannot be performed on the print job in its current state. </summary>
/// <summary> 2167 - The data type is not supported by the print processor. </summary>
/// <summary> 2168 - The print processor is not installed. </summary> 17: PRINTER_ACCESS
private const int PRINTER_ACCESS_ADMINISTRATOR = 0x4;
private const int PRINTER_ACCESS_USE = 0x8;
private const int PRINTER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | PRINTER_ACCESS_ADMINISTRATOR | PRINTER_ACCESS_USE; 18: PROPERTYKEY
public static PropertyKey PKEY_Document_DatePrinted = new PropertyKey( 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 11); 19: RESOURCE
const UInt32 RESOURCETYPE_PRINT = 0x00000002; 20: ShellAPI
public const int PO_DELETE = 0x0013; // printer is being deleted
public const int PO_RENAME = 0x0014; // printer is being renamed
public const int PO_PORTCHANGE = 0x0020; // port this printer connected to is being changed
// list of strings. The first is the printer
// name and the second is the printer port.
// Printer stuff
public const int PRINTACTION_OPEN = 0;
public const int PRINTACTION_PROPERTIES = 1;
public const int PRINTACTION_NETINSTALL = 2;
public const int PRINTACTION_NETINSTALLLINK = 3;
public const int PRINTACTION_TESTPAGE = 4;
public const int PRINTACTION_OPENNETPRN = 5;
public const int PRINTACTION_DOCUMENTDEFAULTS = 6;
public const int PRINTACTION_SERVERPROPERTIES = 7; 21: ShellAPI
public const int PO_DELETE = 0x0013; // printer is being deleted
public const int PO_RENAME = 0x0014; // printer is being renamed
public const int PO_PORTCHANGE = 0x0020; // port this printer connected to is being changed
// list of strings. The first is the printer
// name and the second is the printer port.
// Printer stuff
public const int PRINTACTION_OPEN = 0;
public const int PRINTACTION_PROPERTIES = 1;
public const int PRINTACTION_NETINSTALL = 2;
public const int PRINTACTION_NETINSTALLLINK = 3;
public const int PRINTACTION_TESTPAGE = 4;
public const int PRINTACTION_OPENNETPRN = 5;
public const int PRINTACTION_DOCUMENTDEFAULTS = 6;
public const int PRINTACTION_SERVERPROPERTIES = 7; 22: WINERROR
/// The printer is out of paper.
/// The printer queue is full.
public const int ERROR_PRINTQ_FULL = 61;
/// Space to store the file waiting to be printed is not available on the server.
/// Your file waiting to be printed was deleted.
public const int ERROR_PRINT_CANCELLED = 63;
/// The specified printer or disk device has been paused.
/// The specified printer driver is already installed.
public const int ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795;
/// The printer driver is unknown.
public const int ERROR_UNKNOWN_PRINTER_DRIVER = 1797;
/// The print processor is unknown.
public const int ERROR_UNKNOWN_PRINTPROCESSOR = 1798;
/// The printer name is invalid.
public const int ERROR_INVALID_PRINTER_NAME = 1801;
/// The printer already exists.
public const int ERROR_PRINTER_ALREADY_EXISTS = 1802;
/// The printer command is invalid.
public const int ERROR_INVALID_PRINTER_COMMAND = 1803;
/// The specified printer handle is already being waited on
/// The specified printer has been deleted.
public const int ERROR_PRINTER_DELETED = 1905;
/// The state of the printer is invalid.
public const int ERROR_INVALID_PRINTER_STATE = 1906;
/// The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers.
public const int ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936;
/// The specified print monitor is unknown.
public const int ERROR_UNKNOWN_PRINT_MONITOR = 3000;
/// The specified printer driver is currently in use.
public const int ERROR_PRINTER_DRIVER_IN_USE = 3001;
/// A StartDocPrinter call was not issued.
/// The specified print processor has already been installed.
public const int ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;
/// The specified print monitor has already been installed.
public const int ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006;
/// The specified print monitor does not have the required functions.
public const int ERROR_INVALID_PRINT_MONITOR = 3007;
/// The specified print monitor is currently in use.
public const int ERROR_PRINT_MONITOR_IN_USE = 3008;
/// The requested operation is not allowed when there are jobs queued to the printer.
public const int ERROR_PRINTER_HAS_JOBS_QUEUED = 3009;
/// No printers were found.
public const int ERROR_PRINTER_NOT_FOUND = 3012;
/// The printer driver is known to be unreliable.
public const int ERROR_PRINTER_DRIVER_WARNED = 3013;
/// The printer driver is known to harm the system.
public const int ERROR_PRINTER_DRIVER_BLOCKED = 3014;
/// The string contains a non-printable character.
public const int CRYPT_E_INVALID_PRINTABLE_STRING = (int)(0x80092021 - 0x100000000); 23: WM
private const UInt32 WM_PRINT = 0x0317;
private const UInt32 WM_PRINTCLIENT = 0x0318;
WM_PRINT = &H317
WM_PRINTCLIENT = &H318
WM_PRINT equ 317h
WM_PRINTCLIENT equ 318h crypt32
printf("Opened the MY system store. \n");
printf( "Could not open the MY system store.\n");
printf("The MY store is duplicated.\n");
printf("Duplication of the MY store failed.\n."); userenv
printf("%d %s\n", (int)size, path);
printf("%d %s\n", (int)size, path); setupapi26: Option Explicit Text1.Text = SendToUsbPrinter(”Hello world.”) Function SendToUsbPrinter(PrintOut As String) As Boolean SendToUsbPrinter = False Debug.Print DeviceName Debug.Print “Open failed on ” & DeviceName Ret = WriteFile(DeviceHandle, PrintOut, _ Len(PrintOut), BytesWritten, 0) Debug.Print “Sent ” & BytesWritten & ” bytes.” SendToUsbPrinter = True Interfaces
void PrintTemplateInstantiation([MarshalAs(UnmanagedType.IDispatch)] object pDisp);
void PrintTemplateTeardown([MarshalAs(UnmanagedType.IDispatch)] object pDisp);
Sub PrintTemplateInstantiation(<MarshalAs(UnmanagedType.IDispatch)> ByVal pDisp As Object)
Sub PrintTemplateTeardown(<MarshalAs(UnmanagedType.IDispatch)> ByVal pDisp As Object) 28: IAutoComplete2
// the autocomplete object treats pwszQuickComplete as a sprintf
#region Print
/// Prints the current view. Print Dialog does not appear and therefore a document
/// will be printed.with the default printer settings
public void Print()
InfoPathControl.XmlForm.Print();
//NOTE: XmlForm.Print(true) will NOT show the print dialog.
//The print dialog is not supported in hosting scenarios
throw new HostedException("An error occurred while attempting to print this form", ex); 30: IShellFolder
SHCONTF_NETPRINTERSRCH = 0x0200, 31: ITravelLogStg
Debug.Print("\r\nCount =>" + iHistoryCount.ToString());
Debug.Print("\r\nTitle =>" + Marshal.PtrToStringUni(pTitle));
Debug.Print("\r\nUrl =>" + Marshal.PtrToStringUni(pUrl)); Structures32: DEVMODE
Int16 dmPrintQuality;
Public dmPrintQuality As Short This code (taken from .NET source code) is working with System.Drawing.Printing.PrinterSettings.Gethdevmode, where default structure doesn't work for me.
public Int16 dmPrintQuality; 33: FAX_PRINT_INFO 34: FORMATETC
DVASPECT_DOCPRINT = 8
DVASPECT_DOCPRINT = 8 35: JOB_INFO_1 36: KEYBDINPUT
///PRINT key
PRINT = 0x2A,
///PRINT SCREEN key
PRINT = 0, 37: PRINTDLG
public class PRINTDLG
public IntPtr lpfnPrintHook;
public IntPtr lpPrintTemplateName;
public IntPtr hPrintTemplate;
Structure PRINTDLG 38: PRINTER_DEFAULTS
struct PRINTER_DEFAULTS {
/// The PRINTER_DEFAULTS structure specifies the default data type,
/// environment, initialization data, and access rights for a printer.
internal class PRINTER_DEFAULTS
/// default data type for a printer.
/// default environment and initialization data for a printer.
/// Specifies desired access rights for a printer.
/// The <see cref="OpenPrinter(string, out IntPtr, IntPtr)"/> function uses
/// this member to set access rights to the printer. These rights can affect
/// the operation of the SetPrinter and DeletePrinter functions.
Structure PRINTER_DEFAULTS If you use the class-version, you only need one OpenPrinter declaration, because you can pass NULL or an object references. 39: PRINTER_INFO_2
public struct PRINTER_INFO_2
public string pPrinterName;
public string pPrintProcessor;
Private Structure PRINTER_INFO_2
Public pPrinterName As String
Public pPrintProcessor As String
public PRINTER_ATTRIBUTES Attributes; See the PRINTER_ATTRIBUTES enum for more details. If you only want to get or set the DEVMODE struct, you can use the PRINTER_INFO_9 struct instead. 40: PRINTER_INFO_5
public struct PRINTER_INFO_5
public string pPrinterName;
Structure PRINTER_INFO_5
public PRINTER_ATTRIBUTES Attributes; See the PRINTER_ATTRIBUTES enum for more details. 41: PRINTER_INFO_9
/// The PRINTER_INFO_9 structure specifies the per-user default printer settings.
internal class PRINTER_INFO_9
/// default printer data such as the paper orientation and the resolution.
ushort PrintNameOffset;
ushort PrintNameLength;
(4 * sizeof(ushort)) + SubstituteNameLength + PrintNameLength +
PrintNameOffset
Offset, in bytes, of the print name string in the PathBuffer array.
PrintNameLength
Length, in bytes, of the print name string. If this string is null-terminated,
PrintNameLength does not include space for the null character.
the substitute name string and print name string.
internal ushort PrintNameOffset;
internal ushort PrintNameLength;
internal ushort PrintNameOffset;
internal ushort PrintNameLength;
rdb.PrintNameOffset = (ushort)(targetLenBytes + 2); 43: StartDocPrinter
[DllImport("winspool.drv", EntryPoint="StartDocPrinterW", SetLastError=true,
private static extern uint StartDocPrinter(
IntPtr hPrinter,
[DllImport("winspool.drv", EntryPoint="StartDocPrinterA", SetLastError=true,
private static extern uint StartDocPrinter(
IntPtr hPrinter,
Structure StartDocPrinter
Public Function StartDocPrinter(hPrinter As IntPtr, Level As Integer, ByRef pDocInfo As DOC_INFO_1W) As Long
Public Function StartDocPrinter(hPrinter As IntPtr, Level As Integer, ByRef pDocInfo As DOC_INFO_1A) As Long msvcrt44: sprintf
static extern int sprintf(
static extern int swprintf(
static extern int sprintf([In,Out]StringBuilder buffer, String fmt,
static extern int sprintf([In,Out]StringBuilder buffer, String fmt,
static extern int sprintf([In,Out]StringBuilder buffer, String fmt,
Public Shared Function sprintf(ByVal TargetString As System.Text.StringBuilder, swprintf(buffer, "Greetings from thread %d\n", __arglist(Thread.CurrentThread.ManagedThreadId)); iphlpapi
IF_TYPE_ISO88025_CRFPRINT = 98, // ISO 802.5 CRFP rapi46: CeRapiInvoke
wsprintf( outBuffer, _T("This is just a Test!") ); winfax
static extern bool FaxPrintCoverPage (ref FAX_CONTEXT_INFO FaxContextInfo,
Declare Function FaxPrintCoverPage Lib "winfax.dll" (TODO) As TODO 48: FaxStartPrintJob
static extern bool FaxStartPrintJob (string PrinterName,
ref FAX_PRINT_INFO PrintInfo, out int FaxJobId,
Declare Function FaxStartPrintJob Lib "winfax.dll" (TODO) As TODO 49: FAX_PRINT_INFO winspool50: AbortPrinter 51: AddPrinter
internal static extern bool AddPrinterConnection(String pszBuffer);
Declare Function AddPrinterConnection Lib "winspool.dll" (TODO) As TODO
internal static extern bool AddPrinterConnection(String pszBuffer);
Declare Function AddPrinterConnection Lib "winspool.dll" (TODO) As TODO 53: ClosePrinter
static extern int ClosePrinter(IntPtr hPrinter);
<DllImport("winspool.drv", EntryPoint:="ClosePrinter", _
Private Shared Function ClosePrinter(ByVal hPrinter As Int32) As Boolean 54: DeletePrinter
internal static extern bool DeletePrinterConnection(String pName);
Declare Function DeletePrinterConnection Lib "winspool.dll" (TODO) As TODO result = DeletePrinterConnection("\\\\Server_Name\\Printer_Share");
static extern int DocumentProperties(IntPtr hwnd, IntPtr hPrinter, [MarshalAs(UnmanagedType.LPWStr)] string pDeviceName, IntPtr pDevModeOutput, IntPtr pDevModeInput, int fMode);
static extern int DocumentProperties(IntPtr hWnd, IntPtr hPrinter, string pDeviceName, IntPtr pDevModeOutput, IntPtr pDevModeInput, fModes fMode);
Private Shared Function DocumentProperties(ByVal hwnd As IntPtr, ByVal hPrinter As IntPtr, <MarshalAs(UnmanagedType.LPWStr)> ByVal pDeviceName As String, ByVal pDevModeOutput As IntPtr, ByVal pDevModeInput As IntPtr, ByVal fMode As Integer) As Integer "DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, pDevMode, pDevMode, 0);" returns -1 and error code 183 under x64 however i dnt knw y! in order to get it working use "DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, IntPtr.Zero, pDevMode, 0);" Obtain a pointer to the DEVMODE struct (either printerHandle or printerName can be NULL | IntPtr.ZERO):
public IntPtr GetDevMode(IntPtr printerHandle, string printerName)
int sizeNeeded = DocumentProperties(IntPtr.Zero, printerHandle, printerName, IntPtr.Zero, IntPtr.Zero, fModes.DM_SIZEOF);
int result = DocumentProperties(IntPtr.Zero, printerHandle, printerName, pdevmode, IntPtr.Zero, fModes.DM_OUT_BUFFER);
private void OpenPrinterPropertiesDialog(PrinterSettings printerSettings)
IntPtr hDevMode = printerSettings.GetHdevmode(printerSettings.DefaultPageSettings);
int sizeNeeded = DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, pDevMode, pDevMode, 0);
DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, devModeData, pDevMode, 14);
printerSettings.SetHdevmode(devModeData);
printerSettings.DefaultPageSettings.SetHdevmode(devModeData);
private void OpenPrinterPropertiesDialog(PrinterSettings printerSettings)
IntPtr hDevMode = printerSettings.GetHdevmode(printerSettings.DefaultPageSettings);
int sizeNeeded = DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, pDevMode, pDevMode, 0);
DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, IntPtr.Zero, pDevMode, 14);
printerSettings.SetHdevmode(devModeData);
printerSettings.DefaultPageSettings.SetHdevmode(devModeData);
private void OpenPrinterPropertiesDialog(PrinterSettings printerSettings)
IntPtr hDevMode = printerSettings.GetHdevmode(printerSettings.DefaultPageSettings);
int sizeNeeded = DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, IntPtr.Zero, pDevMode, 0);
DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, IntPtr.Zero, pDevMode, 14);
printerSettings.SetHdevmode(devModeData);
printerSettings.DefaultPageSettings.SetHdevmode(devModeData); I had to fixed Matthias solution, because it doesn't work well for me. Exception is no more occurs, but when some setting is changed in printer properties it isn't used by printer. I've changed second call of DocumentProperties method. The third-from-last paramter MUST be in this case devModeData.
private void OpenPrinterPropertiesDialog(PrinterSettings printerSettings)
IntPtr hDevMode = printerSettings.GetHdevmode(printerSettings.DefaultPageSettings);
int sizeNeeded = DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, IntPtr.Zero, pDevMode, 0);
DocumentProperties(this.Handle, IntPtr.Zero, printerSettings.PrinterName, devModeData, pDevMode, 14);
printerSettings.SetHdevmode(devModeData);
printerSettings.DefaultPageSettings.SetHdevmode(devModeData); Agreed that the use of a IntPrt.Zero where a recipient data structure is expected looks wrong, but it should be ok in this case: that first call to DocumentProperties does not attempt to save any data to the DevMode structure, it just returns the size of memory necessary to hold all the devModeData held by the printer driver, nothing else. 57: DRIVER_INFO_6
/// structure contains printer driver information
/// A pointer to a null-terminated string that specifies a language monitor (for example, "PJL monitor"). This member can be NULL and should be specified only for printers capable of bidirectional communication.
/// A pointer to a null-terminated string that specifies the default data type of the print job (for example, "EMF").
/// A pointer to a null-terminated string that specifies previous printer driver names that are compatible with this driver. For example, OldName1\0OldName2\0\0.
/// Pointer to a null-terminated string that specifies the hardware ID for the printer driver.
/// Pointer to a null-terminated string that specifies the provider of the printer driver (for example, "Microsoft Windows 2000") 58: DRIVER_INFO_8 59: EndDocPrinter 60: EndPagePrinter Cut off search results after 60. Please refine your search. |