Desktop Functions: Smart Device Functions:
|
Search Results for "set" in [All]winscard
[DllImport("winscard.dll", SetLastError=true)]
[DllImport("winscard.dll", SetLastError=true)] 3: SCardConnect
[DllImport("winscard.dll", EntryPoint="SCardConnect", CharSet=CharSet.Auto)]
[DllImport("WinScard.dll", EntryPoint = "SCardListReadersA", CharSet = CharSet.Ansi)]
// First call with 3rd parameter set to null gets readers buffer length.
[DllImport("winscard.dll", SetLastError=true)]
/// The SCardGetStatusChange function blocks execution until the current availability of the cards in a specific set of readers changes.
/// <param name="hContext">A handle that identifies the resource manager context. The resource manager context is set by a previous call to the SCardEstablishContext function.</param>
[DllImport("winscard.dll", CharSet=CharSet.Auto)]
SCARD_W_RESET_CARD = 0x80100068,
[DllImport("winscard.dll", EntryPoint="SCardListReadersA", CharSet=CharSet.Ansi)] if you invoke SCardListReaders with the hContext parameter set to null, you'll get the list of the installed readers (not the plugged ones !)
[DllImport("kernel32.dll", SetLastError=true)] 9: WinSCard
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] winspool10: AbortPrinter
[DllImport("winspool.drv", SetLastError = true)] 11: AddMonitor
[DllImport("winspool.drv", SetLastError = true, CharSet = CharSet.Auto)] 12: AddPrinter
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)] 13: ClosePrinter
[DllImport("winspool.drv", SetLastError=true)]
SetLastError:=True, _ As always, only do SetLastError=true if you actually intend to call GetLastError. 14: DeleteMonitor
[DllImport("winspool.drv", SetLastError = true, CharSet = CharSet.Auto)] 15: DeletePrinter
[DllImport("winspool.drv", CharSet = CharSet.Ansi, SetLastError = true)]
[DllImport("winspool.Drv", EntryPoint = "DocumentPropertiesW", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
[DllImport("winspool.drv", CharSet = CharSet.Unicode, SetLastError = true)]
<DllImport("winspool.Drv", EntryPoint:="DocumentPropertiesW", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ "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);"
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); I believe the issue(s) discussed re:x64 is actually an odd idiosyncracy under Windows Server 2008 R2 x64, but is not a x86/x64 problem per se. At least testing this under Win7 x64, I have no issues. However, under W2K8 x64, the OutBuffer and InBuffer must NOT be the same (in Win7 x64 this works OK). ALSO, the call to set doc properties with fMode = 14 (Prompt | In | Out) and OutBuffer = IntPtr.Zero CANNOT possibly correct, as in this case there is no place to put the resulting Devmode. Good code shouldn't use "magic numbers" anyway. The following values from WinSpool.h should be used instead of "14" or "0" for the last parameter in this call: 17: DRIVER_INFO_1
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] 18: DRIVER_INFO_2
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 19: DRIVER_INFO_3
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 20: DRIVER_INFO_5
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 21: DRIVER_INFO_6
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 22: DRIVER_INFO_8
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public string pszVendorSetup; 23: EndDocPrinter
[DllImport("winspool.drv", SetLastError = true)] 24: EndPagePrinter
[DllImport("winspool.drv", SetLastError = true)] 25: EnumJobs
[DllImport("Winspool.drv", SetLastError=true, EntryPoint="EnumJobsA")]
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> Structure JOB_INFO_1
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> Structure SYSTEMTIME 26: EnumMonitors
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 27: EnumPorts
[DllImport("winspool.drv",CharSet = CharSet.Auto, SetLastError = true)]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
[DllImport("winspool.drv",CharSet = CharSet.Auto, SetLastError = true)]
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
'call EnumPrinterDrivers with cbBuffer set
int offset = pAddr.ToInt32();
printerInfo2[i] = (DRIVER_INFO_2)Marshal.PtrToStructure(new IntPtr(offset), type);
offset += increment; 29: EnumPrinters
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
int offset = pAddr.ToInt32();
printerInfo2[i] = (PRINTER_INFO_2)Marshal.PtrToStructure(new IntPtr(offset), type);
offset += increment; PrinterSettings.InstalledPrinters, but this only gives the name of the printers.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
int offset = rawBuffer.ToInt32();
dataTypesInfoArray[i] = (DataTypesInfo)Marshal.PtrToStructure(new IntPtr(offset), type);
offset += increment;
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
int offset = pAddr.ToInt32();
printprocessorInfo1[i] = (PRINTPROCESSOR_INFO_1)Marshal.PtrToStructure(new IntPtr(offset), type);
offset += increment;
SetLastError = true,
CharSet = CharSet.Auto, 33: FlushPrinter
[DllImport("winspool.Drv", EntryPoint="FlushPrinter", SetLastError=true, CharSet=CharSet.Ansi,ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)] 35: GetPrinterData
[DllImport("winspool.drv", CharSet=CharSet.Auto, SetLastError=true)] As always, only do SetLastError=true if you actually intend to call GetLastError. 36: OpenPrinter
[DllImport("winspool.drv", CharSet=CharSet.Auto, SetLastError=true)]
[DllImport("winspool.drv",SetLastError=true)] Both signatures will work fine, it is a matter of whether you need a higher level of access to the printer or not. For 'read' only access such as monitoring printer queues, you don't need to pass in a PRINTER_DEFAULTS instance for the last parameter, you can just pass zero (0) if you declare the extern function pDefault parameter as an int. You will need a PRINTER_DEFAULTS structure if you need to change any properties of the printer such as setting the duplex value of the printer.
[DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
[DllImport("winspool.drv", CharSet = CharSet.Unicode, SetLastError = true)]
SetLastError:=True, CharSet:=CharSet.Ansi, _
SetLastError:=True, CallingConvention:=CallingConvention.StdCall, _
CharSet:=CharSet.Ansi)> _
SetLastError:=True, CallingConvention:=CallingConvention.StdCall, _
CharSet:=CharSet.Ansi)> _
[<DllImport("winspool.drv", EntryPoint="OpenPrinterA", SetLastError=true, CharSet=CharSet.Ansi, ExactSpelling=true, As always, only do SetLastError=true if you actually intend to call GetLastError (This includes throwing a Win32Exception if the call fails)
SetJobA(pHandle, (int)jobID, 0, ref b, (int)Job_Control.Cancel); 37: print
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] 39: ReadPrinter
[DllImport("winspool.Drv", EntryPoint = "ReadPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] 40: ResetPrinter
[DllImport("winspool.Drv", EntryPoint="ResetPrinterA", SetLastError=true, CharSet=CharSet.Ansi,ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
private static extern bool ResetPrinter(IntPtr hPrinter,ref PRINTER_DEFAULTS pd);
Declare Function ResetPrinter Lib "winspool.drv" (TODO) As TODO
[DllImport("winspool.drv", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool SetDefaultPrinter(string Name);
Declare Function SetDefaultPrinter Lib "winspool.drv" Alias "SetDefaultPrinterA" (ByVal pszPrinter As String) As Boolean
pinvokeResult = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero,
// Set default printer
result = SetDefaultPrinter(defaultPrinterName);
pinvokeResult = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, I tried this in a little test solution and now I have a magical method SetDefaultPrinter which you can use natively. There’s also methods for pretty much everything you can do to a Windows printer. 42: SetJob
[DllImport("winspool.drv", EntryPoint="SetJobA")]
static extern int SetJobA(IntPtr hPrinter, int JobId,
Declare Function SetJob Lib "winspool.drv" Alias "SetJobA" (hPrinter As IntPtr, JobId As Integer,
SetJobA(pHandle, (int)jobID, 0, ref b, JOB_CONTROL_CANCEL);
dim Result as long = SetJob(handle, jobid, 0, Nothing, JOB_CONTROL_RESUME) 43: SetPrinter
[DllImport("winspool.drv", CharSet=CharSet.Auto)]
static extern uint SetPrinterData(IntPtr hPrinter, string pValueName, uint Type, byte[] pData, uint cbData); 44: SetPrinterData
[DllImport("winspool.drv", CharSet=CharSet.Auto)]
static extern uint SetPrinterData(IntPtr hPrinter, string pValueName, uint Type, byte[] pData, uint cbData); 45: WritePrinter
[DllImport("winspool.drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
<DllImport("winspool.Drv", EntryPoint:="WritePrinter", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ 46: XcvData
[DllImport("winspool.drv", SetLastError=true)] Interfaces47: +
void SetInfo();
void Set(
void WindowSetResizable([MarshalAs(UnmanagedType.VariantBool)] bool Resizable);
void WindowSetLeft(int Left);
void WindowSetTop(int Top);
void WindowSetWidth(int Width);
void WindowSetHeight(int Height);
void SetSecureLockIcon(int SecureLockIcon);
Sub SetSecureLockIcon(ByVal SecureLockIcon As Integer)
Sub WindowSetHeight(ByVal Height As Integer)
Sub WindowSetLeft(ByVal Left As Integer)
Sub WindowSetResizable(<MarshalAs(UnmanagedType.VariantBool)> ByVal Resizable As Boolean)
Sub WindowSetTop(ByVal Top As Integer)
Sub WindowSetWidth(ByVal Width As Integer)
int SetAccessibleName([MarshalAs(UnmanagedType.LPTStr)] string pszName);
<PreserveSig()> Function SetAccessibleName(<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As String) As Integer 50: IActiveDesktop
int SetWallpaper([MarshalAs(UnmanagedType.LPWStr)] string pwszWallpaper, int dwReserved);
int SetWallpaperOptions(ref WALLPAPEROPT pwpo, int dwReserved);
int SetPattern([MarshalAs(UnmanagedType.LPWStr)] string pwszPattern, int dwReserved);
int SetDesktopItemOptions(ref COMPONENTSOPT pco, int dwReserved);
Function SetWallpaper(<MarshalAs(UnmanagedType.LPWStr)> ByVal pwszWallpaper As String, ByVal dwReserved As Integer) As Integer
Function SetWallpaperOptions(ByRef pwpo As WALLPAPEROPT, ByVal dwReserved As Integer) As Integer
Function SetPattern(<MarshalAs(UnmanagedType.LPWStr)> ByVal pwszPattern As String, ByVal dwReserved As Integer) As Integer
Function SetDesktopItemOptions(ByRef pco As COMPONENTSOPT, ByVal dwReserved As Integer) As Integer 51: IADs
set;
set; 52: IADsContainer
set;
set; 53: IAuthenticate
///Client should also set phwnd to zero.</param> 54: IAutoComplete2
// used if the user enters some text and presses CTRL+ENTER. Set
// argument, to produce a new string. For example, set
// Sets the current autocomplete options.
[PreserveSig] int SetOptions(AUTOCOMPLETEOPTIONS dwFlag);
/// "IAutoComplete2.SetOptions" for options surrounding autocomplete.
ACO_USETAB = 0x0010,
/// ACO_RTLREADING is set, the text reads in the opposite
/// <summary>[Windows Vista and later]. If set, the 55: IBinding
void SetPriority([In] int nPriority);
Sub SetPriority(<[In]()> ByVal nPriority As Integer)
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4)]
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4)]
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4), ComConversionLoss]
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto, Pack=4), ComConversionLoss]
INET_E_USE_DEFAULT_SETTING = 0x800C0012,
[DllImport("urlmon.dll", CharSet=CharSet.Auto,SetLastError=true, PreserveSig=false)]
pbindinfo=new BINDINFO();//reset
pbindinfo.dwBindVerb = BINDVERB.BINDVERB_GET; // set verb 57: ICatRegister
/// <param name="rclsid">The class ID of the relevent class for which category information will be set.</param>
/// <param name="rclsid">The class ID of the relevent class for which category information will be set.</param> 58: IClassFactory
/// <param name="unused">must be set to null</param>
/// <param name="pUnkOuter">don't know what it is, set to null</param>
/// <param name="pUnkReserved">must be set to null</param>
<DllImport("ole32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True, PreserveSig:=False)> 59: IClassFactory2
/// <param name="unused">must be set to null</param>
/// <param name="pUnkOuter">don't know what it is, set to null</param>
/// <param name="pUnkReserved">must be set to null</param>
''' <param name="unused">must be set to null</param>
''' <param name="pUnkOuter">don't know what it is, set to null</param>
''' <param name="pUnkReserved">must be set to null</param> 60: ICustomDoc
void SetUIHandler([In, MarshalAs(UnmanagedType.Interface)] IDocHostUIHandler pUIHandler);
Sub SetUIHandler(ByVal pUIHandler As IDocHostUIHandler) Cut off search results after 60. Please refine your search. |