diff options
| author | Adonais Romero González <[email protected]> | 2024-05-06 16:21:31 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-06 16:21:31 -0700 |
| commit | a74a241c664c4e1d7c0838287b34076c19d9858a (patch) | |
| tree | 6ff7562612967b122acf8acf8a69c4dcfd5905db /print/v4PrintDriverSamples | |
| parent | def8e8e34ed2b7b1deb2fc9112ac4255f1a0f2ba (diff) | |
| parent | 15477ce52bbb6b42ca591ecdfb484cac089f89ab (diff) | |
Merge develop changes prior to upcoming WDK release (May 2024)
Diffstat (limited to 'print/v4PrintDriverSamples')
62 files changed, 0 insertions, 10018 deletions
diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml deleted file mode 100644 index f97fc473..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml +++ /dev/null @@ -1,7 +0,0 @@ -<Application x:Class="Microsoft.Samples.Printing.PrinterExtension.App" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - Startup="Application_Startup" - Exit="Application_Exit" - > -</Application> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs deleted file mode 100644 index d37585c4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/App.xaml.cs +++ /dev/null @@ -1,146 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains the entry point to the application. - -using System; -using System.Windows; -using System.Runtime; - -using Microsoft.Samples.Printing.PrinterExtension.Types; -using Microsoft.Samples.Printing.PrinterExtension.Helpers; - -using System.Windows.Interop; - -namespace Microsoft.Samples.Printing.PrinterExtension -{ - /// <summary> - /// Interaction logic for App.xaml. - /// </summary> - public partial class App : Application - { - /// <summary> - /// This is the event handler invoked on various driver events. - /// </summary> - /// <param name="sender"></param> - /// <param name="eventArgs"></param> - private static void OnDriverEvent(object sender, PrinterExtensionEventArgs eventArgs) - { - // - // Display the print preferences window. - // - - if (eventArgs.ReasonId.Equals(PrinterExtensionReason.PrintPreferences)) - { - PrintPreferenceWindow printPreferenceWindow = new PrintPreferenceWindow(); - printPreferenceWindow.Initialize(eventArgs); - - // - // Set the caller application's window as parent/owner of the newly created printing preferences window. - // - - WindowInteropHelper wih = new WindowInteropHelper(printPreferenceWindow); - wih.Owner = eventArgs.WindowParent; - - // - // Display a modal/non-modal window based on the 'WindowModal' parameter. - // - - if (eventArgs.WindowModal) - { - printPreferenceWindow.ShowDialog(); - } - else - { - printPreferenceWindow.Show(); - - // Flash the window to draw the user's attention. This is required - // because the printer extension may be drawn behind the parent window. - // The return value of FlashWindow can be safely ignored if there is no need - // to know if the window has focus or not. - WindowHelper.FlashWindow(wih.Handle); - } - } - else if (eventArgs.ReasonId.Equals(PrinterExtensionReason.DriverEvent)) - { - // - // Handle driver events here. - // - } - } - - /// <summary> - /// Perform initialization tasks for the printer extension in this event handler. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void Application_Startup(object sender, StartupEventArgs e) - { - // - // It is recommended that exactly one instance of the PrinterExtensionManager be created per instance of - // the printer extension. - // - - if (manager != null) - { - return; - } - manager = new PrinterExtensionManager(); - - // - // Enable events to be received on one printer driver id. - // - // Note: The order of adding the delegate to PrinterExtensionManager.OnDriverEvent - // and invoking PrinterExtensionManager::EnableEvents is important. - // Adding the delegate should be done first. - // - - manager.OnDriverEvent += OnDriverEvent; - - // - // It is recommended that an instance of a printer extension invoke PrinterExtensionManager::EnableEvents - // for exactly one printer driver id. The printer driver id could come in from a command line argument, - // thereby allowing one application binary to dynamically invoke PrinterExtensionManager::EnableEvents against - // the appropriate printer driver id. - // - - manager.EnableEvents(Guid.Parse(PrinterDriverID)); - } - - /// <summary> - /// Perform uninitialization tasks for the printer extension in this event handler. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void Application_Exit(object sender, ExitEventArgs e) - { - manager.OnDriverEvent -= OnDriverEvent; - manager.DisableEvents(); - - manager = null; - } - - /// <summary> - /// This is the printer driver id, as defined in the printer driver manifest file. - /// Please replace this GUID with the printer driver id from your manifest file. - /// - /// It is recommended that you invoke PrinterExtensionManager::EnableEvents() on exactly - /// one printer driver id. The id could come in from a command line argument, thereby enabling - /// one application binary to work with multiple printer driver ids. - /// </summary> - private const string PrinterDriverID = "{E0691E8D-F7CC-456E-A7B5-D1FC19BA2279}"; - - /// <summary> - /// Instance of the PrinterExtensionManager. It is recommended that you have only instance - /// of the PrinterExtensionManager per application instance. - /// </summary> - private static PrinterExtensionManager manager = null; - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs deleted file mode 100644 index c975ee7c..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/BidiHelper.cs +++ /dev/null @@ -1,154 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains helper methods that provide a data-binding friendly way to access and parse bidi response data. - -using System; -using System.Collections.Generic; -using System.Windows.Media; -using System.Xml; - -namespace Microsoft.Samples.Printing.PrinterExtension.Helpers -{ - /// <summary> - /// Provide a data-binding friendly way to access and parse bidi response data. - /// </summary> - public class BidiHelper - { - /// <summary> - /// Parse the bidi response. - /// </summary> - /// <param name="bidiResponse">Bidi response XML data.</param> - public BidiHelper(string bidiResponse) - { - BidiResponseParser parser = new BidiResponseParser(bidiResponse); - InkLevelC = parser.GetInkLevel(Colors.Cyan); - InkLevelM = parser.GetInkLevel(Colors.Magenta); - InkLevelY = parser.GetInkLevel(Colors.Yellow); - InkLevelK = parser.GetInkLevel(Colors.Black); - } - - /// <summary> - /// Get the Cyan ink level. - /// </summary> - public double InkLevelC - { - get; - private set; - } - - /// <summary> - /// Get the Magenta ink level. - /// </summary> - public double InkLevelM - { - get; - private set; - } - - /// <summary> - /// Get the Yellow ink level. - /// </summary> - public double InkLevelY - { - get; - private set; - } - - /// <summary> - /// Get the Black ink level. - /// </summary> - public double InkLevelK - { - get; - private set; - } - } - - /// <summary> - /// This class parses bidi response xml data and provides wrapper methods that operate upon the xml. - /// </summary> - internal class BidiResponseParser - { - /// <summary> - /// Parse the bidi response. - /// </summary> - /// <param name="bidiResponse">Bidi response XML data.</param> - internal BidiResponseParser(string bidiResponse) - { - bidiData = new XmlDocument(); - bidiData.LoadXml(bidiResponse); - - namespaceManager = new XmlNamespaceManager(bidiData.NameTable); - namespaceManager.AddNamespace("bidi", "http://schemas.microsoft.com/windows/2005/03/printing/bidi"); - } - - /// <summary> - /// Get the ink level for a given color. - /// </summary> - /// <param name="color">Color</param> - /// <returns>Ink level percentage</returns> - internal double GetInkLevel(Color color) - { - XmlElement root = bidiData.DocumentElement; - XmlNode inkNode = root.SelectSingleNode(CreateInkXPathQuery(color), namespaceManager); - return double.Parse(inkNode.FirstChild.Value) / 100; - } - - /// <summary> - /// Create an XPath query that retrieves the ink level from a standard bidi response. - /// </summary> - /// <param name="color"></param> - /// <returns></returns> - private static string CreateInkXPathQuery(Color color) - { - string colorName = null; - - if (color.Equals(Colors.Black)) - { - colorName = "Black"; - } - else if (color.Equals(Colors.Red)) - { - colorName = "Red"; - } - else if (color.Equals(Colors.Green)) - { - colorName = "Green"; - } - else if (color.Equals(Colors.Blue)) - { - colorName = "Blue"; - } - else if (color.Equals(Colors.Cyan)) - { - colorName = "Cyan"; - } - else if (color.Equals(Colors.Magenta)) - { - colorName = "Magenta"; - } - else if (color.Equals(Colors.Yellow)) - { - colorName = "Yellow"; - } - else - { - throw new ArgumentException("Unsupported color"); - } - - return "/bidi:Get/Query/Schema[@name='\\Printer.Consumables." + colorName + "Ink" + ":Level']/BIDI_INT"; - } - - private XmlDocument bidiData; - private XmlNamespaceManager namespaceManager; - } - -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png Binary files differdeleted file mode 100644 index 196cd5f6..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Fabrikam_Logo.png +++ /dev/null diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml deleted file mode 100644 index 924efc21..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml +++ /dev/null @@ -1,147 +0,0 @@ -<Window x:Class="Microsoft.Samples.Printing.PrinterExtension.PrintPreferenceWindow" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:c="clr-namespace:Microsoft.Samples.Printing.PrinterExtension" - xmlns:sys="clr-namespace:System;assembly=mscorlib" - Title="{Binding Path=PrinterQueue.Name}" Height="405" Width="565" - ResizeMode="NoResize" - Icon="Fabrikam_Logo.png" - Closing="PrintPreferenceWindow_Closing" - > - - <Window.Resources> - <!-- Resources required to create the basic window --> - <Style x:Key="GraySingleBorder" TargetType="Border"> - <Setter Property="BorderBrush" Value="Gray" /> - </Style> - - <SolidColorBrush x:Key="InkStatusBorderBrush" Color="Black"/> - - <BitmapImage x:Key="FabrikamLogo" UriSource="Fabrikam_Logo.png" /> - - <Style x:Key="SimpleGroupBox" TargetType="GroupBox"> - <Setter Property="Margin" Value="5,5,5,5" /> - <Setter Property="Padding" Value="0,5,0,0" /> - </Style> - - <!-- - Each brush below is bound to BidiHelperSource, which provides a data-biding friendly way to - access ink levels. - --> - <LinearGradientBrush x:Key="InkBrushC" StartPoint="0, 1" EndPoint="0, 0"> - <GradientStop Color="Cyan" Offset="{Binding Path=BidiHelperSource.InkLevelC}" /> - <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelC}" /> - </LinearGradientBrush> - <LinearGradientBrush x:Key="InkBrushM" StartPoint="0, 1" EndPoint="0, 0"> - <GradientStop Color="Magenta" Offset="{Binding Path=BidiHelperSource.InkLevelM}" /> - <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelM}" /> - </LinearGradientBrush> - <LinearGradientBrush x:Key="InkBrushY" StartPoint="0, 1" EndPoint="0, 0"> - <GradientStop Color="Yellow" Offset="{Binding Path=BidiHelperSource.InkLevelY}" /> - <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelY}" /> - </LinearGradientBrush> - <LinearGradientBrush x:Key="InkBrushK" StartPoint="0, 1" EndPoint="0, 0"> - <GradientStop Color="Black" Offset="{Binding Path=BidiHelperSource.InkLevelK}" /> - <GradientStop Color="White" Offset="{Binding Path=BidiHelperSource.InkLevelK}" /> - </LinearGradientBrush> - - <c:OptionConstrainedToDisplayColorConverter x:Key="OptionConstrainedToColor" /> - </Window.Resources> - - <Grid x:Name="MainGrid"> - <Grid.ColumnDefinitions> - <ColumnDefinition x:Name="LeftHalf" Width="3*"/> - <ColumnDefinition x:Name="RightHalf" Width="5*"/> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition x:Name="BrandingRow" Height="1*"/> - <RowDefinition x:Name="ContentRow" Height="2*"/> - <RowDefinition x:Name="StatusRow" /> - </Grid.RowDefinitions> - - <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="0" Grid.ColumnSpan="2" BorderThickness="0,0,0,1"/> - <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="1" Grid.Column="0" BorderThickness="0,0,0,1" /> - <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="1" Grid.Column="1" BorderThickness="1,0,0,1" /> - <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="2" Grid.Column="0" BorderThickness="0,0,0,0" /> - <Border Style="{DynamicResource GraySingleBorder}" Grid.Row="2" Grid.Column="1" BorderThickness="1,0,0,0" /> - - <Image Source="{StaticResource FabrikamLogo}" Grid.Row="0" Grid.Column="0" Stretch="None"/> - - <!-- - Display the name of the current print queue. - --> - <TextBlock FontFamily="Verdana" Grid.Row="0" Grid.Column="1" TextAlignment="Left" - VerticalAlignment="Center" FontSize="16" Foreground="DarkOrchid" Text="{Binding Path=PrinterQueue.Name}" /> - - <!-- - Lay out multiple GroupBoxes, with one ComboBox inside each. The number of GroupBoxes is determined by the number of features returned by - binding property: PrintSchemaHelperSource.Features. - - Each GroupBox Header displays the print schema feature's display name, bound to PrintSchemaFeatureHelper.DisplayName. - Each ComboBox's ItemSource property is bound to the list of valid options for that feature i.e. bound to PrintSchemaFeatureHelper.Options. - Additionally, the ComboBox is bound two-way to to PrintSchemaFeatureHelper.SelectedOption. Therefore, in addition to displaying the option - selected in the current print ticket, when the selected option is changed via UI selection, - a 'set' property is invoked on PrintSchemaFeatureHelper.SelectedOption. - - Each item in the ComboBox has the following structure: - It's displays the option name via a TextBlock, bound to the IPrintSchemaOption.DisplayName. - It's 'ForeGround' font color changes based on the IPrintSchemaOption.Constrained property. - - *Note*: Since this is an expensive operation to perfom, the data is retrieved asynchronously (IsAsync=true, below). - --> - <StackPanel Grid.Row="1" Grid.Column="1"> - <ItemsControl ItemsSource="{Binding Path=PrintSchemaHelperSource.Features, IsAsync=True}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <GroupBox Style="{DynamicResource SimpleGroupBox}" Header="{Binding Path=DisplayName}"> - <ComboBox ItemsSource="{Binding Path=Options}" SelectedItem="{Binding Path=SelectedOption}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" > - <TextBlock Text="{Binding Path=DisplayName}" Foreground="{Binding Converter={StaticResource OptionConstrainedToColor}, Path=Constrained}"/> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ComboBox> - </GroupBox> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> - - <!-- - This modal dialog prevents the user from making changes to print preferences - when print ticket validation is in progress. This dialog is hidden when validation is not in progress. - --> - <c:ValidationModalDialog x:Name="ValidationModalDialog" Grid.Row="1" Grid.Column="1" Visibility="Hidden"/> - - <!-- - This GroupBox displays ink status. There are 4 rectangles that display ink status. The brush that paints color/level is bound to code. - --> - <GroupBox Header="{Binding Path=InkStatusTitle}" Grid.Column="0" Grid.Row="2" Margin="5,0,5,5"> - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="24*"/> - <RowDefinition Height="43*"/> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition /> - <ColumnDefinition /> - <ColumnDefinition /> - <ColumnDefinition /> - </Grid.ColumnDefinitions> - - <Rectangle Grid.Column="0" Fill="{DynamicResource InkBrushC}" Margin="2,0,2,0" Name="InkIndicatorC" Stroke="{DynamicResource InkStatusBorderBrush}" Grid.RowSpan="2"/> - <Rectangle Grid.Column="1" Fill="{DynamicResource InkBrushM}" Margin="2,0,2,0" Name="InkIndicatorM" Stroke="{DynamicResource InkStatusBorderBrush}" Grid.RowSpan="2"/> - <Rectangle Grid.Column="2" Fill="{DynamicResource InkBrushY}" Margin="2,0,2,0" Name="InkIndicatorY" Stroke="{DynamicResource InkStatusBorderBrush}" Grid.RowSpan="2"/> - <Rectangle Grid.Column="3" Fill="{DynamicResource InkBrushK}" Margin="0,0,2,0" Name="InkIndicatorK" Stroke="{DynamicResource InkStatusBorderBrush}" HorizontalAlignment="Right" Width="43" Grid.RowSpan="2"/> - </Grid> - </GroupBox> - - <UniformGrid Grid.Row="2" Grid.Column="2" Rows="1" Columns="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,10,10"> - <Button Content="_Ok" Name="OkButton" Margin="0,0,5,0" Click="Button_Click" /> - <Button Content="_Cancel" Name="CancelButton" Margin="5,0,5,0" Padding="10,0,10,0" Click="Button_Click" /> - <Button Content="_Verify settings" Name="VerifyButton" Margin="5,0,0,0" Click="Button_Click" /> - </UniformGrid> - </Grid> -</Window> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs deleted file mode 100644 index a6266662..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintPreferenceWindow.xaml.cs +++ /dev/null @@ -1,467 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains as the interaction logic and data-binding code/sources for the WPF print preferences window. - -using System; -using System.ComponentModel; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Media; - -using System.Reflection; -using System.IO; - -using System.Xml.Linq; - -using System.Runtime.InteropServices; - -using Microsoft.Samples.Printing.PrinterExtension.Types; -using Microsoft.Samples.Printing.PrinterExtension.Helpers; - -namespace Microsoft.Samples.Printing.PrinterExtension -{ - /// <summary> - /// Interaction logic for PrintPreferenceWindow.xaml. - /// </summary> - public partial class PrintPreferenceWindow : Window, INotifyPropertyChanged - { - public PrintPreferenceWindow() - { - InitializeComponent(); - } - - /// <summary> - /// This method sets up data binding sources and performs other initialization tasks. - /// </summary> - /// <param name="eventArgs"></param> - public void Initialize(PrinterExtensionEventArgs eventArgs) - { - // - // Populate the data binding sources. - // - - DataContext = this; - - printerExtensionEventArgs = eventArgs; - PrinterQueue = eventArgs.Queue; - displayedPrintTicket = eventArgs.Ticket; - - // - // Send a bidi query requesting ink levels. - // - // Please note: As this event will fire many times, it is recommended to maintain event - // listeners for the life time of the application. Furthermore, the relationship to this - // being invoked and the calling SendBidiQuery() is not 1:1; in fact, it is *:N, where the - // listener may be called several times with bidi updates. - // - // - - PrinterQueue.OnBidiResponseReceived += OnBidiResponseReceived; - PrinterQueue.SendBidiQuery("\\Printer.consumables"); - } - - #region UI code - - /// <summary> - /// This event handler is invoked when the window is closing. It is important to Cancel or Complete the request when the window is closing. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - void PrintPreferenceWindow_Closing(object sender, EventArgs e) - { - // Since we are a different process from the printing application we need to hand focus back when complete. - WindowHelper.SetForegroundWindow(printerExtensionEventArgs.WindowParent); - - if (!requestCompleted) - { - printerExtensionEventArgs.Request.Cancel((int)HRESULT.S_FALSE, "The user canceled the operation."); - requestCompleted = true; - } - } - - /// <summary> - /// Button click event handler. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void Button_Click(object sender, RoutedEventArgs e) - { - Button clickedButton = (Button)sender; - - switch (clickedButton.Name) - { - case "CancelButton": - CancelRequestAndCloseWindow(); - break; - - case "OkButton": - // - // Validate the print ticket asynchronously. The event handler is invoked when the validation is completed. - // - - IPrintSchemaAsyncOperation asyncOperation = displayedPrintTicket.ValidateAsync(); - - // - // Pop up a modal dialog that prevents the user from changing selections when validation is in progress. - // Since this dialog lives as long as the parent window, it is not mandatory to unregister the delegate for the - // 'Completed' event. - // - - ValidationModalDialog.Completed += PrintTicketValidateCompleted; // This operation is idempotent. - ValidationModalDialog.StartAsyncOperation(asyncOperation); - break; - - case "VerifyButton": - // - // Force WPF Data binding to refresh the UI. This operation retrieves - // a fresh print capabilities for the print ticket based on the user selections. - // - - PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource")); - break; - } - } - - /// <summary> - /// Close the window in a thread-safe way. - /// </summary> - private void CloseWindow() - { - this.Dispatcher.BeginInvoke(new Action(() => - { - this.Close(); - })); - } - - #endregion - - - #region Data binding sources - - /// <summary> - /// The Print queue for which this window is being displayed. - /// </summary> - public IPrinterQueue PrinterQueue { get; private set; } - - /// <summary> - /// The title for the ink status display. - /// </summary> - public string InkStatusTitle { get; private set; } - - /// <summary> - /// Retrieve a new instance of PrintSchemaHelper, based on the current print ticket being displayed. - /// PrintSchemaHelper encapsulates all the features and options required to populate the print preferences UI. - /// </summary> - public PrintSchemaHelper PrintSchemaHelperSource - { - get - { - // - // Below is the list of features that will be displayed in the print preferences window. - // The features are declared here for convenience/readability. - // - // In performant code, this array would be allocated only once per run of the application. - // - - string[] featureNames = { - "DocumentNUp", - "PageMediaSize", - "DocumentInputBin", - "PageOrientation", - "PageMediaType", - "PageBorderless", - "JobInputBin", - "PageOutputColor", - "DocumentCollate", - "DocumentDuplex" - }; - - return new PrintSchemaHelper(displayedPrintTicket, featureNames); - } - } - - /// <summary> - /// Encapsulates the information required to populate ink level. - /// </summary> - public BidiHelper BidiHelperSource { get; private set; } - - /// <summary> - /// This event is raised when a data from a binding source is modified. - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - - #endregion - - #region Ink level display - /// <summary> - /// This is the method invoked when a bidi response is received. - /// </summary> - /// <param name="sender">IPrinterQueue object.</param> - /// <param name="e">The results of the bidi response.</param> - private void OnBidiResponseReceived(object sender, PrinterQueueEventArgs e) - { - if (e.StatusHResult != (int)HRESULT.S_OK) - { - MockInkStatus(); - return; - } - - // - // Display the ink levels from the mock data. - // - - BidiHelperSource = new BidiHelper(e.Response); - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource")); - } - InkStatusTitle = "Ink status (Live data)"; - } - - /// <summary> - /// This method is invoked when there is an error retrieving Bidi information. - /// A mock bidi response is loaded from resource and displayed. - /// </summary> - private void MockInkStatus() - { - // - // Load mock bidi response resource. - // - - Assembly a = Assembly.GetExecutingAssembly(); - Stream xmlData = a.GetManifestResourceStream("PrinterExtensionSample.bidi_Ink_mock.xml"); - StreamReader sr = new StreamReader(xmlData); - string xmlString = sr.ReadToEnd(); - - // - // Display the ink levels from the mock data. - // - - BidiHelperSource = new BidiHelper(xmlString); - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource")); - } - InkStatusTitle = "Ink status (Mocked data)"; - } - #endregion - - #region PrintSchema-related code - /// <summary> - /// Cancel the current printer extension event and close the current window. - /// </summary> - private void CancelRequestAndCloseWindow() - { - printerExtensionEventArgs.Request.Cancel((int)HRESULT.S_FALSE, "User canceled the operation"); - requestCompleted = true; - CloseWindow(); - } - - /// <summary> - /// Invoked when asynchronous print ticket validation is complete. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void PrintTicketValidateCompleted(object sender, PrintSchemaAsyncOperationEventArgs e) - { - // - // Print ticket validation completed successfully i.e. print ticket selections are not constrained. - // The print ticket needs to be committed, and then window can be closed. - // - - if (e.StatusHResult == (int)HRESULT.S_PT_NO_CONFLICT) - { - this.Dispatcher.Invoke(new Action(() => - { - CommitPrintTicketAsync(e.Ticket); - })); - - } - else - { - // - // The ticket selections are constrained. - // - - this.Dispatcher.Invoke(new Action(() => - { - HandleTicketConstraints(e.Ticket); - })); - } - } - - /// <summary> - /// Invoked when there are constraints in the print ticket selections. - /// </summary> - /// <param name="validatedTicket"></param> - private void HandleTicketConstraints(IPrintSchemaTicket validatedTicket) - { - // - // Retrieved localized display strings from a resource file/ - // - string selectionConflictsFound = PrinterExtensionSample.Strings.SelectionConflictsFound; - string selectionConflictsTitle = PrinterExtensionSample.Strings.SelectionConflictsTitle; - - MessageBoxResult result = MessageBox.Show( - this, - selectionConflictsFound, - selectionConflictsTitle, - MessageBoxButton.YesNoCancel); - - if (result == MessageBoxResult.Yes) - { - CommitPrintTicketAsync(validatedTicket); - } - else - { - PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource")); - } - } - - /// <summary> - /// Commits the input print ticket asynchronously. The completed event handler is expected to close the window. - /// </summary> - /// <param name="validatedTicket"></param> - private void CommitPrintTicketAsync(IPrintSchemaTicket validatedTicket) - { - IPrintSchemaAsyncOperation commitAsyncOperation = printerExtensionEventArgs.Ticket.CommitAsync(validatedTicket); - commitAsyncOperation.Completed += PrintTicketCommitCompleted; - commitAsyncOperation.Start(); - } - - /// <summary> - /// Invoked when the user's selections have been committed into the print ticket. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void PrintTicketCommitCompleted(object sender, PrintSchemaAsyncOperationEventArgs e) - { - CompleteRequestAndCloseWindow(); - } - - /// <summary> - /// Complete the current printer extension request and close the current window. - /// </summary> - private void CompleteRequestAndCloseWindow() - { - // - // It is important to invoke the IPrinterExtensionRequest::Complete method from the thread the - // class instance was create on (i.e. the UI thread). - // - - this.Dispatcher.Invoke(new Action(() => - { - printerExtensionEventArgs.Request.Complete(); - })); - - requestCompleted = true; - CloseWindow(); - } - - /// <summary> - /// Demonstrates how to modify print ticket XML. This piece of code does not perform any functionality. - /// It serves to demonstrate the usage of IPrintSchemaTicket::GetReadStream()/GetWriteStream() - /// </summary> - private void ModifyPrintTicketXml() - { - // - // Load the ticket XML (as a Stream) into an XElement object. - // - - XElement ticketRootXElement = null; - using (Stream ticketReadStream = displayedPrintTicket.GetReadStream()) - { - ticketRootXElement = XElement.Load(ticketReadStream); - } - - // - // Perform any modifications on the XElement object. - // - - - // - // Write the changes back to the print ticket. - // - using (Stream ticketWriteStream = displayedPrintTicket.GetWriteStream()) - { - ticketRootXElement.Save(ticketWriteStream); - } - } - - #endregion - - /// <summary> - /// The arguments passed in for this print preferences event. - /// </summary> - private PrinterExtensionEventArgs printerExtensionEventArgs = null; - - /// <summary> - /// Reflects the currently displayed print preference options. - /// </summary> - private IPrintSchemaTicket displayedPrintTicket = null; - - /// <summary> - /// Determines if IPrinterExtensionRequest::Complete()/Cancel() has been invoked for this Window. - /// instance - /// </summary> - private bool requestCompleted = false; - } - - /// <summary> - /// This class transforms the boolean 'IPrintSchemaOption.Constrained' into a visual form. - /// </summary> - public class OptionConstrainedToDisplayColorConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - if (value == null) - { - return "Black"; - } - - // - // If the option is not constrained, it will be diplayed in black. - // - - PrintSchemaConstrainedSetting constrained = (PrintSchemaConstrainedSetting)value; - if (constrained == PrintSchemaConstrainedSetting.None) - { - return "Black"; - } - - // - // If the option is constrained, it will be displayed in red. - // - - return "Red"; - } - - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - throw new NotImplementedException(); - } - } - - /// <summary> - /// Provides a friendlier way to use HRESULT error codes. - /// </summary> - enum HRESULT : int - { - S_OK = 0x0000, - S_FALSE = 0x0001, - S_PT_NO_CONFLICT = 0x40001, - E_INVALIDARG = unchecked((int)0x80070057), - E_OUTOFMEMORY = unchecked((int)0x8007000E), - ERROR_NOT_FOUND = unchecked((int)0x80070490) - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs deleted file mode 100644 index e9201162..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrintSchemaHelper.cs +++ /dev/null @@ -1,190 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains helper methods that provide a data-binding friendly way to access PrintSchema APIs. - -using System; -using System.Collections.Generic; -using System.Text; - -using System.Runtime.InteropServices; - -using Microsoft.Samples.Printing.PrinterExtension.Types; - -namespace Microsoft.Samples.Printing.PrinterExtension.Helpers -{ - /// <summary> - /// Contains helper methods that provide a data-binding friendly way to access PrintSchema APIs. - /// </summary> - public class PrintSchemaHelper - { - /// <summary> - /// Constructor. Warning constructing this object is expensive, and is best performed - /// asynchronously. - /// </summary> - /// <param name="ticket">The print ticket for which features/options will be retrieved</param> - /// <param name="featureNameCollection">List of features requested</param> - internal PrintSchemaHelper(IPrintSchemaTicket ticket, IEnumerable<String> featureNameCollection) - { - _ticket = ticket; - _featureNameCollection = featureNameCollection; - _capabilities = _ticket.GetCapabilities(); - } - - /// <summary> - /// Retrieve the list of features from the current print ticket. - /// </summary> - public List<PrintSchemaFeatureHelper> Features - { - get - { - _featureHelperCollection = new List<PrintSchemaFeatureHelper>(); - - // - // Retrieve the list of features supported by the driver - // - - foreach (string name in _featureNameCollection) - { - // - // If the feature is not present in the print ticket or the print capabilities, - // ignore it and continue. - // - - IPrintSchemaFeature ticketFeature = _ticket.GetFeatureByKeyName(name); - if (ticketFeature == null) - { - continue; - } - - IPrintSchemaFeature capabilitiesFeature = _capabilities.GetFeatureByKeyName(name); - if (capabilitiesFeature == null) - { - continue; - } - - // If the feature is not meant to be displayed on the UI, ignore it and continue. - if (!capabilitiesFeature.DisplayUI) - { - continue; - } - - _featureHelperCollection.Add(new PrintSchemaFeatureHelper(ticketFeature, _capabilities, capabilitiesFeature)); - } - - return _featureHelperCollection; - } - } - - /// <summary> - /// List of features requested. - /// </summary> - private IEnumerable<string> _featureNameCollection; - - /// <summary> - /// Helper objects that wrap an IPrintSchemaFeature object. - /// </summary> - private List<PrintSchemaFeatureHelper> _featureHelperCollection = null; - - /// <summary> - /// Print ticket passed into this class. - /// </summary> - private IPrintSchemaTicket _ticket = null; - - /// <summary> - /// Print capabilities object. - /// </summary> - private IPrintSchemaCapabilities _capabilities = null; - } - - /// <summary> - /// Contains helper methods that provide a data-binding friendly way to access IPrintSchemaFeature APIs. - /// - /// Note: This sample does not handle Print Ticket/Print Capabilities Options which rely on parameters to - /// be specified, such as psk:Custom , psk:CustomSquare, or psk:CustomMediaSize. If these options are - /// supported by compatible print drivers, then the printer extension should be modified to support them - /// appropriately. - /// </summary> - public class PrintSchemaFeatureHelper - { - /// <summary> - /// Constructor - /// </summary> - /// <param name="ticketFeature">Object retrieved via a call to IPrintSchemaTicket::GetFeature/GetFeatureByKeyName</param> - /// <param name="capabilities">Print capabilities object</param> - /// <param name="capabilitiesFeature">Object retrieved via a call to IPrintSchemaCapabilities::GetFeature/GetFeatureByKeyName</param> - internal PrintSchemaFeatureHelper(IPrintSchemaFeature ticketFeature, IPrintSchemaCapabilities capabilities, IPrintSchemaFeature capabilitiesFeature) - { - // - // Populate the properties exposed by this class. - // - - DisplayName = capabilitiesFeature.DisplayName; - Options = new List<IPrintSchemaOption>(capabilities.GetOptions(ticketFeature)); - - foreach (IPrintSchemaOption option in Options) - { - if (option.Selected) - { - _selectedOption = option; - break; - } - } - - _printTicketFeature = ticketFeature; - } - - /// <summary> - /// Returns the display name for the current IPrintSchemaFeature object. - /// </summary> - public string DisplayName - { - get; - private set; - } - - /// <summary> - /// Retrieve the list of options supported for the current feature. - /// </summary> - public List<IPrintSchemaOption> Options - { - get; - private set; - } - - /// <summary> - /// A 'get' invocation on this property returns the selected option for this print ticket feature. - /// A 'set' invocation on this property sets the selected option for this print ticket feature. - /// </summary> - public IPrintSchemaOption SelectedOption - { - get - { - return _selectedOption; - } - set - { - _selectedOption = value; - _printTicketFeature.SelectedOption = _selectedOption; - } - } - - /// <summary> - /// Feature object retrieved from the print ticket. - /// </summary> - private IPrintSchemaFeature _printTicketFeature = null; - - /// <summary> - /// Selected option for the print ticket feature. - /// </summary> - private IPrintSchemaOption _selectedOption = null; - - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj deleted file mode 100644 index 293ca0e4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/PrinterExtensionSample.csproj +++ /dev/null @@ -1,285 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">x86</Platform> - <ProductVersion>8.0.30703</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{CF554A99-6889-4B86-934F-B6AADBFEFC01}</ProjectGuid> - <OutputType>WinExe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>PrinterExtensionSample</RootNamespace> - <AssemblyName>PrinterExtensionSample</AssemblyName> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <TargetFrameworkProfile> - </TargetFrameworkProfile> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <WarningLevel>4</WarningLevel> - <PublishUrl>publish\</PublishUrl> - <Install>true</Install> - <InstallFrom>Disk</InstallFrom> - <UpdateEnabled>false</UpdateEnabled> - <UpdateMode>Foreground</UpdateMode> - <UpdateInterval>7</UpdateInterval> - <UpdateIntervalUnits>Days</UpdateIntervalUnits> - <UpdatePeriodically>false</UpdatePeriodically> - <UpdateRequired>false</UpdateRequired> - <MapFileExtensions>true</MapFileExtensions> - <ApplicationRevision>0</ApplicationRevision> - <ApplicationVersion>1.0.0.%2a</ApplicationVersion> - <UseApplicationTrust>false</UseApplicationTrust> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Debug|x86' "> - <OutputPath>bin\Win8 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>x86</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Release|x86' "> - <OutputPath>bin\Win8 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>x86</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8 Debug|x64'"> - <OutputPath>bin\x64\Win8 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>x64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8 Release|x64'"> - <OutputPath>bin\x64\Win8 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>x64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Debug|x86' "> - <OutputPath>bin\Win8.1 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>x86</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Release|x86' "> - <OutputPath>bin\Win8.1 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>x86</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8.1 Debug|x64'"> - <OutputPath>bin\x64\Win8.1 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>x64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win8.1 Release|x64'"> - <OutputPath>bin\x64\Win8.1 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>x64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win10 Debug|x86' "> - <OutputPath>bin\Win10 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>x86</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win10 Release|x86' "> - <OutputPath>bin\Win10 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>x86</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win10 Debug|x64'"> - <OutputPath>bin\x64\Win10 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>x64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win10 Release|x64'"> - <OutputPath>bin\x64\Win10 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>x64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win10 Debug|ARM64'"> - <OutputPath>bin\ARM64\Win10 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <PlatformTarget>ARM64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Win10 Release|ARM64'"> - <OutputPath>bin\ARM64\Win10 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <PlatformTarget>ARM64</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <Prefer32Bit>false</Prefer32Bit> - </PropertyGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Drawing" /> - <Reference Include="System.Windows.Forms" /> - <Reference Include="System.Xml" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Core" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="System.Xaml"> - <RequiredTargetFramework>4.0</RequiredTargetFramework> - </Reference> - <Reference Include="WindowsBase" /> - <Reference Include="PresentationCore" /> - <Reference Include="PresentationFramework" /> - </ItemGroup> - <ItemGroup> - <Compile Include="BidiHelper.cs" /> - <Compile Include="PrintSchemaHelper.cs" /> - <Compile Include="Strings.Designer.cs"> - <AutoGen>True</AutoGen> - <DesignTime>True</DesignTime> - <DependentUpon>Strings.resx</DependentUpon> - </Compile> - <Compile Include="ValidationModalDialog.xaml.cs"> - <DependentUpon>ValidationModalDialog.xaml</DependentUpon> - </Compile> - <ApplicationDefinition Include="App.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </ApplicationDefinition> - <Compile Include="WindowHelper.cs" /> - <Page Include="PrintPreferenceWindow.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> - <Compile Include="App.xaml.cs"> - <DependentUpon>App.xaml</DependentUpon> - <SubType>Code</SubType> - </Compile> - <Compile Include="PrintPreferenceWindow.xaml.cs"> - <DependentUpon>PrintPreferenceWindow.xaml</DependentUpon> - <SubType>Code</SubType> - </Compile> - <Page Include="ValidationModalDialog.xaml"> - <Generator>MSBuild:Compile</Generator> - </Page> - </ItemGroup> - <ItemGroup> - <Compile Include="Properties\AssemblyInfo.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Properties\Resources.Designer.cs"> - <AutoGen>True</AutoGen> - <DesignTime>True</DesignTime> - <DependentUpon>Resources.resx</DependentUpon> - </Compile> - <Compile Include="Properties\Settings.Designer.cs"> - <AutoGen>True</AutoGen> - <DependentUpon>Settings.settings</DependentUpon> - <DesignTimeSharedInput>True</DesignTimeSharedInput> - </Compile> - <EmbeddedResource Include="Properties\Resources.resx"> - <Generator>ResXFileCodeGenerator</Generator> - <LastGenOutput>Resources.Designer.cs</LastGenOutput> - </EmbeddedResource> - <EmbeddedResource Include="Strings.resx"> - <Generator>ResXFileCodeGenerator</Generator> - <LastGenOutput>Strings.Designer.cs</LastGenOutput> - </EmbeddedResource> - <None Include="app.config" /> - <None Include="Properties\Settings.settings"> - <Generator>SettingsSingleFileGenerator</Generator> - <LastGenOutput>Settings.Designer.cs</LastGenOutput> - </None> - <AppDesigner Include="Properties\" /> - </ItemGroup> - <ItemGroup> - <Resource Include="Fabrikam_Logo.png" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\PrinterExtensionLibrary\PrinterExtensionLibrary.csproj"> - <Project>{d8da0c4d-f972-4546-9068-8eb256f222f7}</Project> - <Name>PrinterExtensionLibrary</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="bidi_Ink_mock.xml" /> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs deleted file mode 100644 index c3198284..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,62 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("PrinterExtensionSample")] -[assembly: AssemblyDescription("Printer Extension Sample for v4 print drivers")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("PrinterExtensionSample")] -[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file -//inside a <PropertyGroup>. For example, if you are using US english -//in your source files, set the <UICulture> to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs deleted file mode 100644 index b6af3bc4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:4.0.30319.17325 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace PrinterExtensionSample.Properties { - using System; - - - /// <summary> - /// A strongly-typed resource class, for looking up localized strings, etc. - /// </summary> - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// <summary> - /// Returns the cached ResourceManager instance used by this class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrinterExtensionSample.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// <summary> - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx deleted file mode 100644 index af7dbebb..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> -</root>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs deleted file mode 100644 index c0a373ef..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:4.0.30319.17325 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace PrinterExtensionSample.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings deleted file mode 100644 index 033d7a5e..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> - <Profiles> - <Profile Name="(Default)" /> - </Profiles> - <Settings /> -</SettingsFile>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs deleted file mode 100644 index 6ea88a35..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.Designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:4.0.30319.17361 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace PrinterExtensionSample { - using System; - - - /// <summary> - /// A strongly-typed resource class, for looking up localized strings, etc. - /// </summary> - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Strings { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Strings() { - } - - /// <summary> - /// Returns the cached ResourceManager instance used by this class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrinterExtensionSample.Strings", typeof(Strings).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// <summary> - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// <summary> - /// Looks up a localized string similar to Selection conflicts were encountered. - ///Would you like them auto-resolved?. - /// </summary> - internal static string SelectionConflictsFound { - get { - return ResourceManager.GetString("SelectionConflictsFound", resourceCulture); - } - } - - /// <summary> - /// Looks up a localized string similar to Selection conflicts. - /// </summary> - internal static string SelectionConflictsTitle { - get { - return ResourceManager.GetString("SelectionConflictsTitle", resourceCulture); - } - } - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx deleted file mode 100644 index 8f4878a4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/Strings.resx +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" use="required" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <data name="SelectionConflictsFound" xml:space="preserve"> - <value>Selection conflicts were encountered. -Would you like them auto-resolved?</value> - <comment>String to display in the message box when print ticket settings have conflicts.</comment> - </data> - <data name="SelectionConflictsTitle" xml:space="preserve"> - <value>Selection conflicts</value> - <comment>Title string on the message box that displays the selection conflicts message.</comment> - </data> -</root>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml deleted file mode 100644 index c949efd4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml +++ /dev/null @@ -1,19 +0,0 @@ -<UserControl x:Class="Microsoft.Samples.Printing.PrinterExtension.ValidationModalDialog" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> - <Grid DataContext="{Binding ElementName=root}"> - <Border Background="#60000000"> - <Border BorderBrush="Black" BorderThickness="1" Background="AliceBlue" - CornerRadius="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center"> - <Border.BitmapEffect> - <DropShadowBitmapEffect Color="Black" Opacity="0.5" Direction="90" ShadowDepth="0.7" /> - </Border.BitmapEffect> - <UniformGrid Grid.Row="1" Margin="10" Rows="2" Columns="1" HorizontalAlignment="Center" VerticalAlignment="Bottom"> - <TextBlock>Validating.. please wait</TextBlock> - <Button x:Name="CancelValidationButton" Content="Cancel" Click="CancelValidationButton_Click"/> - </UniformGrid> - </Border> - </Border> - </Grid> -</UserControl> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs deleted file mode 100644 index 0728c84c..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/ValidationModalDialog.xaml.cs +++ /dev/null @@ -1,108 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains as the interaction logic for ValidationModaldialog. -// This dialog prevents the user from making changes to print ticket settings when asynchronous -// validation is being performed. - -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; - -using Microsoft.Samples.Printing.PrinterExtension.Types; - -namespace Microsoft.Samples.Printing.PrinterExtension -{ - /// <summary> - /// Interaction logic for ValidationModalDialog.xaml - /// This dialog prevents the user from changing print preferences when validation is in progress. - /// </summary> - public partial class ValidationModalDialog : UserControl - { - public ValidationModalDialog() - { - InitializeComponent(); - Visibility = Visibility.Hidden; - } - - /// <summary> - /// Starts the asynchronous operation. - /// </summary> - /// <param name="asyncOperationToStart">Async operation context.</param> - public void StartAsyncOperation(IPrintSchemaAsyncOperation asyncOperationToStart) - { - this.asyncOperationContext = asyncOperationToStart; - Visibility = Visibility.Visible; - asyncOperationToStart.Completed += asyncOperation_Completed; - asyncOperationToStart.Start(); - } - - - /// <summary> - /// This method is invoked from a different thread once asynchronous validation is completed. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void asyncOperation_Completed(object sender, PrintSchemaAsyncOperationEventArgs e) - { - ValidationHResult = e.StatusHResult; - HideWindow(); - - if (Completed != null) - { - Completed(this, e); - } - } - - /// <summary> - /// Hides the current window. - /// </summary> - private void HideWindow() - { - this.Dispatcher.Invoke(new Action(() => - { - Visibility = Visibility.Hidden; - })); - } - - - /// <summary> - /// Result of the validation operation. - /// </summary> - public int ValidationHResult - { - get; - private set; - } - - /// <summary> - /// Invoked then the "Cancel" button is clicked. - /// </summary> - /// <param name="sender"></param> - /// <param name="e"></param> - private void CancelValidationButton_Click(object sender, RoutedEventArgs e) - { - asyncOperationContext.Cancel(); - HideWindow(); - } - - /// <summary> - /// Invoked when the asynchronous operation is completed. - /// </summary> - public event EventHandler<PrintSchemaAsyncOperationEventArgs> Completed; - - /// <summary> - /// Asynchronous operation context. - /// </summary> - private IPrintSchemaAsyncOperation asyncOperationContext; - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs deleted file mode 100644 index fe830921..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/WindowHelper.cs +++ /dev/null @@ -1,83 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains helper methods that provide a friendly way to access win32 window functions. - -using System; -using System.Runtime.InteropServices; - -namespace Microsoft.Samples.Printing.PrinterExtension.Helpers -{ - class WindowHelper - { - /// <summary> - /// P/Invoke signature for Win32 function "SetForegroundWindow". - /// </summary> - /// <param name="hwnd">Handle to window</param> - [return: MarshalAs(UnmanagedType.Bool)] - [DllImport("User32", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] - public static extern bool SetForegroundWindow(IntPtr hwnd); - - /// <summary> - /// Wrapper for Win32 function "FlashWindowEx" - /// </summary> - /// <param name="hWnd">Handle of the window to flash</param> - public static bool FlashWindow(IntPtr hWnd) - { - FLASHWINFO fInfo = new FLASHWINFO(); - - fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); - fInfo.hwnd = hWnd; // Handle to window - fInfo.uCount = UInt32.MaxValue; // Number of times to flash - fInfo.dwTimeout = 0; // Use default cursor blink rate - // Flash both window caption and taskbar button, until the window is brought to the foreground. - fInfo.dwFlags = (uint)(FLASHW.ALL | FLASHW.TIMERNOFG); - - return FlashWindowEx(ref fInfo); - } - - #region private members - - /// <summary> - /// P/Invoke signature for Win32 function "FlashWindowEx". - /// </summary> - [return: MarshalAs(UnmanagedType.Bool)] - [DllImport("User32", CharSet = CharSet.Auto, SetLastError = false, ExactSpelling = true)] - private static extern bool FlashWindowEx(ref FLASHWINFO pwfi); - - [StructLayout(LayoutKind.Sequential)] - private struct FLASHWINFO - { - public UInt32 cbSize; - public IntPtr hwnd; - public UInt32 dwFlags; - public UInt32 uCount; - public UInt32 dwTimeout; - } - - /// <summary> - /// Represents the FLASH_Xxx flags - /// </summary> - [Flags] - private enum FLASHW : uint - { - /// <summary> - /// Flash both the window caption and taskbar button - /// </summary> - ALL = 3, - /// <summary> - /// Flash continuously until the window comes to the foreground. - /// </summary> - TIMERNOFG = 12 - } - - #endregion - } -} diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config deleted file mode 100644 index bfc57c55..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/app.config +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0"?> -<configuration> - <appSettings> - <add key="UseSetWindowPosForTopmostWindows" value="True" /> - </appSettings> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> - </startup> -</configuration> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml b/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml deleted file mode 100644 index b1a685f1..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/ExtensionSample/bidi_Ink_mock.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<bidi:Get xmlns:bidi="http://schemas.microsoft.com/windows/2005/03/printing/bidi"> - <Query schema="\Printer.Consumables"> - <Schema name="\Printer.Consumables.BlackInk:Color"> - <BIDI_STRING>Black</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.BlackInk:Installed"> - <BIDI_BOOL>true</BIDI_BOOL> - </Schema> - <Schema name="\Printer.Consumables.BlackInk:Level"> - <BIDI_INT>86</BIDI_INT> - </Schema> - <Schema name="\Printer.Consumables.BlackInk:Type"> - <BIDI_STRING>InkSupply</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.CyanInk:Color"> - <BIDI_STRING>Cyan</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.CyanInk:Installed"> - <BIDI_BOOL>true</BIDI_BOOL> - </Schema> - <Schema name="\Printer.Consumables.CyanInk:Level"> - <BIDI_INT>79</BIDI_INT> - </Schema> - <Schema name="\Printer.Consumables.CyanInk:Type"> - <BIDI_STRING>InkSupply</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.LightBlackInk:Color"> - <BIDI_STRING>LightBlack</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.LightBlackInk:Installed"> - <BIDI_BOOL>true</BIDI_BOOL> - </Schema> - <Schema name="\Printer.Consumables.LightBlackInk:Level"> - <BIDI_INT>0</BIDI_INT> - </Schema> - <Schema name="\Printer.Consumables.LightBlackInk:Type"> - <BIDI_STRING>InkSupply</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.MagentaInk:Color"> - <BIDI_STRING>Magenta</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.MagentaInk:Installed"> - <BIDI_BOOL>true</BIDI_BOOL> - </Schema> - <Schema name="\Printer.Consumables.MagentaInk:Level"> - <BIDI_INT>79</BIDI_INT> - </Schema> - <Schema name="\Printer.Consumables.MagentaInk:Type"> - <BIDI_STRING>InkSupply</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.PrintHead:Installed"> - <BIDI_BOOL>true</BIDI_BOOL> - </Schema> - <Schema name="\Printer.Consumables.PrintHead:Level"> - <BIDI_INT>-1</BIDI_INT> - </Schema> - <Schema name="\Printer.Consumables.PrintHead:Type"> - <BIDI_STRING>PrintHead</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.YellowInk:Color"> - <BIDI_STRING>Yellow</BIDI_STRING> - </Schema> - <Schema name="\Printer.Consumables.YellowInk:Installed"> - <BIDI_BOOL>true</BIDI_BOOL> - </Schema> - <Schema name="\Printer.Consumables.YellowInk:Level"> - <BIDI_INT>87</BIDI_INT> - </Schema> - <Schema name="\Printer.Consumables.YellowInk:Type"> - <BIDI_STRING>InkSupply</BIDI_STRING> - </Schema> - </Query> -</bidi:Get> diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs deleted file mode 100644 index 60277c61..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionAdapters.cs +++ /dev/null @@ -1,2051 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains Adapters that wrap the PrinterExtension COM Interop types. -// -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; -using System.Runtime; -using System.Runtime.InteropServices; -using Microsoft.Samples.Printing.PrinterExtension.Types; - -namespace Microsoft.Samples.Printing.PrinterExtension -{ - // The following three classes are constructable adapters for the root of the - // object model. The balance of the types will typically be interfaces. This - // choice was made so we can share the interface file between projects and enforce - // the same public surface from both the "Reference" and "Implementation" projects. - - #region PrinterExtension adapter classes - - /// <summary> - /// Wraps an COM pointer to IPrinterExtensionContext - /// </summary> - public class PrinterExtensionContext : IPrinterExtensionContext - { - /// <summary> - /// Wraps an opaque COM pointer to IPrinterExtensionContext and provides usable methods - /// </summary> - /// <param name="comContext">Opaque COM pointer to IPrinterExtensionContext</param> - public PrinterExtensionContext(Object comContext) - { - _context = (PrinterExtensionLib.IPrinterExtensionContext)comContext; - } - - #region IPrinterExtensionContext methods - - /// <summary> - /// Maps to COM IPrinterExtensionContext::PrinterQueue - /// </summary> - public IPrinterQueue Queue - { - get { return new PrinterQueue(_context.PrinterQueue); } - } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::PrintSchemaTicket - /// </summary> - public IPrintSchemaTicket Ticket - { - get { return new PrintSchemaTicket(_context.PrintSchemaTicket); } - } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::DriverProperties - /// </summary> - public IPrinterPropertyBag DriverProperties - { - get - { - try - { - return new PrinterPropertyBag(_context.DriverProperties, PrintPropertyBagType.DriverProperties); - } - catch (Exception) - { - // If the property bag is not found, instead of - // throwing an exception, return null, which is more appropriate for a property 'get' operation. - return null; - } - } - } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::UserProperties - /// </summary> - public IPrinterPropertyBag UserProperties - { - get { return new PrinterPropertyBag(_context.UserProperties, PrintPropertyBagType.UserProperties); } - } - - #endregion - - #region Implementation details - - private PrinterExtensionLib.IPrinterExtensionContext _context; - - // Prevent default construction - private PrinterExtensionContext() - { - } - - #endregion - } - - /// <summary> - /// Wraps an COM pointer to IPrinterExtensionEventArgs - /// </summary> - public class PrinterExtensionEventArgs : EventArgs, IPrinterExtensionEventArgs - { - /// <summary> - /// Wraps an opaque COM pointer to IPrinterExtensionEventArgs and provides usable methods - /// </summary> - /// <param name="comContext">Opaque COM pointer to IPrinterExtensionEventArgs</param> - public PrinterExtensionEventArgs(Object eventArgs) - { - _eventArgs = (PrinterExtensionLib.IPrinterExtensionEventArgs)eventArgs; - _context = new PrinterExtensionContext(eventArgs); - } - - #region IPrinterExtensionEventArgs methods - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::BidiNotification - /// </summary> - public string BidiNotification - { - get { return _eventArgs.BidiNotification; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::ReasonId - /// </summary> - public Guid ReasonId - { - get { return _eventArgs.ReasonId; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::Request - /// </summary> - public IPrinterExtensionRequest Request - { - get { return new PrinterExtensionRequest(_eventArgs.Request); } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::SourceApplication - /// </summary> - public string SourceApplication - { - get { return _eventArgs.SourceApplication; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::DetailedReasonId - /// </summary> - public Guid DetailedReasonId - { - get { return _eventArgs.DetailedReasonId; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::WindowModal - /// </summary> - public bool WindowModal - { - get - { - if (_eventArgs.WindowModal != 0) - { - return true; - } - return false; - } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::WindowParent - /// </summary> - public IntPtr WindowParent - { - get { return _eventArgs.WindowParent; } - } - - #endregion - - #region IPrinterExtensionContext methods - - /// <summary> - /// Maps to COM IPrinterExtensionContext::PrinterQueue - /// </summary> - public IPrinterQueue Queue - { - get { return _context.Queue; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::PrintSchemaTicket - /// </summary> - public IPrintSchemaTicket Ticket - { - get { return _context.Ticket; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::DriverProperties - /// </summary> - public IPrinterPropertyBag DriverProperties - { - get { return _context.DriverProperties; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::UserProperties - /// </summary> - public IPrinterPropertyBag UserProperties - { - get { return _context.UserProperties; } - } - - #endregion - - #region Implementation details - - private PrinterExtensionLib.IPrinterExtensionEventArgs _eventArgs; - - /// <summary> - /// Containment - since multiple inheritance is not possible in C#. - /// </summary> - private PrinterExtensionContext _context; - - #endregion - } - - /// <summary> - /// This class provides wraps IPrinterExtensionContextCollection in a IEnumerable interface - /// </summary> - public sealed class PrinterQueuesEnumeratedEventArgs : EventArgs, IEnumerable<IPrinterExtensionContext> - { - - #region IEnumerable<IPrinterExtensionContext> methods - - public IEnumerator<IPrinterExtensionContext> GetEnumerator() - { - for (uint i = 0; i < _contextCollection.Count; i++) - { - yield return new PrinterExtensionContext(_contextCollection.GetAt(i)); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return (IEnumerator)GetEnumerator(); - } - - #endregion - - #region Implementation details - - internal PrinterQueuesEnumeratedEventArgs(PrinterExtensionLib.IPrinterExtensionContextCollection contextCollection) - { - _contextCollection = contextCollection; - } - - private PrinterExtensionLib.IPrinterExtensionContextCollection _contextCollection; - - #endregion - } - -#if WINDOWS_81_APIS - internal sealed class PrinterExtensionAsyncOperation : IPrinterExtensionAsyncOperation - { - #region IPrinterExtensionAsyncOperation methods - - public void Cancel() - { - _asyncOperation.Cancel(); - } - - #endregion - - #region Implementation methods - - internal PrinterExtensionAsyncOperation(PrinterExtensionLib.IPrinterExtensionAsyncOperation asyncOperation) - { - _asyncOperation = asyncOperation; - } - - private PrinterExtensionLib.IPrinterExtensionAsyncOperation _asyncOperation; - - #endregion - } -#endif - #endregion - - #region COM Adapter Classes - - // - // The following class provide an adapter that exposes a 'Stream' and wraps a - // COM pointer to PrinterExtensionLib.IStream - // - internal class PrinterExtensionLibIStreamAdapter : Stream, IDisposable - { - public PrinterExtensionLibIStreamAdapter(PrinterExtensionLib.IStream stream, bool canWrite = false, bool canSeek = false, bool canRead = true) - { - if (stream != null) - { - _printerExtensionIStream = stream; - } - else - { - throw new ArgumentNullException("stream"); - } - _streamValidation = new StreamValidation(canWrite, canSeek, canRead); - } - - ~PrinterExtensionLibIStreamAdapter() - { - Dispose(false); - } - - #region Overridden Stream methods - - public override int Read(byte[] buffer, int offset, int count) - { - _streamValidation.ValidateRead(buffer, offset, count); - - uint bytesRead = 0; - - // Pin the byte array so that it will not be moved by the garbage collector - byte[] tempBuffer = new byte[count]; - GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); - try - { - _printerExtensionIStream.RemoteRead(out tempBuffer[0], Convert.ToUInt32(count), out bytesRead); - - Array.Copy(tempBuffer, 0, buffer, offset, (int)bytesRead); // Safe to cast. Cannot be bigger than 'int count' - } - finally - { - gcHandle.Free(); - } - - return (int)bytesRead; // Safe to cast; bytesRead can never be larger than 'int count' - } - - public override void Write(byte[] buffer, int offset, int count) - { - _streamValidation.ValidateWrite(buffer, offset, count); - - uint written; - - // Pin the byte array so that it will not be moved by the garbage collector - byte[] tempBuffer = new byte[count]; - GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); - try - { - Array.Copy(buffer, offset, tempBuffer, 0, count); - _printerExtensionIStream.RemoteWrite(ref tempBuffer[0], Convert.ToUInt32(count), out written); - } - finally - { - gcHandle.Free(); - } - - if ((int)written < count) - { - throw new IOException(); - } - } - - public override long Seek(long offset, SeekOrigin origin) - { - _streamValidation.ValidateSeek(offset, origin); - - uint istreamSeekOrigin = 0; - - switch (origin) - { - case SeekOrigin.Begin: - istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_SET; - break; - - case SeekOrigin.Current: - istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_CUR; - break; - - case SeekOrigin.End: - istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_END; - break; - } - - PrinterExtensionLib._LARGE_INTEGER dlibMove; - PrinterExtensionLib._ULARGE_INTEGER plibNewPosition; - - dlibMove.QuadPart = offset; - - _printerExtensionIStream.RemoteSeek(dlibMove, istreamSeekOrigin, out plibNewPosition); - return Convert.ToInt64(plibNewPosition.QuadPart); - } - - public override long Length - { - get - { - _streamValidation.ValidateSeek(); - - PrinterExtensionLib.tagSTATSTG statstg; - _printerExtensionIStream.Stat(out statstg, 1 /* STATSFLAG_NONAME*/ ); - return Convert.ToInt64(statstg.cbSize.QuadPart); - } - } - public override long Position - { - get { return Seek(0, SeekOrigin.Current); } - set { Seek(value, SeekOrigin.Begin); } - } - - public override void SetLength(long value) - { - _streamValidation.ValidateSeek(); - - PrinterExtensionLib._ULARGE_INTEGER libNewSize; - libNewSize.QuadPart = Convert.ToUInt64(value); - _printerExtensionIStream.SetSize(libNewSize); - } - - public override void Flush() - { - _printerExtensionIStream.Commit(0); - } - - public override bool CanRead - { - get { return _streamValidation.CanRead; } - } - - public override bool CanWrite - { - get { return _streamValidation.CanWrite; } - } - - public override bool CanSeek - { - get { return _streamValidation.CanSeek; } - } - - #endregion - - #region IDisposable methods - - protected override void Dispose(bool disposing) - { - if (_disposed) - { - return; - } - - try - { - if (disposing) - { - _streamValidation.Dispose(); - } - - if (_printerExtensionIStream != null) - { - Marshal.ReleaseComObject(_printerExtensionIStream); - _printerExtensionIStream = null; - } - } - finally - { - base.Dispose(disposing); - } - _disposed = true; - } - - #endregion - - #region Implementation details - - // Prevent default construction - private PrinterExtensionLibIStreamAdapter() { } - - private bool _disposed = false; - private PrinterExtensionLib.IStream _printerExtensionIStream = null; - private StreamValidation _streamValidation = null; - - #endregion - } - - - // - // The following class provide an adapter that exposes a 'Stream' and wraps a - // COM pointer to the standard COM 'IStream' interface - // - internal class ComIStreamAdapter : Stream, IDisposable - { - public ComIStreamAdapter(System.Runtime.InteropServices.ComTypes.IStream stream, bool canWrite = false, bool canSeek = false, bool canRead = true) - { - if (stream != null) - { - _comIstream = stream; - } - else - { - throw new ArgumentNullException("stream"); - } - _streamValidation = new StreamValidation(canWrite, canSeek, canRead); - } - - ~ComIStreamAdapter() - { - Dispose(false); - } - - #region Overridden Stream methods - - public override int Read(byte[] buffer, int offset, int count) - { - _streamValidation.ValidateRead(buffer, offset, count); - - uint bytesRead = 0; - - // Pin the byte array so that it will not be moved by the garbage collector - byte[] tempBuffer = new byte[count]; - GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); - IntPtr bytesReadPtr = Marshal.AllocHGlobal(sizeof(int)); - try - { - _comIstream.Read(tempBuffer, count, bytesReadPtr); - bytesRead = (uint)Marshal.ReadInt32(bytesReadPtr); - - Array.Copy(tempBuffer, 0, buffer, offset, (int)bytesRead); // Safe to cast. Cannot be bigger than 'int count' - } - finally - { - Marshal.FreeHGlobal(bytesReadPtr); - gcHandle.Free(); - } - - return (int)bytesRead; // Safe to cast; bytesRead can never be larger than 'int count' - } - - public override void Write(byte[] buffer, int offset, int count) - { - _streamValidation.ValidateWrite(buffer, offset, count); - - uint written; - - // Pin the byte array so that it will not be moved by the garbage collector - byte[] tempBuffer = new byte[count]; - GCHandle gcHandle = GCHandle.Alloc(tempBuffer, GCHandleType.Pinned); - IntPtr writeCountPointer = Marshal.AllocHGlobal(sizeof(int)); - try - { - Array.Copy(buffer, offset, tempBuffer, 0, count); - - _comIstream.Write(tempBuffer, count, writeCountPointer); - written = (uint)Marshal.ReadInt32(writeCountPointer); // safe to cast. 'written' is always non-negative - } - finally - { - gcHandle.Free(); - Marshal.FreeHGlobal(writeCountPointer); - } - - if ((int)written < count) - { - throw new IOException(); - } - } - - public override long Seek(long offset, SeekOrigin origin) - { - _streamValidation.ValidateSeek(offset, origin); - - uint istreamSeekOrigin = 0; - - switch (origin) - { - case SeekOrigin.Begin: - istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_SET; - break; - - case SeekOrigin.Current: - istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_CUR; - break; - - case SeekOrigin.End: - istreamSeekOrigin = (uint)PrinterExtensionLib.tagSTREAM_SEEK.STREAM_SEEK_END; - break; - } - - IntPtr seekPositionPointer = Marshal.AllocHGlobal(sizeof(long)); - long seekPosition = 0; - try - { - _comIstream.Seek(offset, (int)istreamSeekOrigin, seekPositionPointer); - seekPosition = Marshal.ReadInt64(seekPositionPointer); - } - finally - { - Marshal.FreeHGlobal(seekPositionPointer); - } - - return seekPosition; - } - - public override long Length - { - get - { - _streamValidation.ValidateSeek(); - - System.Runtime.InteropServices.ComTypes.STATSTG statstg; - _comIstream.Stat(out statstg, 1 /* STATSFLAG_NONAME*/ ); - return statstg.cbSize; - } - } - public override long Position - { - get { return Seek(0, SeekOrigin.Current); } - set { Seek(value, SeekOrigin.Begin); } - } - - public override void SetLength(long value) - { - _streamValidation.ValidateSeek(); - _comIstream.SetSize(value); - } - - public override void Flush() - { - _comIstream.Commit(0); - } - - public override bool CanRead - { - get { return _streamValidation.CanRead; } - } - - public override bool CanWrite - { - get { return _streamValidation.CanWrite; } - } - - public override bool CanSeek - { - get { return _streamValidation.CanSeek; } - } - - #endregion - - #region IDisposable methods - - protected override void Dispose(bool disposing) - { - if (_disposed) - { - return; - } - - try - { - if (disposing) - { - _streamValidation.Dispose(); - } - - if (_comIstream != null) - { - Marshal.ReleaseComObject(_comIstream); - _comIstream = null; - } - } - finally - { - base.Dispose(disposing); - } - _disposed = true; - } - - #endregion - - #region Implementation details - - // Prevent default construction - private ComIStreamAdapter() { } - - private bool _disposed = false; - private System.Runtime.InteropServices.ComTypes.IStream _comIstream = null; - private StreamValidation _streamValidation = null; - - #endregion - } - - internal class StreamValidation : IDisposable - { - internal StreamValidation(bool canWrite = false, bool canSeek = false, bool canRead = true) - { - _canWrite = canWrite; - _canSeek = canSeek; - _canRead = canRead; - } - - internal void ValidateRead(byte[] buffer, int offset, int count) - { - if (!_canRead) - { - throw new NotSupportedException(); - } - if (_disposed == true) - { - throw new ObjectDisposedException("COM IStream"); - } - if (buffer == null) - { - throw new ArgumentNullException("buffer"); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset"); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count"); - } - if ((buffer.Length - offset) < count) - { - throw new ArgumentException(); - } - } - - internal void ValidateWrite(byte[] buffer, int offset, int count) - { - if (!_canWrite) - { - throw new NotSupportedException(); - } - if (_disposed == true) - { - throw new ObjectDisposedException("COM IStream"); - } - if (buffer == null) - { - throw new ArgumentNullException("buffer"); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset"); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count"); - } - if ((buffer.Length - offset) < count) - { - throw new ArgumentException("Insufficient buffer size"); - } - } - - internal void ValidateSeek(long offset, SeekOrigin origin) - { - ValidateSeek(); - if ((origin < SeekOrigin.Begin) || (origin > SeekOrigin.End)) - { - throw new ArgumentException("Invalid value", "origin"); - } - } - - internal void ValidateSeek() - { - if (!_canSeek) - { - throw new NotSupportedException(); - } - if (_disposed == true) - { - throw new ObjectDisposedException("COM IStream"); - } - } - - public bool CanRead - { - get { return _canRead; } - } - - public bool CanWrite - { - get { return _canWrite; } - } - - public bool CanSeek - { - get { return _canSeek; } - } - - #region IDisposable methods - - public void Dispose() - { - _disposed = true; - } - - #endregion - - #region Implementation details - - private bool _disposed = false; - private bool _canWrite = false; - private bool _canSeek = false; - private bool _canRead = true; - - #endregion - } - - #endregion - - #region PrintSchema Adapter Classes - - // - // Following are concrete implementation of the PrinterExtension interfaces - // These classes wrap the underlying COM interfaces. - // - - internal class PrintSchemaOption : IPrintSchemaOption - { - - #region IPrintSchemaOption methods - - public bool Selected - { - get { return (0 == _option.Selected) ? false : true; } - } - - public PrintSchemaConstrainedSetting Constrained - { - get { return (PrintSchemaConstrainedSetting)_option.Constrained; } - } - - #endregion - - #region IPrintSchemaDisplayableElement methods - - public string DisplayName { get { return _option.DisplayName; } } - public string Name { get { return _option.Name; } } - public string XmlNamespace { get { return _option.NamespaceUri; } } - - #endregion - - #region Implementation details - - internal PrintSchemaOption(PrinterExtensionLib.IPrintSchemaOption option) - { - _option = option; - } - - internal PrinterExtensionLib.IPrintSchemaOption InteropOption - { - get { return _option; } - set { _option = value; } - } - - // - // Create the correct 'PrintSchemaOption' subclass, possibly exposing one of the these interfaces - // 1. IPrintSchemaPageMediaSizeOption - // 2. IPrintSchemaNUpOption - // - internal static IPrintSchemaOption CreateOptionSubclass(PrinterExtensionLib.IPrintSchemaOption option) - { - // IPrintSchemaNUpOption option - if (option is PrinterExtensionLib.IPrintSchemaNUpOption) - { - return new PrintSchemaNUpOption(option); - } - - // IPrintSchemaPageMediaSizeOption option - if (option is PrinterExtensionLib.IPrintSchemaPageMediaSizeOption) - { - return new PrintSchemaPageMediaSizeOption(option); - } - - return new PrintSchemaOption(option); - } - - internal PrinterExtensionLib.IPrintSchemaOption _option; - - // Prevent default constuction - private PrintSchemaOption() { } - - #endregion - } - - internal sealed class PrintSchemaPageMediaSizeOption : PrintSchemaOption, IPrintSchemaPageMediaSizeOption - { - #region IPrintSchemaPageMediaSizeOption methods - - public uint HeightInMicrons - { - get { return _pageMediaSizeOption.HeightInMicrons; } - } - - public uint WidthInMicrons - { - get { return _pageMediaSizeOption.WidthInMicrons; } - } - - #endregion - - #region Implementation details - - internal PrintSchemaPageMediaSizeOption(PrinterExtensionLib.IPrintSchemaOption option) - : base(option) - { - _pageMediaSizeOption = _option as PrinterExtensionLib.IPrintSchemaPageMediaSizeOption; - if (null == _pageMediaSizeOption) - { - throw new NotImplementedException("Could not retrieve IPrintSchemaPageMediaSizeOption interface."); - } - } - - private PrinterExtensionLib.IPrintSchemaPageMediaSizeOption _pageMediaSizeOption; - - #endregion - } - - internal sealed class PrintSchemaNUpOption : PrintSchemaOption, IPrintSchemaNUpOption - { - #region IPrintSchemaNUpOption methods - - public uint PagesPerSheet - { - get { return _nupOption.PagesPerSheet; } - } - - #endregion - - #region Implementation details - - internal PrintSchemaNUpOption(PrinterExtensionLib.IPrintSchemaOption option) : - base(option) - { - _nupOption = _option as PrinterExtensionLib.IPrintSchemaNUpOption; - if (null == _nupOption) - { - throw new NotImplementedException("Could not retrieve IPrintSchemaNUpOption interface."); - } - } - - private PrinterExtensionLib.IPrintSchemaNUpOption _nupOption; - - #endregion - } - - /// <summary> - /// This class provides wraps IPrintSchemaOptionCollection in a IEnumerable interface - /// </summary> - internal sealed class PrintSchemaOptionsCollection : IEnumerable<IPrintSchemaOption> - { - - #region IEnumerable<IPrintSchemaOption> methods - - public IEnumerator<IPrintSchemaOption> GetEnumerator() - { - for (uint i = 0; i < _optionCollection.Count; i++) - { - yield return new PrintSchemaOption(_optionCollection.GetAt(i)); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return (IEnumerator)GetEnumerator(); - } - - #endregion - - #region Implementation details - - internal PrintSchemaOptionsCollection(PrinterExtensionLib.IPrintSchemaOptionCollection optionCollection) - { - _optionCollection = optionCollection; - } - - private PrinterExtensionLib.IPrintSchemaOptionCollection _optionCollection; - - #endregion - } - - internal sealed class PrintSchemaFeature : IPrintSchemaFeature - { - #region IPrintSchemaFeature methods - - public PrintSchemaSelectionType SelectionType - { - get { return (PrintSchemaSelectionType)_feature.SelectionType; } - } - - public IPrintSchemaOption GetOption(string name) - { - return GetOption(name, PrintSchemaConstants.KeywordsNamespaceUri); - } - - public IPrintSchemaOption GetOption(string name, string xmlNamespace) - { - PrinterExtensionLib.IPrintSchemaOption option = _feature.GetOption(name, xmlNamespace); - if (option != null) - { - return PrintSchemaOption.CreateOptionSubclass(option); - } - - return null; - } - - public IPrintSchemaOption SelectedOption - { - get - { - return PrintSchemaOption.CreateOptionSubclass(_feature.SelectedOption); - } - set - { - _feature.SelectedOption = (value as PrintSchemaOption).InteropOption; - } - } - - public bool DisplayUI - { - get - { - return (0 == _feature.DisplayUI) ? false : true; - } - } - - #endregion - - #region IPrintSchemaDisplayableElement methods - - public string DisplayName { get { return _feature.DisplayName; } } - public string Name { get { return _feature.Name; } } - public string XmlNamespace { get { return _feature.NamespaceUri; } } - - #endregion - - #region Implementation details - - internal PrintSchemaFeature(PrinterExtensionLib.IPrintSchemaFeature feature) - { - _feature = feature; - } - - internal PrinterExtensionLib.IPrintSchemaFeature InteropFeature - { - get { return _feature; } - } - - private PrinterExtensionLib.IPrintSchemaFeature _feature; - - #endregion - } - - internal sealed class PrintSchemaPageImageableSize : IPrintSchemaPageImageableSize - { - #region IPrintSchemaPageImageableSize methods - - public uint ExtentHeightInMicrons - { - get { return _pageImageableSize.ExtentHeightInMicrons; } - } - - public uint ExtentWidthInMicrons - { - get { return _pageImageableSize.ExtentWidthInMicrons; } - } - - public uint ImageableSizeHeightInMicrons - { - get { return _pageImageableSize.ImageableSizeHeightInMicrons; } - } - - public uint ImageableSizeWidthInMicrons - { - get { return _pageImageableSize.ImageableSizeWidthInMicrons; } - } - - public uint OriginHeightInMicrons - { - get { return _pageImageableSize.OriginHeightInMicrons; } - } - - public uint OriginWidthInMicrons - { - get { return _pageImageableSize.OriginWidthInMicrons; } - } - - #endregion - - #region IPrintSchemaElement methods - - public string Name { get { return _pageImageableSize.Name; } } - public string XmlNamespace { get { return _pageImageableSize.NamespaceUri; } } - - #endregion - - #region Implementation details - - internal PrintSchemaPageImageableSize(PrinterExtensionLib.IPrintSchemaPageImageableSize pageImageableSize) - { - _pageImageableSize = pageImageableSize; - } - - private PrinterExtensionLib.IPrintSchemaPageImageableSize _pageImageableSize; - - #endregion - } - -#if WINDOWS_81_APIS - internal sealed class PrintSchemaParameterDefinition : IPrintSchemaParameterDefinition - { - #region IPrintSchemaParameterDefinition methods - - public bool UserInputRequired - { - get - { - if (_parameter.UserInputRequired != 0) - { - return true; - } - return false; - } - } - - public string UnitType - { - get { return _parameter.UnitType; } - } - - public PrintSchemaParameterDataType DataType - { - get { return (PrintSchemaParameterDataType)_parameter.DataType; } - } - - public int RangeMin - { - get { return _parameter.RangeMin; } - } - - public int RangeMax - { - get { return _parameter.RangeMax; } - } - #endregion - - #region IPrintSchemaDisplayableItem methods - - public string DisplayName { get { return _parameter.DisplayName; } } - public string Name { get { return _parameter.Name; } } - public string XmlNamespace { get { return _parameter.NamespaceUri; } } - - #endregion - - #region Implementation details - - internal PrintSchemaParameterDefinition(PrinterExtensionLib.IPrintSchemaParameterDefinition parameter) - { - _parameter = parameter; - } - - private PrinterExtensionLib.IPrintSchemaParameterDefinition _parameter; - - #endregion - } - - internal sealed class PrintSchemaParameterInitializer : IPrintSchemaParameterInitializer - { - #region IPrintSchemaParameterInitializer methods - - public string StringValue - { - get - { - object value = _parameter.get_Value(); - return (string)value; - } - set - { - _parameter.set_Value(value); - } - } - - public int IntegerValue - { - get - { - object value = _parameter.get_Value(); - return (int)value; - } - set - { - _parameter.set_Value(value); - } - } - #endregion - - #region IPrintSchemaElement methods - - public string Name { get { return _parameter.Name; } } - public string XmlNamespace { get { return _parameter.NamespaceUri; } } - - #endregion - - #region Implementation details - - internal PrintSchemaParameterInitializer(PrinterExtensionLib.IPrintSchemaParameterInitializer parameter) - { - _parameter = parameter; - } - - PrinterExtensionLib.IPrintSchemaParameterInitializer _parameter; - - #endregion - } -#endif - - internal sealed class PrintSchemaCapabilities : IPrintSchemaCapabilities - { - #region IPrintSchemaCapabilities methods - - public IPrintSchemaFeature GetFeatureByKeyName(string keyName) - { - PrinterExtensionLib.IPrintSchemaFeature feature = _capabilities.GetFeatureByKeyName(keyName); - if (feature != null) - { - return new PrintSchemaFeature(feature); - } - - return null; - } - - public IPrintSchemaFeature GetFeature(string featureName) - { - return GetFeature(featureName, PrintSchemaConstants.KeywordsNamespaceUri); - } - - public IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace) - { - PrinterExtensionLib.IPrintSchemaFeature feature = _capabilities.GetFeature(featureName, xmlNamespace); - if (feature != null) - { - return new PrintSchemaFeature(feature); - } - - return null; - } - - public IPrintSchemaPageImageableSize PageImageableSize - { - get { return new PrintSchemaPageImageableSize(_capabilities.PageImageableSize); } - } - - public uint JobCopiesAllDocumentsMaxValue - { - get - { - uint value = _capabilities.JobCopiesAllDocumentsMaxValue; - if (value == 0) - { - throw new NotSupportedException("Property \"JobCopiesAllDocumentsMaxValue\" not found in print capabilities."); - } - - return value; - } - } - - public uint JobCopiesAllDocumentsMinValue - { - get - { - uint value = _capabilities.JobCopiesAllDocumentsMinValue; - if (value == 0) - { - throw new NotSupportedException("Property \"JobCopiesAllDocumentsMinValue\" not found in print capabilities."); - } - - return value; - } - } - - public IPrintSchemaOption GetSelectedOptionInPrintTicket(IPrintSchemaFeature feature) - { - PrintSchemaFeature f = feature as PrintSchemaFeature; - PrinterExtensionLib.IPrintSchemaOption option = _capabilities.GetSelectedOptionInPrintTicket(f.InteropFeature); - - if (option != null) - { - return PrintSchemaOption.CreateOptionSubclass(option); - } - - return null; - } - - public IEnumerable<IPrintSchemaOption> GetOptions(IPrintSchemaFeature pFeature) - { - return new PrintSchemaOptionsCollection( - _capabilities.GetOptions( - (pFeature as PrintSchemaFeature).InteropFeature) - ); - } - - public Stream GetReadStream() - { - return new ComIStreamAdapter(XmlStream, - false, // canWrite - true, // canSeek - true // canRead - ); - } - - public Stream GetWriteStream() - { - return new ComIStreamAdapter(XmlStream, - true, // canWrite - true, // canSeek - false // canRead - ); - } - -#if WINDOWS_81_APIS - public IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName) - { - return GetParameterDefinition(parameterName, PrintSchemaConstants.KeywordsNamespaceUri); - } - - public IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName, string xmlNamespace) - { - PrinterExtensionLib.IPrintSchemaParameterDefinition parameter = _capabilities2.GetParameterDefinition(parameterName, xmlNamespace); - if (parameter != null) - { - return new PrintSchemaParameterDefinition(parameter); - } - - return null; - } -#endif - - private System.Runtime.InteropServices.ComTypes.IStream XmlStream - { - get - { - System.Runtime.InteropServices.ComTypes.IStream istream = _capabilities.XmlNode as System.Runtime.InteropServices.ComTypes.IStream; - - return istream; - } - } - - #endregion - - #region Implementation details - - internal PrintSchemaCapabilities(PrinterExtensionLib.IPrintSchemaCapabilities caps) - { - _capabilities = caps; -#if WINDOWS_81_APIS - _capabilities2 = (PrinterExtensionLib.IPrintSchemaCapabilities2)caps; -#endif - } - - private PrinterExtensionLib.IPrintSchemaCapabilities _capabilities; -#if WINDOWS_81_APIS - private PrinterExtensionLib.IPrintSchemaCapabilities2 _capabilities2; -#endif - #endregion - } - - internal class PrintSchemaAsyncOperation : IPrintSchemaAsyncOperation - { - #region IPrintSchemaAsyncOperation methods - - public void Cancel() - { - _asyncOperation.Cancel(); - } - - public void Start() - { - _asyncOperation.Start(); - } - - public event EventHandler<PrintSchemaAsyncOperationEventArgs> Completed; - - #endregion - - #region Implementation details - - internal PrintSchemaAsyncOperation(PrinterExtensionLib.PrintSchemaAsyncOperation asyncOperation) - { - _asyncOperation = asyncOperation; - _asyncOperation.Completed += _asyncOperation_Completed; - } - - void _asyncOperation_Completed(PrinterExtensionLib.IPrintSchemaTicket printTicket, int hrOperation) - { - if (Completed != null) - { - IPrintSchemaTicket ticket = new PrintSchemaTicket(printTicket); - Completed(this, new PrintSchemaAsyncOperationEventArgs(ticket, hrOperation)); - } - - // This subscriber object (current object) holds a reference to the publishing object (i.e the underlying COM object) - // because it is a class member, and the publishing object holds a reference to the subscriber via the registered delegate. - // This implies neither object will be garbage collected until the application terminates. - // It's expected the event is fired once per instance so unsubscribing the delegate has no side effects. - _asyncOperation.Completed -= _asyncOperation_Completed; - Marshal.ReleaseComObject(_asyncOperation); - _asyncOperation = null; - } - - private PrinterExtensionLib.PrintSchemaAsyncOperation _asyncOperation; - - #endregion - } - - internal class PrintSchemaTicket : IPrintSchemaTicket - { - - #region IPrintSchemaTicket methods - - public IPrintSchemaCapabilities GetCapabilities() - { - return new PrintSchemaCapabilities(_printTicket.GetCapabilities()); - } - - public IPrintSchemaFeature GetFeature(string featureName) - { - return GetFeature(featureName, PrintSchemaConstants.KeywordsNamespaceUri); - } - - public IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace) - { - PrinterExtensionLib.IPrintSchemaFeature feature = _printTicket.GetFeature(featureName, xmlNamespace); - if (feature != null) - { - return new PrintSchemaFeature(feature); - } - - return null; - } - - public IPrintSchemaFeature GetFeatureByKeyName(string keyName) - { - PrinterExtensionLib.IPrintSchemaFeature feature = _printTicket.GetFeatureByKeyName(keyName); - if (feature != null) - { - return new PrintSchemaFeature(feature); - } - - return null; - } - - public uint JobCopiesAllDocuments - { - get - { - uint value = _printTicket.JobCopiesAllDocuments; - if (value == 0) - { - throw new NotSupportedException("Property \"JobCopiesAllDocuments\" not found in print ticket."); - } - - return value; - } - set - { - _printTicket.JobCopiesAllDocuments = value; - } - } - - public Stream GetReadStream() - { - return new ComIStreamAdapter(XmlStream, - false, // canWrite - true, // canSeek - true // canRead - ); - } - - public Stream GetWriteStream() - { - return new ComIStreamAdapter(XmlStream, - true, // canWrite - true, // canSeek - false // canRead - ); - } - - private System.Runtime.InteropServices.ComTypes.IStream XmlStream - { - get - { - System.Runtime.InteropServices.ComTypes.IStream istream = _printTicket.XmlNode as System.Runtime.InteropServices.ComTypes.IStream; - - return istream; - } - } - - public IPrintSchemaAsyncOperation ValidateAsync() - { - PrinterExtensionLib.PrintSchemaAsyncOperation interopAsyncOperation; - _printTicket.ValidateAsync(out interopAsyncOperation); - return new PrintSchemaAsyncOperation(interopAsyncOperation); - } - - public IPrintSchemaAsyncOperation CommitAsync(IPrintSchemaTicket printTicketCommit) - { - PrinterExtensionLib.IPrintSchemaTicket interopTicket = (printTicketCommit as PrintSchemaTicket)._printTicket; - PrinterExtensionLib.PrintSchemaAsyncOperation interopAsyncOperation; - _printTicket.CommitAsync(interopTicket, out interopAsyncOperation); - return new PrintSchemaAsyncOperation(interopAsyncOperation); - } - - public void NotifyXmlChanged() - { - _printTicket.NotifyXmlChanged(); - } -#if WINDOWS_81_APIS - public IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName) - { - return GetParameterInitializer(parameterName, PrintSchemaConstants.KeywordsNamespaceUri); - } - - public IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName, string xmlNamespace) - { - PrinterExtensionLib.IPrintSchemaParameterInitializer parameter = _printTicket2.GetParameterInitializer(parameterName, xmlNamespace); - if (parameter != null) - { - return new PrintSchemaParameterInitializer(parameter); - } - - return null; - } -#endif - - #endregion - - #region Implementation details - - internal PrintSchemaTicket(PrinterExtensionLib.IPrintSchemaTicket printTicket) - { - _printTicket = printTicket; -#if WINDOWS_81_APIS - _printTicket2 = (PrinterExtensionLib.IPrintSchemaTicket2)printTicket; -#endif - } - - private PrinterExtensionLib.IPrintSchemaTicket _printTicket; -#if WINDOWS_81_APIS - private PrinterExtensionLib.IPrintSchemaTicket2 _printTicket2; -#endif - - #endregion - } - - internal enum PrintPropertyBagType - { - QueueProperties, - DriverProperties, - UserProperties - } - - internal class PrinterPropertyBag : IPrinterPropertyBag - { - #region IPrinterPropertyBag methods - - public bool GetBool(string propertyName) - { - try - { - int integerEquivalent = _bag.GetBool(propertyName); - bool boolEquivalent = true; - if (integerEquivalent == 0) - { - boolEquivalent = false; - } - return boolEquivalent; - } - catch (ArgumentException e) - { - // Fix the type of exception thrown when the property does not exist. - if (ShouldConvertExceptionType(e)) - { - throw new FileNotFoundException("", e); - } - throw; - } - } - - public byte[] GetBytes(string propertyName) - { - try - { - uint count = 0; - IntPtr intptrData = Marshal.AllocCoTaskMem(IntPtr.Size); - _bag.GetBytes( - propertyName, - out count, - intptrData); - - byte[] data = new byte[count]; - Marshal.Copy(Marshal.ReadIntPtr(intptrData), data, 0, (int)count); - Marshal.FreeCoTaskMem(Marshal.ReadIntPtr(intptrData)); - Marshal.FreeCoTaskMem(intptrData); - return data; - } - catch (ArgumentException e) - { - // Fix the type of exception thrown when the property does not exist. - if (ShouldConvertExceptionType(e)) - { - throw new FileNotFoundException("", e); - } - throw; - } - } - - public int GetInt(string propertyName) - { - try - { - return _bag.GetInt32(propertyName); - } - catch (ArgumentException e) - { - // Fix the type of exception thrown when the property does not exist. - if (ShouldConvertExceptionType(e)) - { - throw new FileNotFoundException("", e); - } - throw; - } - } - - public string GetString(string propertyName) - { - try - { - return _bag.GetString(propertyName); - } - catch (ArgumentException e) - { - // Fix the type of exception thrown when the property does not exist. - if (ShouldConvertExceptionType(e)) - { - throw new FileNotFoundException("", e); - } - throw; - } - } - - public void SetBool(string propertyName, bool value) - { - int integerEquivalent = 1; - if (value == false) - { - integerEquivalent = 0; - } - - _bag.SetBool(propertyName, integerEquivalent); - } - - public void SetBytes(string propertyName, byte[] data) - { - // Pin the byte array so that it will not be moved by the garbage collector - // This would not be required if the COM Interop function took in a byte[] parameter - // as opposed to a byte parameter - GCHandle gcHandle = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - _bag.SetBytes(propertyName, Convert.ToUInt32(data.Length), ref data[0]); - } - finally - { - gcHandle.Free(); - } - } - - public void SetInt(string propertyName, int value) - { - _bag.SetInt32(propertyName, value); - } - - public void SetString(string propertyName, string value) - { - _bag.SetString(propertyName, value); - } - - public Stream GetReadStream(string propertyName) - { - try - { - return new PrinterExtensionLibIStreamAdapter(_bag.GetReadStream(propertyName), false, true, true); - } - catch (COMException e) - { - // Fix the type of exception thrown when the property does not exist. - if (ShouldConvertExceptionType(e)) - { - throw new FileNotFoundException("", e); - } - throw; - } - } - - public Stream GetWriteStream(string propertyName) - { - return new PrinterExtensionLibIStreamAdapter(_bag.GetWriteStream(propertyName), true, true, false); - } - - #endregion - - #region Indexer - - public PrinterProperty this[string name] - { - get { return new PrinterProperty(this, name); } - } - - #endregion - - #region Implementation details - - internal PrinterPropertyBag(PrinterExtensionLib.IPrinterPropertyBag bag, PrintPropertyBagType type) - { - _bag = bag; - _type = type; - } - - /// <summary> - /// Check if exception thrown when a property is not found in a property bag needs to be converted. - /// </summary> - /// <param name="e"></param> - /// <returns>True if the exception type needs to be converted.</returns> - private bool ShouldConvertExceptionType(Exception e) - { - // Only the driver property bag throws exceptions other than 'FileNotFoundException' - // when a property is not found. - if (_type != PrintPropertyBagType.DriverProperties) - { - return false; - } - else if (e is ArgumentException) - { - return true; - } - else if (e is COMException) - { - // Since there is no portable way to check the HRESULT across classic .Net and - // .Net for Windows Store apps, all COMExceptions encountered are converted. - return true; - } - return false; - } - - private PrinterExtensionLib.IPrinterPropertyBag _bag; - private PrintPropertyBagType _type; - - #endregion - } - -#if WINDOWS_81_APIS - public sealed class PrintJob : IPrintJob - { - #region IPrintJob methods - - public string Name - { - get { return _job.Name; } - } - - public ulong Id - { - get { return _job.Id; } - } - - public ulong PrintedPages - { - get { return _job.PrintedPages; } - } - - public ulong TotalPages - { - get { return _job.TotalPages; } - } - - public PrintJobStatus Status - { - get { return (PrintJobStatus)_job.Status; } - } - - public DateTime SubmissionTime - { - get { return _job.SubmissionTime; } - } - - public void RequestCancel() - { - _job.RequestCancel(); - } - - #endregion - - #region Implementation details - - internal PrintJob(PrinterExtensionLib.IPrintJob job) - { - _job = job; - } - - PrinterExtensionLib.IPrintJob _job; - - #endregion - } - - /// <summary> - /// This class provides wraps IPrintJobCollection in a IEnumerable interface - /// </summary> - public sealed class PrintJobCollection : IEnumerable<IPrintJob> - { - #region IEnumerable<IPrintJob> methods - - public IEnumerator<IPrintJob> GetEnumerator() - { - for (uint i = 0; i < _jobCollection.Count; i++) - { - yield return new PrintJob(_jobCollection.GetAt(i)); - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return (IEnumerator)GetEnumerator(); - } - - #endregion - - #region Implementation details - - internal PrintJobCollection(PrinterExtensionLib.IPrintJobCollection jobCollection) - { - _jobCollection = jobCollection; - } - - private PrinterExtensionLib.IPrintJobCollection _jobCollection; - - #endregion - } - - internal sealed class PrinterQueueView : IPrinterQueueView - { - #region IPrinterQueueView methods - - public void SetViewRange(uint viewOffset, uint viewSize) - { - _view.SetViewRange(viewOffset, viewSize); - } - - public event EventHandler<PrinterQueueViewEventArgs> OnChanged - { - add - { - if (_onChanged == null) - { - _view.OnChanged += _view_OnChanged; - } - _onChanged += value; - } - remove - { - _onChanged -= value; - if (_onChanged == null) - { - _view.OnChanged -= _view_OnChanged; - } - } - } - - #endregion - - #region Implementation details - - internal PrinterQueueView(PrinterExtensionLib.PrinterQueueView view) - { - _view = view; - } - - void _view_OnChanged(PrinterExtensionLib.IPrintJobCollection pCollection, uint ulViewOffset, uint ulViewSize, uint ulCountJobsInPrintQueue) - { - if (_onChanged != null) - { - _onChanged(this, new PrinterQueueViewEventArgs(new PrintJobCollection(pCollection), ulViewOffset, ulViewSize, ulCountJobsInPrintQueue)); - } - } - - private PrinterExtensionLib.PrinterQueueView _view; - private event EventHandler<PrinterQueueViewEventArgs> _onChanged; - - #endregion - } - - internal sealed class PrinterBidiSetRequestCallback : PrinterExtensionLib.IPrinterBidiSetRequestCallback - { - #region IPrinterBidiSetRequestCallback methods - - public void Completed(string response, int statusHResult) - { - _callback.Completed(response, statusHResult); - } - - #endregion - - #region Implementation details - - internal PrinterBidiSetRequestCallback(IPrinterBidiSetRequestCallback callback) - { - _callback = callback; - } - - private IPrinterBidiSetRequestCallback _callback; - - #endregion - } -#endif - - internal sealed class PrinterQueue : IPrinterQueue - { - #region IPrinterQueue methods - - public string Name - { - get { return _queue.Name; } - } - - public void SendBidiQuery(string bidiQuery) - { - _queue.SendBidiQuery(bidiQuery); - } - - public IntPtr Handle - { - get { return _queue.Handle; } - } - - public IPrinterPropertyBag GetProperties() - { - return new PrinterPropertyBag(_queue.GetProperties(), PrintPropertyBagType.QueueProperties); - } - public event EventHandler<PrinterQueueEventArgs> OnBidiResponseReceived - { - add - { - if (_onBidiResponseReceived == null) - { - _queue.OnBidiResponseReceived += _queue_OnBidiResponseReceived; - } - _onBidiResponseReceived += value; - } - remove - { - _onBidiResponseReceived -= value; - if (_onBidiResponseReceived == null) - { - _queue.OnBidiResponseReceived -= _queue_OnBidiResponseReceived; - } - } - } - -#if WINDOWS_81_APIS - public IPrinterExtensionAsyncOperation SendBidiSetRequestAsync(string bidiRequest, IPrinterBidiSetRequestCallback callback) - { - PrinterBidiSetRequestCallback comCallback = new PrinterBidiSetRequestCallback(callback); - PrinterExtensionLib.IPrinterBidiSetRequestCallback comCallbackInterface = comCallback; - return new PrinterExtensionAsyncOperation(_queue2.SendBidiSetRequestAsync(bidiRequest, comCallbackInterface)); - } - - public IPrinterQueueView GetPrinterQueueView(uint viewOffset, uint viewSize) - { - return new PrinterQueueView(_queue2.GetPrinterQueueView(viewOffset, viewSize)); - } -#endif - - #endregion - - #region Implementation details - - internal PrinterQueue(PrinterExtensionLib.PrinterQueue queue) - { - _queue = queue; -#if WINDOWS_81_APIS - _queue2 = (PrinterExtensionLib.IPrinterQueue2)queue; -#endif - } - - private void _queue_OnBidiResponseReceived(string bstrResponse, int hrStatus) - { - if (_onBidiResponseReceived != null) - { - _onBidiResponseReceived(this, new PrinterQueueEventArgs(bstrResponse, hrStatus)); - } - } - - private event EventHandler<PrinterQueueEventArgs> _onBidiResponseReceived; -#if WINDOWS_81_APIS - private PrinterExtensionLib.IPrinterQueue2 _queue2; -#endif - private PrinterExtensionLib.PrinterQueue _queue; - - #endregion - } - - internal sealed class PrinterExtensionRequest : IPrinterExtensionRequest - { - #region IPrinterExtensionRequest methods - - public void Complete() - { - _request.Complete(); - } - - public void Cancel(int hr, string logMessage) - { - _request.Cancel(hr, logMessage); - } - - #endregion - - #region Implementation details - - internal PrinterExtensionRequest(PrinterExtensionLib.IPrinterExtensionRequest request) - { - _request = request; - } - - private PrinterExtensionLib.IPrinterExtensionRequest _request; - - #endregion - } - - #endregion -} - diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj deleted file mode 100644 index 3c24e74b..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionLibrary.csproj +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{D8DA0C4D-F972-4546-9068-8EB256F222F7}</ProjectGuid> - <DefaultLanguage>en-US</DefaultLanguage> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>Microsoft.Samples.Printing.PrinterExtension</RootNamespace> - <AssemblyName>Microsoft.Samples.Printing.PrinterExtensionLibrary</AssemblyName> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <!-- Silence warnings generated from all COM references. --> - <ResolveComReferenceSilent>true</ResolveComReferenceSilent> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Win8 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8 Release|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Win8 Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Win8.1 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;WINDOWS_81_APIS</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win8.1 Release|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Win8.1 Release\</OutputPath> - <DefineConstants>TRACE;WINDOWS_81_APIS</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win10 Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Win10 Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;WINDOWS_81_APIS</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Win10 Release|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Win10 Release\</OutputPath> - <DefineConstants>TRACE;WINDOWS_81_APIS</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <!-- A reference to the entire .Net Framework and Windows SDK are automatically included --> - </ItemGroup> - <ItemGroup> - <Compile Include="PrinterExtensionAdapters.cs" /> - <Compile Include="PrinterExtensionTypes.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="PrinterExtensionManager.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <COMReference Include="PrinterExtensionLib"> - <Guid>{91CE54EE-C67C-4B46-A4FF-99416F27A8BF}</Guid> - <VersionMajor>1</VersionMajor> - <VersionMinor>0</VersionMinor> - <Lcid>0</Lcid> - <WrapperTool>tlbimp</WrapperTool> - <Isolated>False</Isolated> - <EmbedInteropTypes>True</EmbedInteropTypes> - </COMReference> - </ItemGroup> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs deleted file mode 100644 index 91815d6a..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionManager.cs +++ /dev/null @@ -1,121 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file contains an Adapter that wrap the PrinterExtensionManager COM Interop type. -// -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; -using System.Runtime; -using System.Runtime.InteropServices; -using Microsoft.Samples.Printing.PrinterExtension.Types; - -namespace Microsoft.Samples.Printing.PrinterExtension -{ - public class PrinterExtensionManager - { - public PrinterExtensionManager() - { - _manager = new PrinterExtensionLib.PrinterExtensionManager(); - } - - #region IPrinterExtensionManager methods - - /// <summary> - /// Maps to COM IPrinterExtensionManager::DisableEvents - /// </summary> - public void DisableEvents() - { - _manager.DisableEvents(); - } - - /// <summary> - /// Maps to COM IPrinterExtensionManager::EnableEvents - /// </summary> - public void EnableEvents(Guid printerDriverId) - { - _manager.EnableEvents(printerDriverId); - } - - /// <summary> - /// Maps to COM IPrinterExtensionEvent::OnDriverEvent - /// </summary> - public event EventHandler<PrinterExtensionEventArgs> OnDriverEvent - { - add - { - if (_onDriverEvent == null) - { - _manager.OnDriverEvent += OnDriverEventReceiver; - } - _onDriverEvent += value; - } - remove - { - _onDriverEvent -= value; - if (_onDriverEvent == null) - { - _manager.OnDriverEvent -= OnDriverEventReceiver; - } - } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEvent::OnPrinterQueuesEnumerated - /// </summary> - public event EventHandler<PrinterQueuesEnumeratedEventArgs> OnPrinterQueuesEnumerated - { - add - { - if (_onPrinterQueuesEnumerated == null) - { - _manager.OnPrinterQueuesEnumerated += OnPrinterQueuesEnumeratedReceiver; - } - _onPrinterQueuesEnumerated += value; - } - remove - { - _onPrinterQueuesEnumerated -= value; - if (_onPrinterQueuesEnumerated == null) - { - _manager.OnPrinterQueuesEnumerated -= OnPrinterQueuesEnumeratedReceiver; - } - } - } - - #endregion - - #region Implementation details - - private void OnDriverEventReceiver(PrinterExtensionLib.IPrinterExtensionEventArgs pEventArgs) - { - if (_onDriverEvent != null) - { - _onDriverEvent(this, new PrinterExtensionEventArgs(pEventArgs)); - } - } - - private void OnPrinterQueuesEnumeratedReceiver(PrinterExtensionLib.IPrinterExtensionContextCollection contextCollection) - { - if (_onPrinterQueuesEnumerated != null) - { - _onPrinterQueuesEnumerated(this, new PrinterQueuesEnumeratedEventArgs(contextCollection)); - } - } - - private event EventHandler<PrinterExtensionEventArgs> _onDriverEvent; - private event EventHandler<PrinterQueuesEnumeratedEventArgs> _onPrinterQueuesEnumerated; - - private PrinterExtensionLib.PrinterExtensionManager _manager; - - #endregion - } -}
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs deleted file mode 100644 index 33991cde..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/PrinterExtensionTypes.cs +++ /dev/null @@ -1,921 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// -// Abstract: -// -// This file defines all types and interfaces that may be used to build a printer -// extension application. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; - -namespace Microsoft.Samples.Printing.PrinterExtension.Types -{ - // - // Enums and Constants - // - /// <summary> - /// Maps to COM PrintSchemaConstrainedSetting - /// </summary> - public enum PrintSchemaConstrainedSetting - { - None = 0, - PrintTicket = 1, - Admin = 2, - Device = 3, - } - - /// <summary> - /// Maps to COM PrintSchemaSelectionType - /// </summary> - public enum PrintSchemaSelectionType - { - PickOne = 0, - PickMany = 1 - } - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM PrintSchemaParameterDataType - /// </summary> - public enum PrintSchemaParameterDataType - { - Integer = 0, - NumericString = 1, - String = 2 - } - - /// <summary> - /// Maps to COM PrintJobStatus - /// </summary> - [Flags] - public enum PrintJobStatus - { - Paused = 0x1, - Error = 0x2, - Deleting = 0x4, - Spooling = 0x8, - Printing = 0x10, - Offline = 0x20, - PaperOut = 0x40, - Printed = 0x80, - Deleted = 0x100, - BlockedDeviceQueue = 0x200, - UserIntervention = 0x400, - Restarted = 0x800, - Complete = 0x1000, - Retained = 0x2000, - } -#endif - - public static class PrinterExtensionReason - { - // An Enum was the first choice but the list of Guid is designed to be extendable. - // A read-only property was the second choice however this would have made new copies of the Guid. - // Using a class with static Guids balances both considerations. - - /// <summary> - /// In this mode preferences for a print job or default print preferences is expected to be displayed. - /// Maps to C++ PRINTER_EXTENSION_REASON_PRINT_PREFERENCES - /// </summary> - public static Guid PrintPreferences = new Guid("{EC8F261F-267C-469F-B5D6-3933023C29CC}"); - - - /// <summary> - /// In this mode a status monitor for the print queue is expected to be displayed. - /// Maps to C++ PRINTER_EXTENSION_REASON_DRIVER_EVENT - /// </summary> - public static Guid DriverEvent = new Guid("{23BB1328-63DE-4293-915B-A6A23D929ACB}"); - } - - public static class PrintSchemaConstants - { - /// <summary> - /// The namespace URI for the Print Schema keywords - /// </summary> - public const string KeywordsNamespaceUri = "http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"; - /// <summary> - /// The namespace URI for the Print Schema keywords V1.1 - /// </summary> - public const string KeywordsV11NamespaceUri = "http://schemas.microsoft.com/windows/2013/05/printing/printschemakeywordsv11"; - /// <summary> - /// The namespace URI for the Print Schema Framework - /// </summary> - public const string FrameworkNamespaceUri = "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"; - } - - // - // Interfaces - // - - // The following interfaces are shared between the "Reference" and "Implementation" - // project. These interfaces are the public surface for the adapters that will remain - // internal to the "Implementation" project. It is done this way because the public - // surface and strong name must be the same for "Reference" and "Implementation". - - /// <summary> - /// Maps to COM IPrinterExtensionContext - /// </summary> - public interface IPrinterExtensionContext - { - /// <summary> - /// Maps to COM IPrinterExtensionContext::PrinterQueue - /// </summary> - IPrinterQueue Queue { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::PrintSchemaTicket - /// </summary> - IPrintSchemaTicket Ticket { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::DriverProperties - /// </summary> - IPrinterPropertyBag DriverProperties { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionContext::UserProperties - /// </summary> - IPrinterPropertyBag UserProperties { get; } - } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs - /// </summary> - public interface IPrinterExtensionEventArgs : IPrinterExtensionContext - { - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::BidiNotification - /// </summary> - string BidiNotification { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::ReasonId - /// </summary> - Guid ReasonId { get; } - - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::Request - /// </summary> - IPrinterExtensionRequest Request { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::SourceApplication - /// </summary> - string SourceApplication { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::DetailedReasonId - /// </summary> - Guid DetailedReasonId { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::WindowModal - /// </summary> - bool WindowModal { get; } - - /// <summary> - /// Maps to COM IPrinterExtensionEventArgs::WindowParent - /// </summary> - IntPtr WindowParent { get; } - } - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM IPrinterExtensionAsyncOperation - /// </summary> - public interface IPrinterExtensionAsyncOperation - { - /// <summary> - /// Maps to COM IPrinterExtensionAsyncOperation::Cancel - /// </summary> - void Cancel(); - } -#endif - - /// <summary> - /// Maps to COM IPrintSchemaElement - /// </summary> - public interface IPrintSchemaElement - { - /// <summary> - /// Maps to COM IPrintSchemaElement::Name - /// </summary> - string Name { get; } - - /// <summary> - /// Maps to COM IPrintSchemaElement::NamespaceUri - /// </summary> - string XmlNamespace { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaDisplayableElement - /// </summary> - public interface IPrintSchemaDisplayableElement : IPrintSchemaElement - { - /// <summary> - /// Maps to COM IPrintSchemaDisplayableElement::DisplayName - /// </summary> - string DisplayName { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaOption - /// </summary> - public interface IPrintSchemaOption : IPrintSchemaDisplayableElement - { - /// <summary> - /// Maps to COM IPrintSchemaOption::Selected - /// </summary> - bool Selected { get; } - - /// <summary> - /// Maps to COM IPrintSchemaOption::Constrained - /// </summary> - PrintSchemaConstrainedSetting Constrained { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaPageMediaSizeOption - /// </summary> - public interface IPrintSchemaPageMediaSizeOption : IPrintSchemaOption - { - /// <summary> - /// Maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons - /// </summary> - uint HeightInMicrons { get; } - - /// <summary> - /// Maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons - /// </summary> - uint WidthInMicrons { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaNUpOption - /// </summary> - public interface IPrintSchemaNUpOption : IPrintSchemaOption - { - /// <summary> - /// Maps to COM IPrintSchemaNUpOption::PagesPerSheet - /// </summary> - uint PagesPerSheet { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaFeature - /// </summary> - public interface IPrintSchemaFeature : IPrintSchemaDisplayableElement - { - /// <summary> - /// Maps to COM IPrintSchemaFeature::SelectedOption - /// </summary> - IPrintSchemaOption SelectedOption { get; set; } - - /// <summary> - /// Maps to COM IPrintSchemaFeature::SelectionType - /// </summary> - PrintSchemaSelectionType SelectionType { get; } - - /// <summary> - /// Maps to COM IPrintSchemaFeature::GetOption - /// </summary> - IPrintSchemaOption GetOption(string optionName); - - /// <summary> - /// Maps to COM IPrintSchemaFeature::GetOption - /// </summary> - IPrintSchemaOption GetOption(string optionName, string xmlNamespace); - - /// <summary> - /// Maps to COM IPrintSchemaFeature::DisplayUI - /// </summary> - bool DisplayUI { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize - /// </summary> - public interface IPrintSchemaPageImageableSize : IPrintSchemaElement - { - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons - /// </summary> - uint ExtentHeightInMicrons { get; } - - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons - /// </summary> - uint ExtentWidthInMicrons { get; } - - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons - /// </summary> - uint ImageableSizeHeightInMicrons { get; } - - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons - /// </summary> - uint ImageableSizeWidthInMicrons { get; } - - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons - /// </summary> - uint OriginHeightInMicrons { get; } - - /// <summary> - /// Maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons - /// </summary> - uint OriginWidthInMicrons { get; } - } - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM IPrintSchemaParameterDefinition - /// </summary> - public interface IPrintSchemaParameterDefinition : IPrintSchemaDisplayableElement - { - /// <summary> - /// Maps to COM IPrintSchemaParameterDefinition::UserInputRequired - /// </summary> - bool UserInputRequired { get; } - - /// <summary> - /// Maps to COM IPrintSchemaParameterDefinition::UnitType - /// </summary> - string UnitType { get; } - - /// <summary> - /// Maps to COM IPrintSchemaParameterDefinition::DataType - /// </summary> - PrintSchemaParameterDataType DataType { get; } - - /// <summary> - /// Maps to COM IPrintSchemaParameterDefinition::RangeMin - /// </summary> - int RangeMin { get; } - - /// <summary> - /// Maps to COM IPrintSchemaParameterDefinition::RangeMax - /// </summary> - int RangeMax { get; } - } - - /// <summary> - /// Maps to COM IPrintSchemaParameterInitializer - /// </summary> - public interface IPrintSchemaParameterInitializer : IPrintSchemaElement - { - /// <summary> - /// Maps to COM IPrintSchemaParameterInitializer::Value - /// </summary> - string StringValue { get; set; } - /// <summary> - /// Maps to COM IPrintSchemaParameterInitializer::Value - /// </summary> - int IntegerValue { get; set; } - } -#endif - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities - /// </summary> - public interface IPrintSchemaCapabilities - { - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName - /// </summary> - IPrintSchemaFeature GetFeatureByKeyName(string keyName); - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::GetFeature - /// </summary> - IPrintSchemaFeature GetFeature(string featureName); - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::GetFeature - /// </summary> - IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace); - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::PageImageableSize - /// </summary> - IPrintSchemaPageImageableSize PageImageableSize { get; } - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue - /// </summary> - uint JobCopiesAllDocumentsMaxValue { get; } - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue - /// </summary> - uint JobCopiesAllDocumentsMinValue { get; } - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket - /// </summary> - IPrintSchemaOption GetSelectedOptionInPrintTicket(IPrintSchemaFeature feature); - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities::GetOptions - /// </summary> - IEnumerable<IPrintSchemaOption> GetOptions(IPrintSchemaFeature feature); - - /// <summary> - /// Replaces COM IPrintSchemaCapabilities::XmlNode - /// </summary> - Stream GetReadStream(); - - /// <summary> - /// Replaces COM IPrintSchemaCapabilities::XmlNode - /// </summary> - Stream GetWriteStream(); - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM IPrintSchemaCapabilities2::GetParameterDefinition - /// </summary> - IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName); - - /// <summary> - /// Maps to COM IPrintSchemaCapabilities2::GetParameterDefinition - /// </summary> - IPrintSchemaParameterDefinition GetParameterDefinition(string parameterName, string xmlNamespace); -#endif - } - - /// <summary> - /// The EventArgs for the PrintSchemaAsyncOperation - /// Maps to COM IPrintSchemaAsyncOperationEvent - /// </summary> - public class PrintSchemaAsyncOperationEventArgs : EventArgs - { - // - // Event arguments - // - /// <summary> - /// Maps to COM IPrintSchemaAsyncOperationEvent::Completed, parameter 'hrOperation' - /// </summary> - public int StatusHResult { get { return _statusHResult; } } - - /// <summary> - /// Maps to COM IPrintSchemaAsyncOperationEvent::Completed, parameter 'pTicket' - /// </summary> - public IPrintSchemaTicket Ticket { get { return _printTicket; } } - - // - // Implementation details - // - internal PrintSchemaAsyncOperationEventArgs(IPrintSchemaTicket printTicket, int statusHResult) - { - _statusHResult = statusHResult; - _printTicket = printTicket; - } - - private int _statusHResult; - private IPrintSchemaTicket _printTicket; - } - - /// <summary> - /// Maps to COM IPrintSchemaAsyncOperation - /// </summary> - public interface IPrintSchemaAsyncOperation - { - /// <summary> - /// Maps to COM IPrintSchemaAsyncOperationEvent::Completed - /// </summary> - event EventHandler<PrintSchemaAsyncOperationEventArgs> Completed; - - /// <summary> - /// Maps to COM IPrintSchemaAsyncOperation::Start - /// </summary> - void Start(); - - /// <summary> - /// Maps to COM IPrintSchemaAsyncOperation::Cancel - /// </summary> - void Cancel(); - } - - /// <summary> - /// Maps to COM IPrintSchemaTicket - /// </summary> - public interface IPrintSchemaTicket - { - /// <summary> - /// Maps to COM IPrintSchemaTicket::GetFeatureByKeyName - /// </summary> - IPrintSchemaFeature GetFeatureByKeyName(string featureName); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::GetFeature - /// </summary> - IPrintSchemaFeature GetFeature(string featureName); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::GetFeature - /// </summary> - IPrintSchemaFeature GetFeature(string featureName, string xmlNamespace); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::ValidateAsync - /// </summary> - IPrintSchemaAsyncOperation ValidateAsync(); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::CommitAsync - /// </summary> - IPrintSchemaAsyncOperation CommitAsync(IPrintSchemaTicket printTicketCommit); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::NotifyXmlChanged - /// </summary> - void NotifyXmlChanged(); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::GetCapabilities - /// </summary> - IPrintSchemaCapabilities GetCapabilities(); - - /// <summary> - /// Maps to COM IPrintSchemaTicket::JobCopiesAllDocuments - /// </summary> - uint JobCopiesAllDocuments { get; set; } - - /// <summary> - /// Replaces COM IPrintSchemaTicket::XmlNode - /// </summary> - Stream GetReadStream(); - - /// <summary> - /// Replaces COM IPrintSchemaTicket::XmlNode - /// </summary> - Stream GetWriteStream(); - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM IPrintSchemaTicket2::GetParameterInitializer - /// </summary> - IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName); - - /// <summary> - /// Maps to COM IPrintSchemaTicket2::GetParameterInitializer - /// </summary> - IPrintSchemaParameterInitializer GetParameterInitializer(string parameterName, string xmlNamespace); -#endif - } - - /// <summary> - /// Maps to COM IPrinterPropertyBag - /// </summary> - public interface IPrinterPropertyBag - { - /// <summary> - /// Maps to COM IPrinterPropertyBag::GetBool - /// </summary> - bool GetBool(string propertyName); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::SetBool - /// </summary> - void SetBool(string propertyName, bool value); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::GetInt32 - /// </summary> - int GetInt(string propertyName); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::SetInt32 - /// </summary> - void SetInt(string propertyName, int value); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::GetString - /// </summary> - string GetString(string propertyName); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::SetString - /// </summary> - void SetString(string propertyName, string value); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::GetBytes - /// </summary> - byte[] GetBytes(string propertyName); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::SetBytes - /// </summary> - void SetBytes(string propertyName, byte[] value); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::GetReadStream - /// </summary> - Stream GetReadStream(string propertyName); - - /// <summary> - /// Maps to COM IPrinterPropertyBag::GetWriteStream - /// </summary> - Stream GetWriteStream(string propertyName); - - /// <summary> - /// Indexer for the properties - /// </summary> - /// <param name="name">Property name</param> - /// <returns>An instance of 'PrinterProperty' used to get/set values</returns> - PrinterProperty this[string name] { get; } - } - - /// <summary> - /// Represents one property returned by the indexer in IPrinterPropertyBag - /// </summary> - public class PrinterProperty - { - internal PrinterProperty(IPrinterPropertyBag bag, string name) - { - _bag = bag; - _name = name; - } - - /// <summary> - /// Prevents default construction - /// </summary> - private PrinterProperty() - { - } - - /// <summary> - /// Get/Set a value of type 'bool' - /// </summary> - public bool Bool - { - get { return _bag.GetBool(_name); } - set { _bag.SetBool(_name, value); } - } - - /// <summary> - /// Get/Set a value of type 'Int32' - /// </summary> - public int Int - { - get { return _bag.GetInt(_name); } - set { _bag.SetInt(_name, value); } - } - - /// <summary> - /// Get/Set a value of type 'byte[]' - /// </summary> - public byte[] Bytes - { - get { return _bag.GetBytes(_name); } - set { _bag.SetBytes(_name, value); } - } - - /// <summary> - /// Get/Set a value of type 'string' - /// </summary> - public string String - { - get { return _bag.GetString(_name); } - set { _bag.SetString(_name, value); } - } - - /// <summary> - /// Get a read/write Stream corresponding to this property name - /// </summary> - public Stream WriteStream - { - get { return _bag.GetWriteStream(_name); } - } - - /// <summary> - /// Get a read-only Stream corresponding to this property name - /// </summary> - public Stream ReadStream - { - get { return _bag.GetReadStream(_name); } - } - - // - // Implementation details - // - private IPrinterPropertyBag _bag; - private string _name; - } - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM IPrintJob - /// </summary> - public interface IPrintJob - { - /// <summary> - /// Maps to COM IPrintJob::Name - /// </summary> - string Name { get; } - - /// <summary> - /// Maps to COM IPrintJob::Id - /// </summary> - ulong Id { get; } - - /// <summary> - /// Maps to COM IPrintJob::PrintedPages - /// </summary> - ulong PrintedPages { get; } - - /// <summary> - /// Maps to COM IPrintJob::TotalPages - /// </summary> - ulong TotalPages { get; } - - /// <summary> - /// Maps to COM IPrintJob::Status - /// </summary> - PrintJobStatus Status { get; } - - /// <summary> - /// Maps to COM IPrintJob::SubmissionTime - /// </summary> - DateTime SubmissionTime { get; } - - /// <summary> - /// Maps to COM IPrintJob::RequestCancel - /// </summary> - void RequestCancel(); - } - - /// <summary> - /// Maps to COM IPrinterQueueViewEvent - /// </summary> - public class PrinterQueueViewEventArgs : EventArgs - { - /// <summary> - /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'pCollection' - /// </summary> - public IEnumerable<IPrintJob> Collection { get { return _collection; } } - - /// <summary> - /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'ulViewOffset' - /// </summary> - public uint ViewOffset { get { return _viewOffset; } } - - /// <summary> - /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'ulViewSize' - /// </summary> - public uint ViewSize { get { return _viewSize; } } - - /// <summary> - /// Maps to COM IPrinterQueueViewEvent::OnChanged, parameter 'ulCountJobsInPrintQueue' - /// </summary> - public uint CountJobsInPrintQueue { get { return _countJobsInPrintQueue; } } - - #region Implementation details - - internal PrinterQueueViewEventArgs(IEnumerable<IPrintJob> collection, uint viewOffset, uint viewSize, uint countJobsInPrintQueue) - { - _collection = collection; - _viewOffset = viewOffset; - _viewSize = viewSize; - _countJobsInPrintQueue = countJobsInPrintQueue; - } - - private IEnumerable<IPrintJob> _collection; - private uint _viewOffset; - private uint _viewSize; - private uint _countJobsInPrintQueue; - - #endregion - } - - /// <summary> - /// Maps to COM IPrinterQueueView - /// </summary> - public interface IPrinterQueueView - { - /// <summary> - /// Maps to COM IPrinterQueueView::SetViewRange - /// </summary> - void SetViewRange(uint viewOffset, uint viewSize); - - /// <summary> - /// Maps to COM IPrinterQueueViewEvent::OnChanged - /// </summary> - event EventHandler<PrinterQueueViewEventArgs> OnChanged; - } - - /// <summary> - /// Maps to COM IPrinterBidiSetRequestCallback - /// </summary> - public interface IPrinterBidiSetRequestCallback - { - /// <summary> - /// Maps to COM IPrinterBidiSetRequestCallback::Completed - /// </summary> - void Completed(string response, int statusHResult); - } -#endif - - /// <summary> - /// Maps to COM IPrinterQueueEvent - /// </summary> - public class PrinterQueueEventArgs : EventArgs - { - /// <summary> - /// Maps to COM IPrinterQueueEvent::OnBidiResponseReceived, parameter 'bstrResponse' - /// </summary> - public string Response { get { return _response; } } - - /// <summary> - /// Maps to COM IPrinterQueueEvent::OnBidiResponseReceived, parameter 'hrStatus' - /// </summary> - public int StatusHResult { get { return _statusHResult; } } - - // - // Implementation details - // - public PrinterQueueEventArgs(string response, int statusHResult) - { - _response = response; - _statusHResult = statusHResult; - } - - private int _statusHResult; - private string _response; - } - - /// <summary> - /// Maps to COM IPrinterQueue - /// </summary> - public interface IPrinterQueue - { - /// <summary> - /// Maps to COM IPrinterQueue::Handle - /// </summary> - IntPtr Handle { get; } - - /// <summary> - /// Maps to COM IPrinterQueue::Name - /// </summary> - string Name { get; } - - /// <summary> - /// Maps to COM IPrinterQueue::SendBidiQuery - /// </summary> - void SendBidiQuery(string bidiQuery); - - /// <summary> - /// Maps to COM IPrinterQueue::GetProperties - /// </summary> - IPrinterPropertyBag GetProperties(); - -#if WINDOWS_81_APIS - /// <summary> - /// Maps to COM IPrinterQueue2::SendBidiSetRequestAsync - /// </summary> - /// <param name="callback">Maps to COM callback type IPrinterBidiSetRequestCallback</param> - /// <returns>IPrinterExtensionAsyncOperation - async operation context</returns> - IPrinterExtensionAsyncOperation SendBidiSetRequestAsync(string bidiRequest, IPrinterBidiSetRequestCallback callback); - - /// <summary> - /// Maps to COM IPrinterQueue2::GetPrinterQueueView - /// </summary> - IPrinterQueueView GetPrinterQueueView(uint viewOffset, uint viewSize); -#endif - - /// <summary> - /// Maps to COM IPrinterQueueEvent::OnBidiResponseReceived - /// </summary> - event EventHandler<PrinterQueueEventArgs> OnBidiResponseReceived; - } - - /// <summary> - /// Maps to COM IPrinterExtensionRequest - /// </summary> - public interface IPrinterExtensionRequest - { - /// <summary> - /// Maps to COM IPrinterExtensionRequest::Complete - /// </summary> - void Complete(); - - /// <summary> - /// Maps to COM IPrinterExtensionRequest::Cancel - /// </summary> - void Cancel(int statusHResult, string logMessage); - } -} - diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs deleted file mode 100644 index 8b42d1af..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionLibrary/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Microsoft.Samples.Printing.PrinterExtensionLibrary")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft Corporation")] -[assembly: AssemblyProduct("Microsoft.Samples.Printing.PrinterExtensionLibrary")] -[assembly: AssemblyCopyright("Copyright (c) 2011 Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln b/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln deleted file mode 100644 index a326659a..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/PrinterExtensionSample.sln +++ /dev/null @@ -1,149 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2005 -MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionSample", "ExtensionSample", "{9344DE0C-3F42-4605-A320-733663E320B7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PrinterExtensionLibrary", "PrinterExtensionLibrary", "{721C5039-DB88-43E2-8369-D80B8E5A7643}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrinterExtensionSample", "ExtensionSample\PrinterExtensionSample.csproj", "{CF554A99-6889-4B86-934F-B6AADBFEFC01}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrinterExtensionLibrary", "PrinterExtensionLibrary\PrinterExtensionLibrary.csproj", "{D8DA0C4D-F972-4546-9068-8EB256F222F7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Win10 Debug|Any CPU = Win10 Debug|Any CPU - Win10 Debug|ARM64 = Win10 Debug|ARM64 - Win10 Debug|x64 = Win10 Debug|x64 - Win10 Debug|x86 = Win10 Debug|x86 - Win10 Release|Any CPU = Win10 Release|Any CPU - Win10 Release|ARM64 = Win10 Release|ARM64 - Win10 Release|x64 = Win10 Release|x64 - Win10 Release|x86 = Win10 Release|x86 - Win8 Debug|Any CPU = Win8 Debug|Any CPU - Win8 Debug|ARM64 = Win8 Debug|ARM64 - Win8 Debug|x64 = Win8 Debug|x64 - Win8 Debug|x86 = Win8 Debug|x86 - Win8 Release|Any CPU = Win8 Release|Any CPU - Win8 Release|ARM64 = Win8 Release|ARM64 - Win8 Release|x64 = Win8 Release|x64 - Win8 Release|x86 = Win8 Release|x86 - Win8.1 Debug|Any CPU = Win8.1 Debug|Any CPU - Win8.1 Debug|ARM64 = Win8.1 Debug|ARM64 - Win8.1 Debug|x64 = Win8.1 Debug|x64 - Win8.1 Debug|x86 = Win8.1 Debug|x86 - Win8.1 Release|Any CPU = Win8.1 Release|Any CPU - Win8.1 Release|ARM64 = Win8.1 Release|ARM64 - Win8.1 Release|x64 = Win8.1 Release|x64 - Win8.1 Release|x86 = Win8.1 Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|Any CPU.ActiveCfg = Win10 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|Any CPU.Build.0 = Win10 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|ARM64.Build.0 = Win10 Debug|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|x64.ActiveCfg = Win10 Debug|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|x64.Build.0 = Win10 Debug|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|x86.ActiveCfg = Win10 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Debug|x86.Build.0 = Win10 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|Any CPU.ActiveCfg = Win10 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|Any CPU.Build.0 = Win10 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|ARM64.ActiveCfg = Win10 Release|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|ARM64.Build.0 = Win10 Release|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|x64.ActiveCfg = Win10 Release|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|x64.Build.0 = Win10 Release|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|x86.ActiveCfg = Win10 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win10 Release|x86.Build.0 = Win10 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|Any CPU.ActiveCfg = Win8 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|Any CPU.Build.0 = Win8 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|ARM64.Build.0 = Win8 Debug|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x86.ActiveCfg = Win8 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Debug|x86.Build.0 = Win8 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|Any CPU.ActiveCfg = Win8 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|Any CPU.Build.0 = Win8 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|ARM64.ActiveCfg = Win8 Release|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|ARM64.Build.0 = Win8 Release|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x64.Build.0 = Win8 Release|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x86.ActiveCfg = Win8 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8 Release|x86.Build.0 = Win8 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|Any CPU.ActiveCfg = Win8.1 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|Any CPU.Build.0 = Win8.1 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|ARM64.Build.0 = Win8.1 Debug|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x86.ActiveCfg = Win8.1 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Debug|x86.Build.0 = Win8.1 Debug|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|Any CPU.ActiveCfg = Win8.1 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|Any CPU.Build.0 = Win8.1 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|ARM64.Build.0 = Win8.1 Release|ARM64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x86.ActiveCfg = Win8.1 Release|x86 - {CF554A99-6889-4B86-934F-B6AADBFEFC01}.Win8.1 Release|x86.Build.0 = Win8.1 Release|x86 - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|Any CPU.ActiveCfg = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|Any CPU.Build.0 = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|ARM64.ActiveCfg = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|ARM64.Build.0 = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|x64.ActiveCfg = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|x64.Build.0 = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|x86.ActiveCfg = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Debug|x86.Build.0 = Win10 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|Any CPU.ActiveCfg = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|Any CPU.Build.0 = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|ARM64.ActiveCfg = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|ARM64.Build.0 = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|x64.ActiveCfg = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|x64.Build.0 = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|x86.ActiveCfg = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win10 Release|x86.Build.0 = Win10 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|Any CPU.ActiveCfg = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|Any CPU.Build.0 = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|ARM64.ActiveCfg = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|ARM64.Build.0 = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x64.ActiveCfg = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x64.Build.0 = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x86.ActiveCfg = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Debug|x86.Build.0 = Win8 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|Any CPU.ActiveCfg = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|Any CPU.Build.0 = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|ARM64.ActiveCfg = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|ARM64.Build.0 = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x64.ActiveCfg = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x64.Build.0 = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x86.ActiveCfg = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8 Release|x86.Build.0 = Win8 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|Any CPU.ActiveCfg = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|Any CPU.Build.0 = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|ARM64.ActiveCfg = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|ARM64.Build.0 = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x86.ActiveCfg = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Debug|x86.Build.0 = Win8.1 Debug|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|Any CPU.ActiveCfg = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|Any CPU.Build.0 = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|ARM64.ActiveCfg = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|ARM64.Build.0 = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x64.Build.0 = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x86.ActiveCfg = Win8.1 Release|Any CPU - {D8DA0C4D-F972-4546-9068-8EB256F222F7}.Win8.1 Release|x86.Build.0 = Win8.1 Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {CF554A99-6889-4B86-934F-B6AADBFEFC01} = {9344DE0C-3F42-4605-A320-733663E320B7} - {D8DA0C4D-F972-4546-9068-8EB256F222F7} = {721C5039-DB88-43E2-8369-D80B8E5A7643} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5B431928-8836-4F52-A5C2-080A90BE06D3} - EndGlobalSection -EndGlobal diff --git a/print/v4PrintDriverSamples/PrinterExtensionSample/README.md b/print/v4PrintDriverSamples/PrinterExtensionSample/README.md deleted file mode 100644 index 043811a4..00000000 --- a/print/v4PrintDriverSamples/PrinterExtensionSample/README.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to use .NET to build a customized, desktop UI for a v4 print driver." -languages: -- csharp -products: -- windows -- windows-wdk ---- - -# Printer Extension Sample - -This sample demonstrates how to use .NET to build a customized, desktop UI for a v4 print driver. This .NET app uses PrintTicket, PrintCapabilities and Bidi in order to communicate with the print system and is suitable for inclusion in a v4 print driver. - -> [!NOTE] -> This sample is for the v4 print driver model. - -## Related topics - -[Building a Driver with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver) - -[v4 Printer Driver](https://docs.microsoft.com/windows-hardware/drivers/print/v4-printer-driver) diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js deleted file mode 100644 index 0605efff..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.js +++ /dev/null @@ -1,679 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// ConstraintScript.js -// -// Abstract: -// -// Sample Javascript constraints file for v4 printer drivers. - -// -// Declaration of various enums/constants that may be useful when modifying this sample. -// - -// Add a reference that provides intellisense -/// <reference path="v4PrintDriver-Intellisense.js" /> - -// -------------------------------------------------------------------------- -// Note: To disable intellisense for Windows 8.1 APIs, please delete the line below -/// <reference path="v4PrintDriver-Intellisense-Windows8.1.js" /> -// -------------------------------------------------------------------------- - -var psfPrefix = "psf"; -var pskNs = "http://schemas.microsoft.com/windows/2003/08/printing/printschemakeywords"; -var pskV11Ns = "http://schemas.microsoft.com/windows/2013/05/printing/printschemakeywordsv11"; -var psfNs = "http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework"; - -var PrintSchemaConstrainedSetting = { - PrintSchemaConstrainedSetting_None: 0, - PrintSchemaConstrainedSetting_PrintTicket: 1, - PrintSchemaConstrainedSetting_Admin: 2, - PrintSchemaConstrainedSetting_Device: 3 -}; - -var PrintSchemaParameterDataType = { - PrintSchemaParameterDataType_Integer: 0, - PrintSchemaParameterDataType_NumericString: 1, - PrintSchemaParameterDataType_String: 2 -}; - -var STREAM_SEEK = { - STREAM_SEEK_SET: 0, - STREAM_SEEK_CUR: 1, - STREAM_SEEK_END: 2 -}; - -var PrintSchemaSelectionType = { - PrintSchemaSelectionType_PickOne: 0, - PrintSchemaSelectionType_PickMany: 1 -}; - -function validatePrintTicket(printTicket, scriptContext) { - /// <summary> - /// Validates a print ticket. - /// - /// This example expresses the constraint that if 'ISOA4' PageMediaSize is selected, - /// the 'PhotographicGlossy' PageMediaType has to be selected. - /// Should another 'PageMediaType' option be selected, this method sets the selected option's name - /// to 'PhotographicGlossy' and indicates that the print ticket was modified to make it valid. - /// </summary> - /// <param name="printTicket" type="IPrintSchemaTicket"> - /// Print ticket to be validated. - /// </param> - /// <param name="scriptContext" type="IPrinterScriptContext"> - /// Script context object. - /// </param> - /// <returns type="Number" integer="true"> - /// Integer value indicating validation status. - /// 1 - Print ticket is valid and was not modified. - /// 2 - Print ticket was modified to make it valid. - /// 0 - Print ticket is invalid (not demonstrated by this example). - /// </returns> - - var retVal = 1; - - // Set the selection namespace on the printTicket's XmlNode. This instance allows us to query for - // nodes belonging to the 'pskNs' namespace. - setSelectionNamespace( - printTicket.XmlNode, - psfPrefix, - psfNs); - - // If the print ticket has an invalid combination of PageMediaSize and PageMediaType options, fix it, - // and return '2' to indicate the print ticket has been modified. - if (constraintSample.isMediaTypeConstrainedByMediaSize(printTicket)) { - var printTicketMediaTypeFeature = printTicket.GetFeature("PageMediaType"); - - var pskPrefix = getPrefixForNamespace( - printTicket.XmlNode, - pskNs); - - // Retrieve the only allowed 'PageMediaType' option, from the print capabilities. - // Note: Retrieving the print capabilities is a very expensive operation, and should be performed only if necessary. - var printCapabilities = printTicket.GetCapabilities(); - var printCapsMediaTypeFeature = printCapabilities.GetFeature("PageMediaType"); - var allowedPageMediaTypeOption = printCapsMediaTypeFeature.GetOption(constraintSample.allowedPageMediaType); - - // Replace the constrained print ticket option with the allowed one. - printTicketMediaTypeFeature.SelectedOption = allowedPageMediaTypeOption; - - retVal = 2; - } - - // Below demonstrates correct usage of IPrintSchemaTicket2 APIs so that the script does not terminate - // when running on a Windows 8 version of PrintConfig.dll. - if (printSchemaApiHelpers.supportsIPrintSchemaTicket2(printTicket)) { - var param = printTicket.GetParameterInitializer("JobCopiesAllDocuments"); - } - - return retVal; -} - - -function completePrintCapabilities(printTicket, scriptContext, printCapabilities) { - /// <summary> - /// This example demonstrates how drivers can alter the print capabilities' 'PageImageableSize' values - /// based on a 'PageBorderless' feature, or based on 'PageOrientation'. - /// - /// What this example does: - /// - /// 1. Retrieve the 'PageOrientation' feature from the print ticket. - /// 2. Retrieve the 'PageBorderless' feature from the print ticket. - /// 3. If 'Landscape' is the selected option for the 'PageOrientation' feature, - /// set custom 'PageImageableSize' margins in the print capabilities document. - /// 4. Else if 'PageBorderless' is the selected option for the 'PageBorderless' feature, - /// set custom 'PageImageableSize' margins in the print capabilities. - /// </summary> - /// <param name="printTicket" type="IPrintSchemaTicket" mayBeNull="true"> - /// If not 'null', the print ticket's settings are used to customize the print capabilities. - /// </param> - /// <param name="scriptContext" type="IPrinterScriptContext"> - /// Script context object. - /// </param> - /// <param name="printCapabilities" type="IPrintSchemaCapabilities"> - /// Print capabilities object to be customized. - /// </param> - - // This sample does not customize the default print capabilities (i.e. when no print ticket is passed in). - if (!printTicket) { - return; - } - - // Below demonstrates correct usage of IPrintSchemaCapabilities2 APIs so that the script does not terminate - // when running on a Windows 8 version of PrintConfig.dll. - if (printSchemaApiHelpers.supportsIPrintSchemaCapabilities2(printCapabilities)) { - var param = printCapabilities.GetParameterDefinition("JobCopiesAllDocuments"); - } - - setSelectionNamespace( - printTicket.XmlNode, - psfPrefix, - psfNs); - - setSelectionNamespace( - printCapabilities.XmlNode, - psfPrefix, - psfNs); - - var ticketPskPrefix = getPrefixForNamespace(printTicket.XmlNode, pskNs); - - // Check the if 'Borderless' is the selected option for the 'PageBorderless' - // Feature in the print ticket. - var isBorderlessPrinting = false; - var borderlessFeatureXmlNode = printTicket.GetFeature("PageBorderless"); - if (borderlessFeatureXmlNode) { - var borderlessOptionName = borderlessFeatureXmlNode.SelectedOption.Name; - if (borderlessOptionName === "Borderless") { - isBorderlessPrinting = true; - } - } - - // Similarly check if 'Landscape' is the selected option for the 'PageOrientation' - // Feature in the print ticket. - var isLandscapeOrientation = false; - var orientationFeature = printTicket.GetFeature("PageOrientation"); - if (orientationFeature) { - var orientationOptionName = orientationFeature.SelectedOption.Name; - if (orientationOptionName === "Landscape") { - isLandscapeOrientation = true; - } - } - - var imageableSizeProperty = null; - var imageableAreaProperty = null; - - // Adjust the 'PageImageableSize' values depending on whether this is borderless - // printing or landscape orientation. - if (isLandscapeOrientation) { - // Custom values for print capabilities properties 'OriginWidth' and 'OriginHeight'. - var originWidth = 5001; - var originHeight = 5001; - - // Set the 'PageImageableArea' margin property values in the print capabilities document. - imageableSizeProperty = getProperty( - printCapabilities.XmlNode, - pskNs, - "PageImageableSize"); - imageableAreaProperty = getProperty( - imageableSizeProperty, - pskNs, - "ImageableArea"); - setSubPropertyValue( - imageableAreaProperty, - pskNs, - "OriginWidth", - originWidth); - setSubPropertyValue( - imageableAreaProperty, - pskNs, - "OriginHeight", - originHeight); - } else if (isBorderlessPrinting) { - // Retrieve the 'PageMediaSize' feature from the print ticket. Retrieve the ScoredProperties - // 'MediaSizeWidth', 'MediaSizeHeight' from that feature, and use these values to set the - // 'PageImageableSize' margins in the print capabilities document. - var pageMediaSizeFeature = printTicket.GetFeature("PageMediaSize"); - if (!pageMediaSizeFeature) { - return; - } - - var pageMediaSizeSelectedOption = pageMediaSizeFeature.SelectedOption; - if (!pageMediaSizeSelectedOption) { - return; - } - - var mediaWidthValueNode = pageMediaSizeSelectedOption.GetPropertyValue("MediaSizeWidth"); - var mediaHeightValueNode = pageMediaSizeSelectedOption.GetPropertyValue("MediaSizeHeight"); - var mediaSizeWidth = mediaWidthValueNode.firstChild.nodeValue; - var mediaSizeHeight = mediaHeightValueNode.firstChild.nodeValue; - - // Set the values for the 'PageImageableSize' property in the print capabilities document. - imageableSizeProperty = getProperty( - printCapabilities.XmlNode, - pskNs, - "PageImageableSize"); - imageableAreaProperty = getProperty( - imageableSizeProperty, - pskNs, - "ImageableArea"); - setSubPropertyValue( - imageableAreaProperty, - pskNs, - "OriginWidth", - 0); - setSubPropertyValue( - imageableAreaProperty, - pskNs, - "OriginHeight", - 0); - setSubPropertyValue( - imageableAreaProperty, - pskNs, - "ExtentHeight", - parseInt( - mediaSizeHeight)); - setSubPropertyValue( - imageableAreaProperty, - pskNs, - "ExtentWidth", - parseInt( - mediaSizeWidth)); - } - - // If the input print ticket has disallowed PageMediaSize and PageMediaType options - // (as expressed in 'validatePrintTicket' function above), mark the constrained options as 'constrained by - // print ticket settings' i.e. 'psk:PrintTicketSettings'. - if (constraintSample.isMediaTypeConstrainedByMediaSize(printTicket)) { - var mediaTypeFeature = printTicket.GetFeature("PageMediaType"); - var mediaTypeOptions = printCapabilities.GetOptions(mediaTypeFeature); - - for (i = 0; i < mediaTypeOptions.Count; i++) { - var mediaTypeOption = mediaTypeOptions.GetAt(i); - - // The only option that is not constrained, as expressed in 'validatePrintTicket' function above. - if ((mediaTypeOption.Name === constraintSample.allowedPageMediaType) && - (mediaTypeOption.NamespaceUri === pskNs)) { - continue; - } - - // If an option is already marked constrained, there is no need to mark it once again. - if (!mediaTypeOption.Constrained) { - var pskPrefix = getPrefixForNamespace( - printTicket.XmlNode, - pskNs); - - mediaTypeOption.XmlNode.setAttribute("constrained", pskPrefix + ":PrintTicketSettings"); - } - } - } -} - -// Demonstrates a simple example of how to express print ticket constraints via the -// 'validatePrintTicket' and 'completePrintCapabilities' extension functions. -var constraintSample = { - // The PageMediaSize option that constrains/limits the allowed PageMediaType options. - constrainingMediaSize : "ISOA4", - - // The only PageMediaType option that not constrained by the constraining PageMediaSize option. - allowedPageMediaType : "PhotographicGlossy", - - isMediaTypeConstrainedByMediaSize : function(printTicket) { - /// <summary> - /// Determines if a print ticket is constrained (i.e. if the 'constrainingMediaSize' PageMediaSize option is - /// present, and constrains the PageMediaType option present in the print ticket). - /// </summary> - /// <param name="printTicket" type="IPrintSchemaTicket"> - /// Print ticket to be checked for constrained options. - /// </param> - /// <returns type="Boolean"> - /// true - PageMediaType option and PageMediaSize option are incompatible. - /// false - PageMediaType option and PageMediaSize option are compatible. - /// </returns> - - // Retrieve the "PageMediaSize", "PageMediaType" features and their selected option names - // from the print ticket. - var mediaSizeFeature = printTicket.GetFeature("PageMediaSize"); - var mediaTypeFeature = printTicket.GetFeature("PageMediaType"); - - if (mediaSizeFeature && mediaTypeFeature) { - // Verify if the PageMediaSize selected option is 'psk:ISOA4'. - var mediaSizeOptionNamespaceUri = mediaSizeFeature.SelectedOption.NamespaceUri; - var mediaSizeOptionName = mediaSizeFeature.SelectedOption.Name; - - if ((mediaSizeOptionNamespaceUri === pskNs) && - (mediaSizeOptionName === constraintSample.constrainingMediaSize)) { - - var mediaTypeOptionNamespaceUri = mediaTypeFeature.SelectedOption.NamespaceUri; - var mediaTypeOptionName = mediaTypeFeature.SelectedOption.Name; - - // If the print ticket contains anything other than the allowed PageMediaType option, - // return 'true' to indicate so. - if ((mediaTypeOptionNamespaceUri !== pskNs) || - (mediaTypeOptionName !== constraintSample.allowedPageMediaType)) { - return true; - } - } - } - - return false; - } -} - - -////************************************************************* -//// * -//// Utility functions * -//// * -////************************************************************* - -function setPropertyValue(propertyNode, value) { - /// <summary> - /// Set the value contained in the 'Value' node under a 'Property' - /// or a 'ScoredProperty' node in the print ticket/print capabilities document. - /// </summary> - /// <param name="propertyNode" type="IXMLDOMNode"> - /// The 'Property'/'ScoredProperty' node. - /// </param> - /// <param name="value" type="variant"> - /// The value to be stored under the 'Value' node. - /// </param> - /// <returns type="IXMLDOMNode" mayBeNull="true" locid="R:propertyValue"> - /// First child 'Property' node if found, Null otherwise. - /// </returns> - var valueNode = getPropertyFirstValueNode(propertyNode); - if (valueNode) { - var child = valueNode.firstChild; - if (child) { - child.nodeValue = value; - return child; - } - } - return null; -} - - -function setSubPropertyValue(parentProperty, keywordNamespace, subPropertyName, value) { - /// <summary> - /// Set the value contained in an inner Property node's 'Value' node (i.e. 'Value' node in a Property node - /// contained inside another Property node). - /// </summary> - /// <param name="parentProperty" type="IXMLDOMNode"> - /// The parent property node. - /// </param> - /// <param name="keywordNamespace" type="String"> - /// The namespace in which the property name is defined. - /// </param> - /// <param name="subPropertyName" type="String"> - /// The name of the sub-property node. - /// </param> - /// <param name="value" type="variant"> - /// The value to be set in the sub-property node's 'Value' node. - /// </param> - /// <returns type="IXMLDOMNode" mayBeNull="true"> - /// Refer setPropertyValue. - /// </returns> - if (!parentProperty || - !keywordNamespace || - !subPropertyName) { - return null; - } - var subPropertyNode = getProperty( - parentProperty, - keywordNamespace, - subPropertyName); - return setPropertyValue( - subPropertyNode, - value); -} - -function getScoredProperty(node, keywordNamespace, scoredPropertyName) { - /// <summary> - /// Retrieve a 'ScoredProperty' element in a print ticket/print capabilities document. - /// </summary> - /// <param name="node" type="IXMLDOMNode"> - /// The scope of the search i.e. the parent node. - /// </param> - /// <param name="keywordNamespace" type="String"> - /// The namespace in which the element's 'name' attribute is defined. - /// </param> - /// <param name="scoredPropertyName" type="String"> - /// The ScoredProperty's 'name' attribute (without the namespace prefix). - /// </param> - /// <returns type="IXMLDOMNode" mayBeNull="true"> - /// The node on success, 'null' on failure. - /// </returns> - - // Note: It is possible to hard-code the 'psfPrefix' variable in the tag name since the - // SelectionNamespace property has been set against 'psfPrefix' - // in validatePrintTicket/completePrintCapabilities. - return searchByAttributeName( - node, - psfPrefix + ":ScoredProperty", - keywordNamespace, - scoredPropertyName); -} - -function getProperty(node, keywordNamespace, propertyName) { - /// <summary> - /// Retrieve a 'Property' element in a print ticket/print capabilities document. - /// </summary> - /// <param name="node" type="IXMLDOMNode"> - /// The scope of the search i.e. the parent node. - /// </param> - /// <param name="keywordNamespace" type="String"> - /// The namespace in which the element's 'name' attribute is defined. - /// </param> - /// <param name="propertyName" type="String"> - /// The Property's 'name' attribute (without the namespace prefix). - /// </param> - /// <returns type="IXMLDOMNode" mayBeNull="true"> - /// The node on success, 'null' on failure. - /// </returns> - return searchByAttributeName( - node, - psfPrefix + ":Property", - keywordNamespace, - propertyName); -} - -function setSelectedOptionName(printSchemaFeature, keywordPrefix, optionName) { - /// <summary> - /// Set the 'name' attribute of a Feature's selected option - /// Note: This function should be invoked with Feature type that is retrieved - /// via either PrintCapabilties->GetFeature() or PrintTicket->GetFeature(). - /// - /// Caution: Setting only the 'name' attribute can result in an invalid option element. - /// Some options require their entire subtree to be updated. - /// </summary> - /// <param name="printSchemaFeature" type="IPrintSchemaFeature"> - /// Feature variable. - /// </param> - /// <param name="keywordPrefix" type="String"> - /// The prefix for the optionName parameter. - /// </param> - /// <param name="optionName" type="String"> - /// The name (without prefix) to set as the 'name' attribute. - /// </param> - if (!printSchemaFeature || - !printSchemaFeature.SelectedOption || - !printSchemaFeature.SelectedOption.XmlNode) { - return; - } - printSchemaFeature.SelectedOption.XmlNode.setAttribute( - "name", - keywordPrefix + ":" + optionName); -} - - -////************************************************************* -//// * -//// Functions used by utility functions * -//// * -////************************************************************* - -function getPropertyFirstValueNode(propertyNode) { - /// <summary> - /// Retrieve the first 'value' node found under a 'Property' or 'ScoredProperty' node. - /// </summary> - /// <param name="propertyNode" type="IXMLDOMNode"> - /// The 'Property'/'ScoredProperty' node. - /// </param> - /// <returns type="IXMLDOMNode" mayBeNull="true"> - /// The 'Value' node on success, 'null' on failure. - /// </returns> - if (!propertyNode) { - return null; - } - - var nodeName = propertyNode.nodeName; - if ((nodeName.indexOf(":Property") < 0) && - (nodeName.indexOf(":ScoredProperty") < 0)) { - return null; - } - - var valueNode = propertyNode.selectSingleNode(psfPrefix + ":Value"); - return valueNode; -} - -function searchByAttributeName(node, tagName, keywordNamespace, nameAttribute) { - /// <summary> - /// Search for a node that with a specific tag name and containing a - /// specific 'name' attribute - /// e.g. <Bar name=\"ns:Foo\"> is a valid result for the following search: - /// Retrieve elements with tagName='Bar' whose nameAttribute='Foo' in - /// the namespace corresponding to prefix 'ns'. - /// </summary> - /// <param name="node" type="IXMLDOMNode"> - /// Scope of the search i.e. the parent node. - /// </param> - /// <param name="tagName" type="String"> - /// Restrict the searches to elements with this tag name. - /// </param> - /// <param name="keywordNamespace" type="String"> - /// The namespace in which the element's name is defined. - /// </param> - /// <param name="nameAttribute" type="String"> - /// The 'name' attribute to search for. - /// </param> - /// <returns type="IXMLDOMNode" mayBeNull="true"> - /// IXMLDOMNode on success, 'null' on failure. - /// </returns> - if (!node || - !tagName || - !keywordNamespace || - !nameAttribute) { - return null; - } - - // Please refer to: - // http://blogs.msdn.com/b/benkuhn/archive/2006/05/04/printticket-names-and-xpath.aspx - // for more information on this XPath query. - var xPathQuery = "descendant::" - + tagName - + "[substring-after(@name,':')='" - + nameAttribute - + "']" - + "[name(namespace::*[.='" - + keywordNamespace - + "'])=substring-before(@name,':')]" - ; - - return node.selectSingleNode(xPathQuery); -} - -function setSelectionNamespace(xmlNode, prefix, namespace) { - /// <summary> - /// This function sets the 'SelectionNamespaces' property on the XML Node. - /// For more details: http://msdn.microsoft.com/en-us/library/ms756048(VS.85).aspx - /// </summary> - /// <param name="xmlNode" type="IXMLDOMNode"> - /// The node on which the property is set. - /// </param> - /// <param name="prefix" type="String"> - /// The prefix to be associated with the namespace. - /// </param> - /// <param name="namespace" type="String"> - /// The namespace to be added to SelectionNamespaces. - /// </param> - xmlNode.setProperty( - "SelectionNamespaces", - "xmlns:" - + prefix - + "='" - + namespace - + "'" - ); -} - -function getPrefixForNamespace(node, namespace) { - /// <summary> - /// This function returns the prefix for a given namespace. - /// Example: In 'psf:printTicket', 'psf' is the prefix for the namespace. - /// xmlns:psf="http://schemas.microsoft.com/windows/2003/08/printing/printschemaframework" - /// </summary> - /// <param name="node" type="IXMLDOMNode"> - /// A node in the XML document. - /// </param> - /// <param name="namespace" type="String"> - /// The namespace for which prefix is returned. - /// </param> - /// <returns type="String"> - /// Returns the namespace corresponding to the prefix. - /// </returns> - - if (!node) { - return null; - } - - // Navigate to the root element of the document. - var rootNode = node.documentElement; - - // Query to retrieve the list of attribute nodes for the current node - // that matches the namespace in the 'namespace' variable. - var xPathQuery = "namespace::node()[.='" - + namespace - + "']"; - var namespaceNode = rootNode.selectSingleNode(xPathQuery); - var prefix = namespaceNode.baseName; - - return prefix; -} - -var printSchemaApiHelpers = { - supportsIPrintSchemaCapabilities2: function (printCapabilities) { - /// <summary> - /// Determines if the IPrintSchemaCapabilities2 APIs are supported on the 'printCapabilities' object. - /// </summary> - /// <param name="printCapabilities" type="IPrintSchemaCapabilities"> - /// Print capabilities object. - /// </param> - /// <returns type="Boolean"> - /// true - the interface APIs are supported. - /// false - the interface APIs are not supported. - /// </returns> - - var supported = true; - - try { - if (typeof printCapabilities.getParameterDefinition === "undefined") { - supported = false; - } - } - catch (exception) { - supported = false; - } - - return supported; - }, - supportsIPrintSchemaTicket2: function(printTicket) { - /// <summary> - /// Determines if the IPrintSchemaTicket2 APIs are supported on the 'printTicket' object. - /// </summary> - /// <param name="printTicket" type="IPrintSchemaTicket"> - /// Print ticket object. - /// </param> - /// <returns type="Boolean"> - /// true - the interface APIs are supported. - /// false - the interface APIs are not supported. - /// </returns> - - var supported = true; - - try { - if (typeof printTicket.getParameterInitializer === "undefined") { - supported = false; - } - } - catch (exception) { - supported = false; - } - - return supported; - } -}
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln deleted file mode 100644 index 67e9e904..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConstraintScript", "ConstraintScript.vcxproj", "{6701474B-F8FF-4260-BFA6-3CA57816EF12}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - Debug|ARM64 = Debug|ARM64 - Release|ARM64 = Release|ARM64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|Win32.ActiveCfg = Debug|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|Win32.Build.0 = Debug|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|Win32.ActiveCfg = Release|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|Win32.Build.0 = Release|Win32 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|x64.ActiveCfg = Debug|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|x64.Build.0 = Debug|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|x64.ActiveCfg = Release|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|x64.Build.0 = Release|x64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Debug|ARM64.Build.0 = Debug|ARM64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|ARM64.ActiveCfg = Release|ARM64 - {6701474B-F8FF-4260-BFA6-3CA57816EF12}.Release|ARM64.Build.0 = Release|ARM64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj deleted file mode 100644 index 911bad57..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj +++ /dev/null @@ -1,209 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{6701474B-F8FF-4260-BFA6-3CA57816EF12}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <SupportsPackaging>false</SupportsPackaging> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{1037647C-EC47-4C60-ADA7-815F653774D9}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetName>ConstraintScript</TargetName> - </PropertyGroup> - <ItemGroup> - <None Include="ConstraintScript.js" /> - </ItemGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Include="*.txt" Exclude="@(None)" /> - <None Include="*.htm" Exclude="@(None)" /> - <None Include="*.html" Exclude="@(None)" /> - <None Include="*.ico" Exclude="@(None)" /> - <None Include="*.cur" Exclude="@(None)" /> - <None Include="*.bmp" Exclude="@(None)" /> - <None Include="*.dlg" Exclude="@(None)" /> - <None Include="*.rct" Exclude="@(None)" /> - <None Include="*.gif" Exclude="@(None)" /> - <None Include="*.jpg" Exclude="@(None)" /> - <None Include="*.jpeg" Exclude="@(None)" /> - <None Include="*.wav" Exclude="@(None)" /> - <None Include="*.jpe" Exclude="@(None)" /> - <None Include="*.tiff" Exclude="@(None)" /> - <None Include="*.tif" Exclude="@(None)" /> - <None Include="*.png" Exclude="@(None)" /> - <None Include="*.rc2" Exclude="@(None)" /> - <None Include="*.def" Exclude="@(None)" /> - <None Include="*.bat" Exclude="@(None)" /> - <None Include="*.hpj" Exclude="@(None)" /> - <None Include="*.asmx" Exclude="@(None)" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters deleted file mode 100644 index a953801e..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/ConstraintScript.vcxproj.Filters +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{E5E0E095-07E3-475A-B3A9-CDFFB0B251D5}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{DCAD2131-1F10-4E17-8798-E0D2C3CBABE9}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{14445C2D-F6CE-4302-8FE1-C245A9C8D403}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{69EDD4E4-1B0E-40AE-BDFE-A245F90B384C}</UniqueIdentifier> - </Filter> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md deleted file mode 100644 index a98abd5f..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/README.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to implement advanced constraint handling and PrintTicket/PrintCapabilities handling using JavaScript." -languages: -- javascript -products: -- windows -- windows-wdk ---- - -# Print Driver Constraints Sample - -This sample demonstrates how to implement advanced constraint handling, and also PrintTicket/PrintCapabilities handling using JavaScript. - -The Constraints.js file in this sample demonstrates the implementation of JavaScript-based constraints to be used with a v4 print driver. The file implements the following two of the four functions used by JavaScript constraint files, as well as several helper functions: - -- **ValidatePrintTicket** takes a given [IPrintSchemaTicket](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschematicket) object and validates it for the current printer. The function may determine that the Print Ticket was already valid, modify the Print Ticket to make it valid, or determine that the Print Ticket is invalid and could not be made valid. - -- **CompletePrintCapabilities** takes a given **IPrintSchemaTicket** object and the [IPrintSchemaCapabilities](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschemacapabilities) object that was produced by the configuration module and augments it as needed. This can be used to establish positive constraint situations. - -This sample does not demonstrate **ConvertPrintTicketToDevMode** or **ConvertDevModeToPrintTicket**, which utilize a property bag to store data in the private section of the DEVMODE structure. - -> [!NOTE] -> This sample is for the v4 print driver model. - -## Related topics - -[Building a Driver with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver) - -[IPrintSchemaCapabilities](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschemacapabilities) - -[IPrintSchemaTicket](https://docs.microsoft.com/windows-hardware/drivers/ddi/content/printerextension/nn-printerextension-iprintschematicket) diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js deleted file mode 100644 index bbbc31a0..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense-Windows8.1.js +++ /dev/null @@ -1,126 +0,0 @@ -/// <reference path="v4PrintDriver-Intellisense.js" /> - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaTicket, - { - GetParameterInitializer: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket2::GetParameterInitializer. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaParameterInitializer" /> - } - }); - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaCapabilities, - { - GetParameterDefinition: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities2::GetParameterDefinition. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaParameterDefinition" /> - } - }); - -IPrintSchemaParameterInitializer = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterInitializer, - IPrintSchemaElement, - { - /// <field name="Value" type="String/Number"> - /// Property-get/set maps to COM IPrintSchemaParameterInitializer::Value. - /// </field> - Value: null, - }); - -IPrintSchemaParameterDefinition = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterDefinition, - IPrintSchemaDisplayableElement, - { - /// <field name="UserInputRequired" type="Boolean"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::UserInputRequired. - /// </field> - UserInputRequired: null, - /// <field name="UnitType" type="String"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::UnitType. - /// </field> - UnitType: null, - /// <field name="DataType" type="PrintSchemaParameterDataType"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::DataType. - /// </field> - DataType: null, - /// <field name="RangeMin" type="Number"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMin. - /// </field> - RangeMin: null, - /// <field name="RangeMax" type="Number"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMax. - /// </field> - RangeMax: null - }); - -IPrinterScriptUsbJobContextReturnCodes = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContextReturnCodes, - null, - { - /// <field name="Success" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Success. - /// </field> - Success: null, - /// <field name="Failure" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Failure. - /// </field> - Failure: null, - /// <field name="Retry" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Retry. - /// </field> - Retry: null, - /// <field name="DeviceBusy" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::DeviceBusy. - /// </field> - DeviceBusy: null, - /// <field name="AbortTheJob" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::AbortTheJob. - /// </field> - AbortTheJob: null - }); - -IPrinterScriptUsbWritePrintDataProgress = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbWritePrintDataProgress, - null, - { - /// <field name="ProcessedByteCount" type="Number"> - /// Property-get/set maps to COM IPrinterScriptUsbWritePrintDataProgress::ProcessedByteCount. - /// </field> - ProcessedByteCount: null - }); - -IPrinterScriptUsbJobContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContext, - null, - { - /// <field name="JobPropertyBag" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::JobPropertyBag. - /// </field> - JobPropertyBag: null, - /// <field name="ReturnCodes" type="IPrinterScriptUsbJobContextReturnCodes"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::ReturnCodes. - /// </field> - ReturnCodes: null, - /// <field name="TemporaryStreams" type="Array"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::TemporaryStreams. Provides an array of IPrinterScriptableSequentialStream. - /// </field> - TemporaryStreams: null, - /// <field name="PrintedPageCount" type="Number"> - /// Property-get/set maps to COM IPrinterScriptUsbJobContext::PrintedPageCount. - /// </field> - PrintedPageCount: null - });
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js b/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js deleted file mode 100644 index 2386541d..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-ConstraintScript/v4PrintDriver-Intellisense.js +++ /dev/null @@ -1,513 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// v4PrintDriver-Intellisense.js -// -// Abstract: -// -// This file defines intellisense to be used by JavaScript extensions in v4 print drivers. - -var v4PrintDriverIntellisense = { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - createInterface: function (childInterface, baseType, prototype) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - childInterface.__class = true; - - if (prototype) { - childInterface.prototype = prototype; - } - - if (baseType) { - childInterface.__baseType = baseType; - childInterface.__basePrototypePending = true; - v4PrintDriverIntellisense.resolveInheritance(childInterface); - } - }, - appendInterfaceMethods: function (baseType, prototype) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - for (var memberName in prototype) { - baseType.prototype[memberName] = prototype[memberName]; - } - }, - resolveInheritance: function (childInterface) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - var baseType = childInterface.__baseType; - if (!baseType) { - return; - } - - if (baseType.__baseType) { - resolveInheritance(baseType); - } - - if (!childInterface.__basePrototypePending) { - return; - } - - for (var memberName in baseType.prototype) { - var memberValue = baseType.prototype[memberName]; - if (!childInterface.prototype[memberName]) { - childInterface.prototype[memberName] = memberValue; - } - } - - delete childInterface.__basePrototypePending; - } -} - -IPrintSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaElement, - null, - { - /// <field name="XmlNode" type="XML DOM"> - /// Property-get maps to COM IPrintSchemaElement::XmlNode. - /// </field> - XmlNode: null, - /// <field name="Name" type="String"> - /// Property-get maps to COM IPrintSchemaElement::Name. - /// </field> - Name: null, - /// <field name="NamespaceUri" type="String"> - /// Property-get maps to COM IPrintSchemaElement::NamespaceUri. - /// </field> - NamespaceUri: null - }); - -IPrintSchemaDisplayableElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaDisplayableElement, - IPrintSchemaElement, - { - /// <field name="DisplayName" type="String"> - /// Property-get maps to COM IPrintSchemaDisplayableElement::DisplayName. - /// </field> - DisplayName: null - }); - - -IPrintSchemaOption = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOption, - IPrintSchemaDisplayableElement, - { - /// <field name="Selected" type="Boolean"> - /// Property-get maps to COM IPrintSchemaOption::Selected. - /// </field> - Selected: null, - /// <field name="Constrained" type="PrintSchemaConstrainedSetting"> - /// Property-get maps to COM IPrintSchemaOption::Constrained. - /// </field> - Constrained: null, - GetPropertyValue: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaOption::GetPropertyValue. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="XML DOM" /> - }, - /// <field name="PagesPerSheet" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaNUpOption::PagesPerSheet. Valid for NUp option only. - /// </field> - PagesPerSheet: null, - /// <field name="WidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons. Valid for PageMediaSize option only. - /// </field> - WidthInMicrons: null, - /// <field name="HeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons. Valid for PageMediaSize option only. - /// </field> - HeightInMicrons: null - - }); - -IPrintSchemaOptionCollection = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOptionCollection, - null, - { - /// <field name="Count" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaOptionCollection::Count. - /// </field> - Count: null, - GetAt: function (index) { - /// <summary> - /// Property-get maps to COM IPrintSchemaOptionCollection::GetAt. - /// </summary> - /// <param name="index" type="Number" integer="true" /> - /// <returns type="IPrintSchemaOption" /> - } - }); - - -IPrintSchemaFeature = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaFeature, - IPrintSchemaDisplayableElement, - { - /// <field name="SelectedOption" type="IPrintSchemaOption"> - /// Property-set/get maps to COM IPrintSchemaFeature::SelectedOption. - /// </field> - SelectedOption: null, - /// <field name="SelectionType" type="PrintSchemaSelectionType"> - /// Property-get maps to COM IPrintSchemaFeature::SelectionType. - /// </field> - SelectionType: null, - GetOption: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaFeature::GetOption. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaOption" /> - }, - /// <field name="DisplayUI" type="Boolean"> - /// Property-get maps to COM IPrintSchemaFeature::DisplayUI. - /// </field> - DisplayUI: null - }); - - -IPrintSchemaPageImageableSize = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaPageImageableSize, - IPrintSchemaElement, - { - /// <field name="ImageableSizeWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons. - /// </field> - ImageableSizeWidthInMicrons: null, - /// <field name="ImageableSizeHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons. - /// </field> - ImageableSizeHeightInMicrons: null, - /// <field name="OriginWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons. - /// </field> - OriginWidthInMicrons: null, - /// <field name="OriginHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons. - /// </field> - OriginHeightInMicrons: null, - /// <field name="ExtentWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons. - /// </field> - ExtentWidthInMicrons: null, - /// <field name="ExtentHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons. - /// </field> - ExtentHeightInMicrons: null - }); - - -IPrintSchemaCapabilities = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaCapabilities, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName. - /// </summary> - /// <param name="keyName" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - GetFeature: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetFeature. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - /// <field name="PageImageableSize" type="IPrintSchemaPageImageableSize"> - /// Property-get maps to COM IPrintSchemaCapabilities::PageImageableSize. - /// </field> - PageImageableSize: null, - /// <field name="JobCopiesAllDocumentsMinValue" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue. - /// </field> - JobCopiesAllDocumentsMinValue: null, - /// <field name="JobCopiesAllDocumentsMaxValue" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue. - /// </field> - JobCopiesAllDocumentsMaxValue: null, - GetSelectedOptionInPrintTicket: function (feature) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket. - /// </summary> - /// <param name="feature" type="IPrintSchemaFeature" /> - /// <returns type="IPrintSchemaOption" /> - }, - GetOptions: function (feature) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetOptions. - /// </summary> - /// <param name="feature" type="IPrintSchemaFeature" /> - /// <returns type="IPrintSchemaOptionCollection" /> - } - }); - - -IPrintSchemaTicket = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaTicket, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetFeatureByKeyName. - /// </summary> - /// <param name="keyName" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - GetFeature: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetFeature. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - NotifyXmlChanged: function () { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::NotifyXmlChanged. - /// </summary> - }, - GetCapabilities: function () { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetCapabilities. - /// </summary> - /// <returns type="IPrintSchemaCapabilities" /> - }, - /// <field name="JobCopiesAllDocuments" type="Number" integer="true"> - /// Property-get/put maps to IPrintSchemaTicket::JobCopiesAllDocuments. - /// </field> - JobCopiesAllDocuments: null - }); - - -IPrinterScriptableSequentialStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableSequentialStream, - null, - { - Read: function (count) { - /// <summary> - /// Method maps to COM IPrinterScriptableSequentialStream::Read. - /// </summary> - /// <param name="count" type="Number" integer="true" /> - /// <returns type="Array" /> - }, - Write: function (array) { - /// <summary> - /// Method maps to COM IPrinterScriptableSequentialStream::Write. - /// </summary> - /// <param name="array" type="Array" /> - /// <returns type="Number" integer="true"/> - } - }); - -IPrinterScriptableStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableStream, - IPrinterScriptableSequentialStream, - { - Commit: function () { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::Commit. - /// </summary> - }, - Seek: function (offset, streamSeek) { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::Seek - /// </summary> - /// <param name="offset" type="Number" integer="true" /> - /// <param name="streamSeek" type="STREAM_SEEK" /> - /// <returns type="Number" integer="true"/> - }, - SetSize: function (size) { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::SetSize. - /// </summary> - /// <param name="size" type="Number" integer="true" /> - } - }); - - -IPrinterScriptablePropertyBag = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptablePropertyBag, - null, - { - GetBool: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetBool. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="Boolean" /> - }, - SetBool: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetBool. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="Boolean" /> - }, - GetInt32: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetInt32. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="Number" integer="true"/> - }, - SetInt32: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetInt32. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="Number" integer="true" /> - }, - GetString: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetString. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="String" /> - }, - SetString: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetString. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="String" /> - }, - GetReadStream: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetReadStream. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="IPrinterScriptableStream" /> - }, - GetWriteStream: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetWriteStream. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="IPrinterScriptableStream" /> - } - }); - - -IPrinterScriptContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptContext, - null, - { - /// <field name="DriverProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::DriverProperties. - /// </field> - DriverProperties: null, - /// <field name="QueueProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::QueueProperties. - /// </field> - QueueProperties: null, - /// <field name="UserProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::UserProperties. - /// </field> - UserProperties: null - }); - -IPrinterBidiSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaElement, - null, - { - /// <field name="Name" type="String"> - /// Property-get maps to COM IPrinterBidiSchemaElement::Name. - /// </field> - Name: null, - /// <field type="PrinterBidiSchemaElementType"> - /// Property-get maps to COM IPrinterBidiSchemaElement::BidiType. - /// </field> - BidiType: null, - /// <field type="Object"> - /// Property-get maps to COM IPrinterBidiSchemaElement::Value. - /// </field> - Value: null - }); - -IPrinterBidiSchemaResponses = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaResponses, - null, - { - AddNull: function (schema) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddNull. - /// </summary> - /// <param name="schema" type="String" /> - }, - AddString: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddString. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddText: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddText. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddEnum: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddEnum. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddInt32: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddInt32. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Number" integer="true" /> - }, - AddBool: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddBool. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Boolean" /> - }, - AddFloat: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddFloat. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Number" /> - }, - AddBlob: function (schema, array) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddBlob. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="array" type="Array" /> - }, - AddRequeryKey: function (queryKey) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddRequeryKey. - /// </summary> - /// <param name="queryKey" type="String" /> - } - }); diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.sln b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.sln deleted file mode 100644 index da7ca087..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.sln +++ /dev/null @@ -1,53 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{1AB32C08-868F-4CE2-9C2A-CE2CF2279ADD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{B756657D-AC58-4D5A-A446-1582707D012E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HostBasedSampleDriver", "HostBasedSampleDriver.vcxproj", "{9D446972-7555-4D86-9665-CB304793A0C7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - Debug|ARM64 = Debug|ARM64 - Release|ARM64 = Release|ARM64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B756657D-AC58-4D5A-A446-1582707D012E}.Debug|Win32.ActiveCfg = Debug|Win32 - {B756657D-AC58-4D5A-A446-1582707D012E}.Debug|Win32.Build.0 = Debug|Win32 - {B756657D-AC58-4D5A-A446-1582707D012E}.Release|Win32.ActiveCfg = Release|Win32 - {B756657D-AC58-4D5A-A446-1582707D012E}.Release|Win32.Build.0 = Release|Win32 - {B756657D-AC58-4D5A-A446-1582707D012E}.Debug|x64.ActiveCfg = Debug|x64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Debug|x64.Build.0 = Debug|x64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Release|x64.ActiveCfg = Release|x64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Release|x64.Build.0 = Release|x64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Debug|ARM64.Build.0 = Debug|ARM64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Release|ARM64.ActiveCfg = Release|ARM64 - {B756657D-AC58-4D5A-A446-1582707D012E}.Release|ARM64.Build.0 = Release|ARM64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Debug|Win32.ActiveCfg = Debug|Win32 - {9D446972-7555-4D86-9665-CB304793A0C7}.Debug|Win32.Build.0 = Debug|Win32 - {9D446972-7555-4D86-9665-CB304793A0C7}.Release|Win32.ActiveCfg = Release|Win32 - {9D446972-7555-4D86-9665-CB304793A0C7}.Release|Win32.Build.0 = Release|Win32 - {9D446972-7555-4D86-9665-CB304793A0C7}.Debug|x64.ActiveCfg = Debug|x64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Debug|x64.Build.0 = Debug|x64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Release|x64.ActiveCfg = Release|x64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Release|x64.Build.0 = Release|x64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Debug|ARM64.Build.0 = Debug|ARM64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Release|ARM64.ActiveCfg = Release|ARM64 - {9D446972-7555-4D86-9665-CB304793A0C7}.Release|ARM64.Build.0 = Release|ARM64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {B756657D-AC58-4D5A-A446-1582707D012E} = {1AB32C08-868F-4CE2-9C2A-CE2CF2279ADD} - EndGlobalSection -EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj deleted file mode 100644 index 6f345409..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj +++ /dev/null @@ -1,221 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{9D446972-7555-4D86-9665-CB304793A0C7}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <SupportsPackaging>false</SupportsPackaging> - <RequiresPackageProject>true</RequiresPackageProject> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{45B64CBB-A777-46C3-9D54-DFBCE999343B}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>HostBasedSampleDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>HostBasedSampleDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>HostBasedSampleDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>HostBasedSampleDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetName>HostBasedSampleDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetName>HostBasedSampleDriver</TargetName> - </PropertyGroup> - <ItemGroup> - <FilesToPackage Include="usb_host_based_sample-manifest.ini" /> - <FilesToPackage Include="usb_host_based_sample-pipelineconfig.xml" /> - <FilesToPackage Include="usb_host_based_sample.gpd" /> - <FilesToPackage Include="usb_host_based_sample.js" /> - <FilesToPackage Include="usb_host_based_sample_events.xml" /> - <FilesToPackage Include="usb_host_based_sample_extension.xml" /> - </ItemGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Include="*.txt" Exclude="@(None)" /> - <None Include="*.htm" Exclude="@(None)" /> - <None Include="*.html" Exclude="@(None)" /> - <None Include="*.ico" Exclude="@(None)" /> - <None Include="*.cur" Exclude="@(None)" /> - <None Include="*.bmp" Exclude="@(None)" /> - <None Include="*.dlg" Exclude="@(None)" /> - <None Include="*.rct" Exclude="@(None)" /> - <None Include="*.gif" Exclude="@(None)" /> - <None Include="*.jpg" Exclude="@(None)" /> - <None Include="*.jpeg" Exclude="@(None)" /> - <None Include="*.wav" Exclude="@(None)" /> - <None Include="*.jpe" Exclude="@(None)" /> - <None Include="*.tiff" Exclude="@(None)" /> - <None Include="*.tif" Exclude="@(None)" /> - <None Include="*.png" Exclude="@(None)" /> - <None Include="*.rc2" Exclude="@(None)" /> - <None Include="*.def" Exclude="@(None)" /> - <None Include="*.bat" Exclude="@(None)" /> - <None Include="*.hpj" Exclude="@(None)" /> - <None Include="*.asmx" Exclude="@(None)" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj.Filters deleted file mode 100644 index 74551d65..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/HostBasedSampleDriver.vcxproj.Filters +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{ACA7BBB6-5F3F-4E43-930C-EBC0AD55CE0E}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{76D922C6-8F3F-45D8-B77F-0D8C423990B9}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{46CA4945-E191-4A29-88D3-EB75CD9E68C5}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{CF26C539-5603-4EBD-9502-6AFF1DBCE063}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <FilesToPackage Include="usb_host_based_sample-pipelineconfig.xml"> - <Filter>Resource Files</Filter> - </FilesToPackage> - <FilesToPackage Include="usb_host_based_sample_events.xml"> - <Filter>Resource Files</Filter> - </FilesToPackage> - <FilesToPackage Include="usb_host_based_sample_extension.xml"> - <Filter>Resource Files</Filter> - </FilesToPackage> - <None Include="usb_host_based_sample-pipelineconfig.xml"> - <Filter>Resource Files</Filter> - </None> - <None Include="usb_host_based_sample_events.xml"> - <Filter>Resource Files</Filter> - </None> - <None Include="usb_host_based_sample_extension.xml"> - <Filter>Resource Files</Filter> - </None> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj deleted file mode 100644 index 8bd189b0..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj +++ /dev/null @@ -1,128 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\HostBasedSampleDriver.vcxproj"> - <Project>{9D446972-7555-4D86-9665-CB304793A0C7}</Project> - </ProjectReference> - </ItemGroup> - <PropertyGroup Label="PropertySheets"> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - <DriverType>Package</DriverType> - <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> - <Configuration>Debug</Configuration> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Globals"> - <ProjectGuid>{B756657D-AC58-4D5A-A446-1582707D012E}</ProjectGuid> - <SampleGuid>{CE9EE2B8-13CF-44F8-9F72-BB9F84A2A645}</SampleGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>true</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>false</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>true</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>false</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>true</UseDebugLibraries> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>false</UseDebugLibraries> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <PropertyGroup> - <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <ImportToStore>False</ImportToStore> - <InstallMode>None</InstallMode> - <HardwareIdString /> - <CommandLine /> - <ScriptPath /> - <DeployFiles /> - <ScriptName /> - <ScriptDeviceQuery>%PathToInf%</ScriptDeviceQuery> - <EnableVerifier>False</EnableVerifier> - <AllDrivers>False</AllDrivers> - <VerifyProjectOutput>True</VerifyProjectOutput> - <VerifyDrivers /> - <VerifyFlags>133563</VerifyFlags> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj.Filters deleted file mode 100644 index 85797e90..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/Package/package.VcxProj.Filters +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{2EF8CCC7-8C3B-4E62-95C2-B620E0CE232B}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{AF7E4E12-189E-4CBC-B989-CE143905316E}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{AEB5CD35-F331-4D44-90DD-157D4199F069}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{EAD2021B-7399-48F2-900F-E003121D6C41}</UniqueIdentifier> - </Filter> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md deleted file mode 100644 index 3c7bfba2..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/README.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to support host-based devices that use the v4 print driver model and are connected via USB." -languages: -- javascript -- xml -products: -- windows -- windows-wdk ---- - -# USB Host-Based Print Driver Sample - -This driver sample demonstrates how to support host-based devices that use the v4 print driver model, and are connected via USB. - -> [!NOTE] -> This sample is for the v4 print driver model. - -Windows enables manufacturers to support Bidirectional Communication (Bidi) for USB devices, by using a combination of both a Bidi XML file and a Javascript file known as a USB Bidi extender. The *usb\_host\_based\_sample.js* file that is included with the sample, plays the role of the USB Bidi extender. - -The USB Bidi extender allows apps to use Bidi with USB as the transport mechanism. The Javascript implementation does not support any device flow control, or any multiplexing of control information with print jobs during printing. - -By default, Bidi queries and status requests are routed over the USB device interface that is used for printing. - -In addition to extending Bidi communication, this driver sample also specifies the schema elements that it supports. The *usb\_host\_based\_sample\_extension.xml* file that is included with the sample, provides information about the supported schema elements. - -The Bidi schema is a hierarchy of printer attributes, some of which are properties and others that are values (or value entries): - -- *Property* - - - A property is a node in the schema hierarchy. A property can have one or more children, and these children can be other properties or values. - -- *Value* - - - A value is a leaf in the schema hierarchy that represents either a single data item or a list of related data items. A value has a name, a data type, and a data value. A value cannot have child elements. - -For more information, see [USB Bidi Extender](https://docs.microsoft.com/windows-hardware/drivers/print/usb-bidi-extender) and [Bidi Communication Schema](https://docs.microsoft.com/windows-hardware/drivers/print/bidirectional-communication-schema). - -## File manifest - -Here are the core files that you will find in this sample: - -### usb\_host\_based\_sample.js - -A USB Bidi Extension JavaScript file which includes support for controlling printing for host-based devices. This is the only code in the driver sample. It is invoked by USBMon and it communicates with the device to do the following: - -- Determine if the device is ready to receive data - -- Check to see if there is an error condition - -- Read the device status - -### usb\_host\_based\_sample\_events.xml - -A 'driver events' XML file that specifies an event which detects when the user needs to flip over the paper in the tray. - -### usb\_host\_based\_sample\_extension.xml - -A USB Bidi Extension XML file that specifies the supported Bidi Schema elements for this driver. - -## Build the sample - -For information and instructions about how to test and deploy drivers, see [Developing, Testing, and Deploying Drivers](https://docs.microsoft.com/windows-hardware/drivers/develop/). - -## Run the sample - -To understand how to run this sample as a Windows driver, see the [v4 Printer Driver](https://docs.microsoft.com/windows-hardware/drivers/print/v4-printer-driver) collection of topics. diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-manifest.ini b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-manifest.ini deleted file mode 100644 index 3205ffcf..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-manifest.ini +++ /dev/null @@ -1,13 +0,0 @@ -[DriverConfig] -DriverCategory=PrintFax.Printer -DataFile=usb_host_based_sample.gpd - -; Note: Please replace the GUID below when building a production driver. -PrinterDriverID={00000000-0000-0000-0000-000000000000} -Flags=HostBasedDevice -EventFile=usb_host_based_sample_events.xml -RequiredFiles=UNIRES.DLL,STDNAMES.GPD,MSXPSINC.GPD - -[BidiFiles] -BidiUSBFile=usb_host_based_sample_extension.xml -BidiUSBJSFile=usb_host_based_sample.js diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-pipelineconfig.xml b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-pipelineconfig.xml deleted file mode 100644 index 905358a2..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample-pipelineconfig.xml +++ /dev/null @@ -1 +0,0 @@ -<Filters /> diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.gpd b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.gpd deleted file mode 100644 index 1f37334c..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.gpd +++ /dev/null @@ -1,138 +0,0 @@ -*% -*% This file is a sample GPD demonstrating basic printer features/options -*% -*% - -*%****************************************************************************** -*%: The following root-level attributes should be modified to suit your printer -*%****************************************************************************** -*GPDFileName: "usb_host_based.GPD" -*GPDFileVersion: "1.0" -*GPDSpecVersion: "1.0" -*Include: "StdNames.gpd" -*%************************************************** -*% V4 GPD-based printer drivers must include msxpsinc.GPD file -*%************************************************** -*Include: "msxpsinc.gpd" -*ModelName: "Microsft USB Host Based Sample Driver" -*MasterUnits: PAIR(1200, 1200) -*PrinterType: PAGE -*MaxCopies: 1 -*Command: CmdSendBlockData { *Cmd : "" } - -*PrintSchemaPrivateNamespaceURI: "http://www.microsoft.com/USBHostBasedSample" - -*%****************************************************************************** -*% Orientation -*%****************************************************************************** -*Feature: Orientation -{ - *rcNameID: =ORIENTATION_DISPLAY - *DefaultOption: PORTRAIT - - *Option: PORTRAIT - { - *rcNameID: =PORTRAIT_DISPLAY - } - - *Option: LANDSCAPE_CC270 - { - *rcNameID: =LANDSCAPE_DISPLAY - } -} - - -*%****************************************************************************** -*% Resolution -*%****************************************************************************** -*Feature: Resolution -{ - *rcNameID: =RESOLUTION_DISPLAY - *DefaultOption: Option1 - - *Option: Option1 - { - *Name: "600 x 600 " =DOTS_PER_INCH - *DPI: PAIR(600, 600) - *TextDPI: PAIR(600, 600) - *SpotDiameter: 100 - } -} - -*%****************************************************************************** -*% Input Bin -*%****************************************************************************** -*Feature: InputBin -{ - *rcNameID: =PAPER_SOURCE_DISPLAY - *DefaultOption: FORMSOURCE - - *Option: FORMSOURCE - { - *rcNameID: =AUTO_DISPLAY - } - *Option: UPPER - { - *rcNameID: =UPPER_TRAY_DISPLAY - } -} - -*%****************************************************************************** -*% Paper Size -*%****************************************************************************** -*Feature: PaperSize -{ - *rcNameID: =PAPER_SIZE_DISPLAY - *DefaultOption: LETTER - - *Option: LETTER - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME *% 1000 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 12600) - *PrintableOrigin: PAIR(200, 200) - *CursorOrigin: PAIR(0, 0) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9000, 12600) - *PrintableOrigin: PAIR(200, 200) - *CursorOrigin: PAIR(0, 0) - } - } - } - - *Option: A4 - { - *rcNameID: =RCID_DMPAPER_SYSTEM_NAME *% 1008 - *switch: Orientation - { - *case: PORTRAIT - { - *PrintableArea: PAIR(9000, 12600) - *PrintableOrigin: PAIR(200, 200) - *CursorOrigin: PAIR(0, 0) - } - *case: LANDSCAPE_CC270 - { - *PrintableArea: PAIR(9000, 12600) - *PrintableOrigin: PAIR(200, 200) - *CursorOrigin: PAIR(0, 0) - } - } - } -} - -*%****************************************************************************** -*% Cursor Commands -*% The following cursor commands are mandatory -*% -*% Learn more: Cursor Commands -*% http://msdn.microsoft.com/en-us/library/ff547223(VS.85).aspx -*%****************************************************************************** -*Command: CmdCR { *Cmd : "" } -*Command: CmdLF { *Cmd : "" } -*Command: CmdFF { *Cmd : "" } diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf deleted file mode 100644 index b4326484..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.inf +++ /dev/null @@ -1,112 +0,0 @@ -; -; usb_host_based_sample.inf -; -; Microsoft USB Host Based Sample Driver -; -; Copyright Microsoft Corporation -; -[Version] -Signature="$Windows NT$" -Provider=%ProviderString% -CatalogFile=usb_host_based_sample.cat -ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318} -Class=Printer -DriverVer=03/12/2013,1.0.0.1 -ClassVer=4.0 - -; -; Manufacturer section. -; -; This section lists all of the manufacturers -; that we will display in the Dialog box -; -[Manufacturer] -%ManufacturerName%=Standard, NTx86, NTamd64, NTarm, NTarm64 - -; -; Model sections -; -; Each section here corresponds with an entry listed in the -; [Manufacturer] section above. The models will be displayed in the order -; that they appear in the INF file. -; - -[Standard.NTx86] -"USB Host Based Sample Driver" = USB_HOST_BASED_SAMPLE, DO_NOT_USE_THIS_HWID1, - -[Standard.NTamd64] -"USB Host Based Sample Driver" = USB_HOST_BASED_SAMPLE, DO_NOT_USE_THIS_HWID1 - -[Standard.NTarm] -"USB Host Based Sample Driver" = USB_HOST_BASED_SAMPLE, DO_NOT_USE_THIS_HWID1 - -[Standard.NTarm64] -"USB Host Based Sample Driver" = USB_HOST_BASED_SAMPLE, DO_NOT_USE_THIS_HWID1 - -; -; Installer Sections -; -; These sections control file installation, and reference all files that -; need to be copied. The section name will be assumed to be the driver -; file, unless there is an explicit DriverFile section listed. -; -[USB_HOST_BASED_SAMPLE] -CopyFiles=USB_HOST_BASED_SAMPLE_FILES - -[USB_HOST_BASED_SAMPLE.Services] -AddService=,2 - -; -; Copy Sections -; -; Lists of files that are actually copied. These sections are referenced -; from the installer sections, above. Only create a section if it contains -; two or more files (if we only copy a single file, identify it in the -; installer section, using the @filename notation) or if it's a color -; profile (since the DestinationDirs can only handle sections, and not -; individual files). -; - -[USB_HOST_BASED_SAMPLE_FILES] -usb_host_based_sample.gpd -usb_host_based_sample-pipelineconfig.xml -usb_host_based_sample_extension.xml -usb_host_based_sample-manifest.ini -usb_host_based_sample.js -usb_host_based_sample_events.xml - -[DestinationDirs] -DefaultDestDir=66000 - -; -; Source Disk Section -; Location of source files -; - -[SourceDisksFiles] -usb_host_based_sample.gpd = 1 -usb_host_based_sample-pipelineconfig.xml = 1 -usb_host_based_sample-manifest.ini = 1 -usb_host_based_sample.js = 1 -usb_host_based_sample_extension.xml = 1 -usb_host_based_sample_events.xml = 1 - -[SourceDisksNames.x86] -1 = %Disk1%,,, - -[SourceDisksNames.amd64] -1 = %Disk1%,,, - -[SourceDisksNames.arm] -1 = %Disk1%,,, - -[SourceDisksNames.arm64] -1 = %Disk1%,,, - -; -; Localizable Strings -; -[Strings] -Disk1="." -ProviderString = "TODO-Set-Provider" -ManufacturerName="TODO-Set-Manufacturer"
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.js b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.js Binary files differdeleted file mode 100644 index f7131583..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample.js +++ /dev/null diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_events.xml b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_events.xml deleted file mode 100644 index bf6953df..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_events.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<DriverEvents xmlns="http://schemas.microsoft.com/windows/2011/08/printing/driverevents" schemaVersion="4.0"> - <DriverEvent xmlns="" eventId="{B3E280B0-7DCD-4CD0-AFF7-BA2AF06D1235}"> - <Transport>USB</Transport> - <Query>\Printer.Extension</Query> - <Trigger result="\Printer.Extension:ManualDuplexEvent" comparison="EqualTo" value=""> - <!-- Represents the resource ID IDS_ASYNCUI_TEXT_DUPLEX_NEEDS_OTHER_SIDE --> - <StandardMessage resourceId="1100" /> - </Trigger> - </DriverEvent> -</DriverEvents>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_extension.xml b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_extension.xml deleted file mode 100644 index 7d892878..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/usb_host_based_sample_extension.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version='1.0'?> -<bidi:Schema xmlns:bidi="http://schemas.microsoft.com/windows/2010/09/printing/usbbidi"> - <Property name='Printer'> - <Property name='Extension'> - <Event name="ManualDuplexEvent" /> - </Property> - </Property> -</bidi:Schema> diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense-Windows8.1.js b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense-Windows8.1.js deleted file mode 100644 index bbbc31a0..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense-Windows8.1.js +++ /dev/null @@ -1,126 +0,0 @@ -/// <reference path="v4PrintDriver-Intellisense.js" /> - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaTicket, - { - GetParameterInitializer: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket2::GetParameterInitializer. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaParameterInitializer" /> - } - }); - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaCapabilities, - { - GetParameterDefinition: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities2::GetParameterDefinition. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaParameterDefinition" /> - } - }); - -IPrintSchemaParameterInitializer = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterInitializer, - IPrintSchemaElement, - { - /// <field name="Value" type="String/Number"> - /// Property-get/set maps to COM IPrintSchemaParameterInitializer::Value. - /// </field> - Value: null, - }); - -IPrintSchemaParameterDefinition = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterDefinition, - IPrintSchemaDisplayableElement, - { - /// <field name="UserInputRequired" type="Boolean"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::UserInputRequired. - /// </field> - UserInputRequired: null, - /// <field name="UnitType" type="String"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::UnitType. - /// </field> - UnitType: null, - /// <field name="DataType" type="PrintSchemaParameterDataType"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::DataType. - /// </field> - DataType: null, - /// <field name="RangeMin" type="Number"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMin. - /// </field> - RangeMin: null, - /// <field name="RangeMax" type="Number"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMax. - /// </field> - RangeMax: null - }); - -IPrinterScriptUsbJobContextReturnCodes = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContextReturnCodes, - null, - { - /// <field name="Success" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Success. - /// </field> - Success: null, - /// <field name="Failure" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Failure. - /// </field> - Failure: null, - /// <field name="Retry" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Retry. - /// </field> - Retry: null, - /// <field name="DeviceBusy" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::DeviceBusy. - /// </field> - DeviceBusy: null, - /// <field name="AbortTheJob" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::AbortTheJob. - /// </field> - AbortTheJob: null - }); - -IPrinterScriptUsbWritePrintDataProgress = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbWritePrintDataProgress, - null, - { - /// <field name="ProcessedByteCount" type="Number"> - /// Property-get/set maps to COM IPrinterScriptUsbWritePrintDataProgress::ProcessedByteCount. - /// </field> - ProcessedByteCount: null - }); - -IPrinterScriptUsbJobContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContext, - null, - { - /// <field name="JobPropertyBag" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::JobPropertyBag. - /// </field> - JobPropertyBag: null, - /// <field name="ReturnCodes" type="IPrinterScriptUsbJobContextReturnCodes"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::ReturnCodes. - /// </field> - ReturnCodes: null, - /// <field name="TemporaryStreams" type="Array"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::TemporaryStreams. Provides an array of IPrinterScriptableSequentialStream. - /// </field> - TemporaryStreams: null, - /// <field name="PrintedPageCount" type="Number"> - /// Property-get/set maps to COM IPrinterScriptUsbJobContext::PrintedPageCount. - /// </field> - PrintedPageCount: null - });
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense.js b/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense.js deleted file mode 100644 index 2386541d..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-HostBasedSampleDriver/v4PrintDriver-Intellisense.js +++ /dev/null @@ -1,513 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// v4PrintDriver-Intellisense.js -// -// Abstract: -// -// This file defines intellisense to be used by JavaScript extensions in v4 print drivers. - -var v4PrintDriverIntellisense = { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - createInterface: function (childInterface, baseType, prototype) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - childInterface.__class = true; - - if (prototype) { - childInterface.prototype = prototype; - } - - if (baseType) { - childInterface.__baseType = baseType; - childInterface.__basePrototypePending = true; - v4PrintDriverIntellisense.resolveInheritance(childInterface); - } - }, - appendInterfaceMethods: function (baseType, prototype) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - for (var memberName in prototype) { - baseType.prototype[memberName] = prototype[memberName]; - } - }, - resolveInheritance: function (childInterface) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - var baseType = childInterface.__baseType; - if (!baseType) { - return; - } - - if (baseType.__baseType) { - resolveInheritance(baseType); - } - - if (!childInterface.__basePrototypePending) { - return; - } - - for (var memberName in baseType.prototype) { - var memberValue = baseType.prototype[memberName]; - if (!childInterface.prototype[memberName]) { - childInterface.prototype[memberName] = memberValue; - } - } - - delete childInterface.__basePrototypePending; - } -} - -IPrintSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaElement, - null, - { - /// <field name="XmlNode" type="XML DOM"> - /// Property-get maps to COM IPrintSchemaElement::XmlNode. - /// </field> - XmlNode: null, - /// <field name="Name" type="String"> - /// Property-get maps to COM IPrintSchemaElement::Name. - /// </field> - Name: null, - /// <field name="NamespaceUri" type="String"> - /// Property-get maps to COM IPrintSchemaElement::NamespaceUri. - /// </field> - NamespaceUri: null - }); - -IPrintSchemaDisplayableElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaDisplayableElement, - IPrintSchemaElement, - { - /// <field name="DisplayName" type="String"> - /// Property-get maps to COM IPrintSchemaDisplayableElement::DisplayName. - /// </field> - DisplayName: null - }); - - -IPrintSchemaOption = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOption, - IPrintSchemaDisplayableElement, - { - /// <field name="Selected" type="Boolean"> - /// Property-get maps to COM IPrintSchemaOption::Selected. - /// </field> - Selected: null, - /// <field name="Constrained" type="PrintSchemaConstrainedSetting"> - /// Property-get maps to COM IPrintSchemaOption::Constrained. - /// </field> - Constrained: null, - GetPropertyValue: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaOption::GetPropertyValue. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="XML DOM" /> - }, - /// <field name="PagesPerSheet" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaNUpOption::PagesPerSheet. Valid for NUp option only. - /// </field> - PagesPerSheet: null, - /// <field name="WidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons. Valid for PageMediaSize option only. - /// </field> - WidthInMicrons: null, - /// <field name="HeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons. Valid for PageMediaSize option only. - /// </field> - HeightInMicrons: null - - }); - -IPrintSchemaOptionCollection = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOptionCollection, - null, - { - /// <field name="Count" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaOptionCollection::Count. - /// </field> - Count: null, - GetAt: function (index) { - /// <summary> - /// Property-get maps to COM IPrintSchemaOptionCollection::GetAt. - /// </summary> - /// <param name="index" type="Number" integer="true" /> - /// <returns type="IPrintSchemaOption" /> - } - }); - - -IPrintSchemaFeature = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaFeature, - IPrintSchemaDisplayableElement, - { - /// <field name="SelectedOption" type="IPrintSchemaOption"> - /// Property-set/get maps to COM IPrintSchemaFeature::SelectedOption. - /// </field> - SelectedOption: null, - /// <field name="SelectionType" type="PrintSchemaSelectionType"> - /// Property-get maps to COM IPrintSchemaFeature::SelectionType. - /// </field> - SelectionType: null, - GetOption: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaFeature::GetOption. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaOption" /> - }, - /// <field name="DisplayUI" type="Boolean"> - /// Property-get maps to COM IPrintSchemaFeature::DisplayUI. - /// </field> - DisplayUI: null - }); - - -IPrintSchemaPageImageableSize = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaPageImageableSize, - IPrintSchemaElement, - { - /// <field name="ImageableSizeWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons. - /// </field> - ImageableSizeWidthInMicrons: null, - /// <field name="ImageableSizeHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons. - /// </field> - ImageableSizeHeightInMicrons: null, - /// <field name="OriginWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons. - /// </field> - OriginWidthInMicrons: null, - /// <field name="OriginHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons. - /// </field> - OriginHeightInMicrons: null, - /// <field name="ExtentWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons. - /// </field> - ExtentWidthInMicrons: null, - /// <field name="ExtentHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons. - /// </field> - ExtentHeightInMicrons: null - }); - - -IPrintSchemaCapabilities = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaCapabilities, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName. - /// </summary> - /// <param name="keyName" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - GetFeature: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetFeature. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - /// <field name="PageImageableSize" type="IPrintSchemaPageImageableSize"> - /// Property-get maps to COM IPrintSchemaCapabilities::PageImageableSize. - /// </field> - PageImageableSize: null, - /// <field name="JobCopiesAllDocumentsMinValue" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue. - /// </field> - JobCopiesAllDocumentsMinValue: null, - /// <field name="JobCopiesAllDocumentsMaxValue" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue. - /// </field> - JobCopiesAllDocumentsMaxValue: null, - GetSelectedOptionInPrintTicket: function (feature) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket. - /// </summary> - /// <param name="feature" type="IPrintSchemaFeature" /> - /// <returns type="IPrintSchemaOption" /> - }, - GetOptions: function (feature) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetOptions. - /// </summary> - /// <param name="feature" type="IPrintSchemaFeature" /> - /// <returns type="IPrintSchemaOptionCollection" /> - } - }); - - -IPrintSchemaTicket = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaTicket, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetFeatureByKeyName. - /// </summary> - /// <param name="keyName" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - GetFeature: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetFeature. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - NotifyXmlChanged: function () { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::NotifyXmlChanged. - /// </summary> - }, - GetCapabilities: function () { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetCapabilities. - /// </summary> - /// <returns type="IPrintSchemaCapabilities" /> - }, - /// <field name="JobCopiesAllDocuments" type="Number" integer="true"> - /// Property-get/put maps to IPrintSchemaTicket::JobCopiesAllDocuments. - /// </field> - JobCopiesAllDocuments: null - }); - - -IPrinterScriptableSequentialStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableSequentialStream, - null, - { - Read: function (count) { - /// <summary> - /// Method maps to COM IPrinterScriptableSequentialStream::Read. - /// </summary> - /// <param name="count" type="Number" integer="true" /> - /// <returns type="Array" /> - }, - Write: function (array) { - /// <summary> - /// Method maps to COM IPrinterScriptableSequentialStream::Write. - /// </summary> - /// <param name="array" type="Array" /> - /// <returns type="Number" integer="true"/> - } - }); - -IPrinterScriptableStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableStream, - IPrinterScriptableSequentialStream, - { - Commit: function () { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::Commit. - /// </summary> - }, - Seek: function (offset, streamSeek) { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::Seek - /// </summary> - /// <param name="offset" type="Number" integer="true" /> - /// <param name="streamSeek" type="STREAM_SEEK" /> - /// <returns type="Number" integer="true"/> - }, - SetSize: function (size) { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::SetSize. - /// </summary> - /// <param name="size" type="Number" integer="true" /> - } - }); - - -IPrinterScriptablePropertyBag = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptablePropertyBag, - null, - { - GetBool: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetBool. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="Boolean" /> - }, - SetBool: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetBool. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="Boolean" /> - }, - GetInt32: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetInt32. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="Number" integer="true"/> - }, - SetInt32: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetInt32. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="Number" integer="true" /> - }, - GetString: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetString. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="String" /> - }, - SetString: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetString. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="String" /> - }, - GetReadStream: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetReadStream. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="IPrinterScriptableStream" /> - }, - GetWriteStream: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetWriteStream. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="IPrinterScriptableStream" /> - } - }); - - -IPrinterScriptContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptContext, - null, - { - /// <field name="DriverProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::DriverProperties. - /// </field> - DriverProperties: null, - /// <field name="QueueProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::QueueProperties. - /// </field> - QueueProperties: null, - /// <field name="UserProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::UserProperties. - /// </field> - UserProperties: null - }); - -IPrinterBidiSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaElement, - null, - { - /// <field name="Name" type="String"> - /// Property-get maps to COM IPrinterBidiSchemaElement::Name. - /// </field> - Name: null, - /// <field type="PrinterBidiSchemaElementType"> - /// Property-get maps to COM IPrinterBidiSchemaElement::BidiType. - /// </field> - BidiType: null, - /// <field type="Object"> - /// Property-get maps to COM IPrinterBidiSchemaElement::Value. - /// </field> - Value: null - }); - -IPrinterBidiSchemaResponses = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaResponses, - null, - { - AddNull: function (schema) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddNull. - /// </summary> - /// <param name="schema" type="String" /> - }, - AddString: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddString. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddText: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddText. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddEnum: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddEnum. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddInt32: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddInt32. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Number" integer="true" /> - }, - AddBool: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddBool. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Boolean" /> - }, - AddFloat: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddFloat. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Number" /> - }, - AddBlob: function (schema, array) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddBlob. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="array" type="Array" /> - }, - AddRequeryKey: function (queryKey) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddRequeryKey. - /// </summary> - /// <param name="queryKey" type="String" /> - } - }); diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md deleted file mode 100644 index e68dd7a4..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/README.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to support bidirectional (Bidi) communication over the USB bus using JavaScript and XML." -languages: -- javascript -- xml -products: -- windows -- windows-wdk ---- - -# Print Driver USB Monitor and Bidi Sample - -This sample demonstrates how to support bidirectional (Bidi) communication over the USB bus, using JavaScript and XML. This sample supports bidirectional status while not printing, and unsolicited status from the printer while printing. - -## File manifest - -The following files are included in the sample: - -### USBMON\_Bidi\_JavaScript\_File.js - -This JavaScript file demonstrates the implementation of a Bidi support for USBMon with a v4 print driver. The JavaScript file supports three functions: getSchemas() is used to make Bidi GET queries to a device, setSchema() is used to make a single Bidi SET query to the device, and getStatus() is called repeatedly during printing in order to retrieve unsolicited status from the printer using the data from the read channel of the device. - -### USBMON\_Bidi\_XML\_File.xml - -This XML file demonstrates how to build a Bidi Schema extension for USB. It describes the supported schema elements that can be queried or set, along with their restrictions. - -For more information, see [USB Bidi Extender](https://docs.microsoft.com/windows-hardware/drivers/print/usb-bidi-extender). - -> [!NOTE] -> This sample is for the v4 print driver model. - -When you make calls to printerStream.read() in the sample, the printer returns an array which includes an additional element that represents the array length. The following JavaScript code can be used to copy the returned array into a new array, and also to remove the additional element. - -```js -var readBuffer = []; -var readBytes = 0; -var readSize = 4096; - -readBuffer = printerStream.read( readSize ); -readBytes = readBuffer.length; - -var cleanArray = []; - -for ( i = 0; i < readBytes; i++ ) { - cleanArray[i] = readBuffer.shift(); -} -``` diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js Binary files differdeleted file mode 100644 index d066fe65..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.js +++ /dev/null diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln deleted file mode 100644 index 04c53721..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "USBMon-Bidi-Extension", "USBMon-Bidi-Extension.vcxproj", "{A43939C2-3210-449C-B415-CD3C91108C58}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - Debug|ARM64 = Debug|ARM64 - Release|ARM64 = Release|ARM64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A43939C2-3210-449C-B415-CD3C91108C58}.Debug|Win32.ActiveCfg = Debug|Win32 - {A43939C2-3210-449C-B415-CD3C91108C58}.Debug|Win32.Build.0 = Debug|Win32 - {A43939C2-3210-449C-B415-CD3C91108C58}.Release|Win32.ActiveCfg = Release|Win32 - {A43939C2-3210-449C-B415-CD3C91108C58}.Release|Win32.Build.0 = Release|Win32 - {A43939C2-3210-449C-B415-CD3C91108C58}.Debug|x64.ActiveCfg = Debug|x64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Debug|x64.Build.0 = Debug|x64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Release|x64.ActiveCfg = Release|x64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Release|x64.Build.0 = Release|x64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Debug|ARM64.Build.0 = Debug|ARM64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Release|ARM64.ActiveCfg = Release|ARM64 - {A43939C2-3210-449C-B415-CD3C91108C58}.Release|ARM64.Build.0 = Release|ARM64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj deleted file mode 100644 index bad33b17..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{A43939C2-3210-449C-B415-CD3C91108C58}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <SupportsPackaging>false</SupportsPackaging> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{7901348A-4DC8-4F62-B85E-1B0291B68463}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>USBMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>USBMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>USBMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>USBMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetName>USBMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetName>USBMon-Bidi-Extension</TargetName> - </PropertyGroup> - <ItemGroup> - <None Include="USBMon-Bidi-Extension.js" /> - <None Include="USBMon-Bidi-Extension.xml" /> - </ItemGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Include="*.txt" Exclude="@(None)" /> - <None Include="*.htm" Exclude="@(None)" /> - <None Include="*.html" Exclude="@(None)" /> - <None Include="*.ico" Exclude="@(None)" /> - <None Include="*.cur" Exclude="@(None)" /> - <None Include="*.bmp" Exclude="@(None)" /> - <None Include="*.dlg" Exclude="@(None)" /> - <None Include="*.rct" Exclude="@(None)" /> - <None Include="*.gif" Exclude="@(None)" /> - <None Include="*.jpg" Exclude="@(None)" /> - <None Include="*.jpeg" Exclude="@(None)" /> - <None Include="*.wav" Exclude="@(None)" /> - <None Include="*.jpe" Exclude="@(None)" /> - <None Include="*.tiff" Exclude="@(None)" /> - <None Include="*.tif" Exclude="@(None)" /> - <None Include="*.png" Exclude="@(None)" /> - <None Include="*.rc2" Exclude="@(None)" /> - <None Include="*.def" Exclude="@(None)" /> - <None Include="*.bat" Exclude="@(None)" /> - <None Include="*.hpj" Exclude="@(None)" /> - <None Include="*.asmx" Exclude="@(None)" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters deleted file mode 100644 index b8d8d99c..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.vcxproj.Filters +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{8A1C843C-98CC-4F69-B2F3-AD990507C9D5}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{F3068B72-A501-44FC-AB1E-913B8B5984A6}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{8D00F678-494E-41F0-A5DE-EA33AD6C33CB}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{2AD6A4B1-015A-479D-AFD3-559B5E8D266E}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <None Include="USBMon-Bidi-Extension.xml"> - <Filter>Resource Files</Filter> - </None> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml deleted file mode 100644 index 5d98893c..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/USBMon-Bidi-Extension.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version='1.0'?> -<bidi:Schema xmlns:bidi="http://schemas.microsoft.com/windows/2010/09/printing/usbbidi"> - <Property name='Printer'> - <Property name='DeviceInfo'> - <Const name="Category" type="BIDI_STRING" value="DeviceCategory"/> - <Value name="QueueProperty" type="BIDI_STRING" accessType="Get" queryKey="Configuration" refreshInterval="60" drvPrinterEvent="true"/> - </Property> - <Property name='Configuration'> - <Property name='DuplexUnit'> - <Value name="Installed" type="BIDI_BOOL" accessType="Get" queryKey="Configuration" refreshInterval="60" drvPrinterEvent="true"/> - </Property> - <Property name='Memory'> - <Value name="Size" type="BIDI_INT" accessType="Get" queryKey="Configuration" refreshInterval="60" drvPrinterEvent="true"/> - </Property> - </Property> - <Property name="Extension"> - <Value name="ChangeableData" type="BIDI_INT" accessType="GetSet" drvPrinterEvent="false"/> - <Value name="DeviceAction" type="BIDI_BOOL" accessType="Set"/> - <Value name="IntegerValue" type="BIDI_INT" accessType="GetSet" queryKey="IntKey" drvPrinterEvent="true"/> - <Value name="StringValue" type="BIDI_STRING" accessType="Get" refreshInterval="15"/> - <Value name="StatusData" type="BIDI_INT" accessType="Get" queryKey="IntKey"/> - </Property> - </Property> -</bidi:Schema> diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js deleted file mode 100644 index bbbc31a0..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense-Windows8.1.js +++ /dev/null @@ -1,126 +0,0 @@ -/// <reference path="v4PrintDriver-Intellisense.js" /> - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaTicket, - { - GetParameterInitializer: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket2::GetParameterInitializer. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaParameterInitializer" /> - } - }); - -v4PrintDriverIntellisense.appendInterfaceMethods( - IPrintSchemaCapabilities, - { - GetParameterDefinition: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities2::GetParameterDefinition. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaParameterDefinition" /> - } - }); - -IPrintSchemaParameterInitializer = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterInitializer, - IPrintSchemaElement, - { - /// <field name="Value" type="String/Number"> - /// Property-get/set maps to COM IPrintSchemaParameterInitializer::Value. - /// </field> - Value: null, - }); - -IPrintSchemaParameterDefinition = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaParameterDefinition, - IPrintSchemaDisplayableElement, - { - /// <field name="UserInputRequired" type="Boolean"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::UserInputRequired. - /// </field> - UserInputRequired: null, - /// <field name="UnitType" type="String"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::UnitType. - /// </field> - UnitType: null, - /// <field name="DataType" type="PrintSchemaParameterDataType"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::DataType. - /// </field> - DataType: null, - /// <field name="RangeMin" type="Number"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMin. - /// </field> - RangeMin: null, - /// <field name="RangeMax" type="Number"> - /// Property-get maps to COM IPrintSchemaParameterDefinition::RangeMax. - /// </field> - RangeMax: null - }); - -IPrinterScriptUsbJobContextReturnCodes = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContextReturnCodes, - null, - { - /// <field name="Success" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Success. - /// </field> - Success: null, - /// <field name="Failure" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Failure. - /// </field> - Failure: null, - /// <field name="Retry" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::Retry. - /// </field> - Retry: null, - /// <field name="DeviceBusy" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::DeviceBusy. - /// </field> - DeviceBusy: null, - /// <field name="AbortTheJob" type="Number" integer="true"> - /// Property-get maps to COM IPrinterScriptUsbJobContextReturnCodes::AbortTheJob. - /// </field> - AbortTheJob: null - }); - -IPrinterScriptUsbWritePrintDataProgress = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbWritePrintDataProgress, - null, - { - /// <field name="ProcessedByteCount" type="Number"> - /// Property-get/set maps to COM IPrinterScriptUsbWritePrintDataProgress::ProcessedByteCount. - /// </field> - ProcessedByteCount: null - }); - -IPrinterScriptUsbJobContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptUsbJobContext, - null, - { - /// <field name="JobPropertyBag" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::JobPropertyBag. - /// </field> - JobPropertyBag: null, - /// <field name="ReturnCodes" type="IPrinterScriptUsbJobContextReturnCodes"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::ReturnCodes. - /// </field> - ReturnCodes: null, - /// <field name="TemporaryStreams" type="Array"> - /// Property-get maps to COM IPrinterScriptUsbJobContext::TemporaryStreams. Provides an array of IPrinterScriptableSequentialStream. - /// </field> - TemporaryStreams: null, - /// <field name="PrintedPageCount" type="Number"> - /// Property-get/set maps to COM IPrinterScriptUsbJobContext::PrintedPageCount. - /// </field> - PrintedPageCount: null - });
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js b/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js deleted file mode 100644 index 2386541d..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-USBMon-Bidi-Extension/v4PrintDriver-Intellisense.js +++ /dev/null @@ -1,513 +0,0 @@ -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved -// -// File Name: -// -// v4PrintDriver-Intellisense.js -// -// Abstract: -// -// This file defines intellisense to be used by JavaScript extensions in v4 print drivers. - -var v4PrintDriverIntellisense = { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - createInterface: function (childInterface, baseType, prototype) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - childInterface.__class = true; - - if (prototype) { - childInterface.prototype = prototype; - } - - if (baseType) { - childInterface.__baseType = baseType; - childInterface.__basePrototypePending = true; - v4PrintDriverIntellisense.resolveInheritance(childInterface); - } - }, - appendInterfaceMethods: function (baseType, prototype) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - for (var memberName in prototype) { - baseType.prototype[memberName] = prototype[memberName]; - } - }, - resolveInheritance: function (childInterface) { - /// <summary>Intended for use by v4 print driver JavaScript Intellisense.</summary> - var baseType = childInterface.__baseType; - if (!baseType) { - return; - } - - if (baseType.__baseType) { - resolveInheritance(baseType); - } - - if (!childInterface.__basePrototypePending) { - return; - } - - for (var memberName in baseType.prototype) { - var memberValue = baseType.prototype[memberName]; - if (!childInterface.prototype[memberName]) { - childInterface.prototype[memberName] = memberValue; - } - } - - delete childInterface.__basePrototypePending; - } -} - -IPrintSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaElement, - null, - { - /// <field name="XmlNode" type="XML DOM"> - /// Property-get maps to COM IPrintSchemaElement::XmlNode. - /// </field> - XmlNode: null, - /// <field name="Name" type="String"> - /// Property-get maps to COM IPrintSchemaElement::Name. - /// </field> - Name: null, - /// <field name="NamespaceUri" type="String"> - /// Property-get maps to COM IPrintSchemaElement::NamespaceUri. - /// </field> - NamespaceUri: null - }); - -IPrintSchemaDisplayableElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaDisplayableElement, - IPrintSchemaElement, - { - /// <field name="DisplayName" type="String"> - /// Property-get maps to COM IPrintSchemaDisplayableElement::DisplayName. - /// </field> - DisplayName: null - }); - - -IPrintSchemaOption = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOption, - IPrintSchemaDisplayableElement, - { - /// <field name="Selected" type="Boolean"> - /// Property-get maps to COM IPrintSchemaOption::Selected. - /// </field> - Selected: null, - /// <field name="Constrained" type="PrintSchemaConstrainedSetting"> - /// Property-get maps to COM IPrintSchemaOption::Constrained. - /// </field> - Constrained: null, - GetPropertyValue: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaOption::GetPropertyValue. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="XML DOM" /> - }, - /// <field name="PagesPerSheet" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaNUpOption::PagesPerSheet. Valid for NUp option only. - /// </field> - PagesPerSheet: null, - /// <field name="WidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::WidthInMicrons. Valid for PageMediaSize option only. - /// </field> - WidthInMicrons: null, - /// <field name="HeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageMediaSizeOption::HeightInMicrons. Valid for PageMediaSize option only. - /// </field> - HeightInMicrons: null - - }); - -IPrintSchemaOptionCollection = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaOptionCollection, - null, - { - /// <field name="Count" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaOptionCollection::Count. - /// </field> - Count: null, - GetAt: function (index) { - /// <summary> - /// Property-get maps to COM IPrintSchemaOptionCollection::GetAt. - /// </summary> - /// <param name="index" type="Number" integer="true" /> - /// <returns type="IPrintSchemaOption" /> - } - }); - - -IPrintSchemaFeature = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaFeature, - IPrintSchemaDisplayableElement, - { - /// <field name="SelectedOption" type="IPrintSchemaOption"> - /// Property-set/get maps to COM IPrintSchemaFeature::SelectedOption. - /// </field> - SelectedOption: null, - /// <field name="SelectionType" type="PrintSchemaSelectionType"> - /// Property-get maps to COM IPrintSchemaFeature::SelectionType. - /// </field> - SelectionType: null, - GetOption: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaFeature::GetOption. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaOption" /> - }, - /// <field name="DisplayUI" type="Boolean"> - /// Property-get maps to COM IPrintSchemaFeature::DisplayUI. - /// </field> - DisplayUI: null - }); - - -IPrintSchemaPageImageableSize = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaPageImageableSize, - IPrintSchemaElement, - { - /// <field name="ImageableSizeWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeWidthInMicrons. - /// </field> - ImageableSizeWidthInMicrons: null, - /// <field name="ImageableSizeHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ImageableSizeHeightInMicrons. - /// </field> - ImageableSizeHeightInMicrons: null, - /// <field name="OriginWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginWidthInMicrons. - /// </field> - OriginWidthInMicrons: null, - /// <field name="OriginHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::OriginHeightInMicrons. - /// </field> - OriginHeightInMicrons: null, - /// <field name="ExtentWidthInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentWidthInMicrons. - /// </field> - ExtentWidthInMicrons: null, - /// <field name="ExtentHeightInMicrons" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaPageImageableSize::ExtentHeightInMicrons. - /// </field> - ExtentHeightInMicrons: null - }); - - -IPrintSchemaCapabilities = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaCapabilities, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetFeatureByKeyName. - /// </summary> - /// <param name="keyName" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - GetFeature: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetFeature. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - /// <field name="PageImageableSize" type="IPrintSchemaPageImageableSize"> - /// Property-get maps to COM IPrintSchemaCapabilities::PageImageableSize. - /// </field> - PageImageableSize: null, - /// <field name="JobCopiesAllDocumentsMinValue" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMinValue. - /// </field> - JobCopiesAllDocumentsMinValue: null, - /// <field name="JobCopiesAllDocumentsMaxValue" type="Number" integer="true"> - /// Property-get maps to COM IPrintSchemaCapabilities::JobCopiesAllDocumentsMaxValue. - /// </field> - JobCopiesAllDocumentsMaxValue: null, - GetSelectedOptionInPrintTicket: function (feature) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetSelectedOptionInPrintTicket. - /// </summary> - /// <param name="feature" type="IPrintSchemaFeature" /> - /// <returns type="IPrintSchemaOption" /> - }, - GetOptions: function (feature) { - /// <summary> - /// Method maps to COM IPrintSchemaCapabilities::GetOptions. - /// </summary> - /// <param name="feature" type="IPrintSchemaFeature" /> - /// <returns type="IPrintSchemaOptionCollection" /> - } - }); - - -IPrintSchemaTicket = function () { } -v4PrintDriverIntellisense.createInterface( - IPrintSchemaTicket, - IPrintSchemaElement, - { - GetFeatureByKeyName: function (keyName) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetFeatureByKeyName. - /// </summary> - /// <param name="keyName" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - GetFeature: function (name, namespaceUri) { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetFeature. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="namespaceUri" type="String" /> - /// <returns type="IPrintSchemaFeature" /> - }, - NotifyXmlChanged: function () { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::NotifyXmlChanged. - /// </summary> - }, - GetCapabilities: function () { - /// <summary> - /// Method maps to COM IPrintSchemaTicket::GetCapabilities. - /// </summary> - /// <returns type="IPrintSchemaCapabilities" /> - }, - /// <field name="JobCopiesAllDocuments" type="Number" integer="true"> - /// Property-get/put maps to IPrintSchemaTicket::JobCopiesAllDocuments. - /// </field> - JobCopiesAllDocuments: null - }); - - -IPrinterScriptableSequentialStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableSequentialStream, - null, - { - Read: function (count) { - /// <summary> - /// Method maps to COM IPrinterScriptableSequentialStream::Read. - /// </summary> - /// <param name="count" type="Number" integer="true" /> - /// <returns type="Array" /> - }, - Write: function (array) { - /// <summary> - /// Method maps to COM IPrinterScriptableSequentialStream::Write. - /// </summary> - /// <param name="array" type="Array" /> - /// <returns type="Number" integer="true"/> - } - }); - -IPrinterScriptableStream = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptableStream, - IPrinterScriptableSequentialStream, - { - Commit: function () { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::Commit. - /// </summary> - }, - Seek: function (offset, streamSeek) { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::Seek - /// </summary> - /// <param name="offset" type="Number" integer="true" /> - /// <param name="streamSeek" type="STREAM_SEEK" /> - /// <returns type="Number" integer="true"/> - }, - SetSize: function (size) { - /// <summary> - /// Method maps to COM IPrinterScriptableStream::SetSize. - /// </summary> - /// <param name="size" type="Number" integer="true" /> - } - }); - - -IPrinterScriptablePropertyBag = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptablePropertyBag, - null, - { - GetBool: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetBool. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="Boolean" /> - }, - SetBool: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetBool. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="Boolean" /> - }, - GetInt32: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetInt32. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="Number" integer="true"/> - }, - SetInt32: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetInt32. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="Number" integer="true" /> - }, - GetString: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetString. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="String" /> - }, - SetString: function (name, value) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::SetString. - /// </summary> - /// <param name="name" type="String" /> - /// <param name="value" type="String" /> - }, - GetReadStream: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetReadStream. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="IPrinterScriptableStream" /> - }, - GetWriteStream: function (name) { - /// <summary> - /// Method maps to COM IPrinterScriptablePropertyBag::GetWriteStream. - /// </summary> - /// <param name="name" type="String" /> - /// <returns type="IPrinterScriptableStream" /> - } - }); - - -IPrinterScriptContext = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterScriptContext, - null, - { - /// <field name="DriverProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::DriverProperties. - /// </field> - DriverProperties: null, - /// <field name="QueueProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::QueueProperties. - /// </field> - QueueProperties: null, - /// <field name="UserProperties" type="IPrinterScriptablePropertyBag"> - /// Property-get maps to COM IPrinterScriptContext::UserProperties. - /// </field> - UserProperties: null - }); - -IPrinterBidiSchemaElement = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaElement, - null, - { - /// <field name="Name" type="String"> - /// Property-get maps to COM IPrinterBidiSchemaElement::Name. - /// </field> - Name: null, - /// <field type="PrinterBidiSchemaElementType"> - /// Property-get maps to COM IPrinterBidiSchemaElement::BidiType. - /// </field> - BidiType: null, - /// <field type="Object"> - /// Property-get maps to COM IPrinterBidiSchemaElement::Value. - /// </field> - Value: null - }); - -IPrinterBidiSchemaResponses = function () { } -v4PrintDriverIntellisense.createInterface( - IPrinterBidiSchemaResponses, - null, - { - AddNull: function (schema) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddNull. - /// </summary> - /// <param name="schema" type="String" /> - }, - AddString: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddString. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddText: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddText. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddEnum: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddEnum. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="String" /> - }, - AddInt32: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddInt32. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Number" integer="true" /> - }, - AddBool: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddBool. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Boolean" /> - }, - AddFloat: function (schema, value) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddFloat. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="value" type="Number" /> - }, - AddBlob: function (schema, array) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddBlob. - /// </summary> - /// <param name="schema" type="String" /> - /// <param name="array" type="Array" /> - }, - AddRequeryKey: function (queryKey) { - /// <summary> - /// Method maps to COM IPrinterBidiSchemaResponses::AddRequeryKey. - /// </summary> - /// <param name="queryKey" type="String" /> - } - }); diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md deleted file mode 100644 index a7ed3f9f..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/README.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to use an XML extension file to support bidirectional (Bidi) communication with a WSD connected printer." -languages: -- xml -products: -- windows -- windows-wdk ---- - -# WSDMon Bidi Extension Sample - -This sample demonstrates how to use an XML extension file to support bidirectional (Bidi) communication with a WSD connected printer. - -The v4 print driver model continues to employ the WSDMon Bidi Extension file format, as well as the SNMP Bidi Extension file format. - -> [!NOTE] -> Third-party port monitors and language monitors are not supported in the v4 driver model or with print class drivers. - -The WSDMON port monitor is a printer port monitor that supports printing to network printers that comply with the Web Services for Devices (WSD) technology. The WSDMON port monitor listens for WSD events and updates the printer status accordingly. - -A Bidi schema is a hierarchy of printer attributes, some of which are properties and others that are values (or value entries). - -A *property* is a node in the schema hierarchy. A property can have one or more children, and these children can be other properties or values. - -A *value* is a leaf in the schema hierarchy that represents either a single data item or a list of related data items. A value has a name, a data type, and a data value. A value cannot have child elements. - -The WSDMON port monitor can: - -- Discover network printers and install them. - -- Send jobs to WSD printers. - -- Monitor the status and configuration of the WSD printers and update the printer object status accordingly. - -- Respond to bidirectional (bidi) queries for supported bidi schemas. - -- Monitor bidi Schema value changes and send notifications. - -WSDMON supports the following Xcv commands: - -- CleanupPort - -- DeviceID - -- PnPXID - -- ResetCommunication - -- ServiceID - -> [!NOTE] -> This sample is for the v4 print driver model. - -For more information, see [v4 Driver Connectivity Architecture](https://docs.microsoft.com/windows-hardware/drivers/print/v4-driver-connectivity-architecture) and [Bidirectional Communication Schema](https://docs.microsoft.com/windows-hardware/drivers/print/bidirectional-communication-schema). diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln deleted file mode 100644 index 2e8d1d08..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WSDMon-Bidi-Extension", "WSDMon-Bidi-Extension.vcxproj", "{F7531C4D-8172-499C-A273-601A99F93A4D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - Debug|ARM64 = Debug|ARM64 - Release|ARM64 = Release|ARM64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F7531C4D-8172-499C-A273-601A99F93A4D}.Debug|Win32.ActiveCfg = Debug|Win32 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Debug|Win32.Build.0 = Debug|Win32 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Release|Win32.ActiveCfg = Release|Win32 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Release|Win32.Build.0 = Release|Win32 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Debug|x64.ActiveCfg = Debug|x64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Debug|x64.Build.0 = Debug|x64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Release|x64.ActiveCfg = Release|x64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Release|x64.Build.0 = Release|x64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Debug|ARM64.Build.0 = Debug|ARM64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Release|ARM64.ActiveCfg = Release|ARM64 - {F7531C4D-8172-499C-A273-601A99F93A4D}.Release|ARM64.Build.0 = Release|ARM64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj deleted file mode 100644 index f9005b00..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj +++ /dev/null @@ -1,203 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|ARM64"> - <Configuration>Debug</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|ARM64"> - <Configuration>Release</Configuration> - <Platform>ARM64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{F7531C4D-8172-499C-A273-601A99F93A4D}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <SupportsPackaging>false</SupportsPackaging> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{86BA9C29-EA05-453A-9483-C0AFC4BFA628}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>None</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Utility</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>WSDMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>WSDMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>WSDMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>WSDMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <TargetName>WSDMon-Bidi-Extension</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <TargetName>WSDMon-Bidi-Extension</TargetName> - </PropertyGroup> - <ItemGroup> - <None Include="WSDMon-Bidi-Extension.xml" /> - </ItemGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> - <ClCompile> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Include="*.txt" Exclude="@(None)" /> - <None Include="*.htm" Exclude="@(None)" /> - <None Include="*.html" Exclude="@(None)" /> - <None Include="*.ico" Exclude="@(None)" /> - <None Include="*.cur" Exclude="@(None)" /> - <None Include="*.bmp" Exclude="@(None)" /> - <None Include="*.dlg" Exclude="@(None)" /> - <None Include="*.rct" Exclude="@(None)" /> - <None Include="*.gif" Exclude="@(None)" /> - <None Include="*.jpg" Exclude="@(None)" /> - <None Include="*.jpeg" Exclude="@(None)" /> - <None Include="*.wav" Exclude="@(None)" /> - <None Include="*.jpe" Exclude="@(None)" /> - <None Include="*.tiff" Exclude="@(None)" /> - <None Include="*.tif" Exclude="@(None)" /> - <None Include="*.png" Exclude="@(None)" /> - <None Include="*.rc2" Exclude="@(None)" /> - <None Include="*.def" Exclude="@(None)" /> - <None Include="*.bat" Exclude="@(None)" /> - <None Include="*.hpj" Exclude="@(None)" /> - <None Include="*.asmx" Exclude="@(None)" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters deleted file mode 100644 index bed3d209..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.vcxproj.Filters +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{5E0A294E-9F84-40AF-B061-2325C7C51099}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{19369659-737D-42C4-BA02-F9339F90E059}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{956B4D90-3EC3-4A60-B313-9F222A0EFC87}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{EF468EE7-3C0B-4A91-B9F6-DA749B6F0C5E}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <None Include="WSDMon-Bidi-Extension.xml"> - <Filter>Resource Files</Filter> - </None> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml b/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml deleted file mode 100644 index 1fa1bacd..00000000 --- a/print/v4PrintDriverSamples/v4PrintDriver-WSDMon-Bidi-Extension/WSDMon-Bidi-Extension.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version='1.0'?> -<bidi:Definition xmlns:bidi='http://schemas.microsoft.com/windows/2005/03/printing/bidi'> - <!-- - The schema extension below represents a fictitious printer named 'CustomPrinter', and contains further schema - extensions for a fictitious lamination unit. - --> - <Schema xmlns:cp='http://www.microsoft.com/2013/04/customwsdprinter' xmlns:wprt='http://schemas.microsoft.com/windows/2006/08/wdp/print'> - <Property name='CustomPrinter'> - <!-- - The schema extensions below represent a fictitious lamination unit that may be installed on the CustomPrinter. - The extensions demonstrate various Bidi constructs and operations. - --> - <Property name='LaminationUnit'> - <!-- - Example of an 'Installed' construct: - The 'Installed' construct is used to query if a printer feature is installed. - - In the below example, the 'Installed' construct queries the device to determine if a lamination - unit is installed. - --> - <Installed name='Installed' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:Extensions[cp:Name="LaminationUnit"]' drvPrinterEvent='true' /> - - <!-- - Example of a schema element that is read-only i.e. it's value can be retrieved via a Bidi 'Get' action. - The 'Value' construct represents a query that retrieves data for the specified schema element. - - In the below example, the read-only 'pouch level' property is analogous to the ink level, - and queries the number of lamination pouches remaining on the device --> - <Value name='PouchLevel' type='BIDI_INT' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:PouchLevel' drvPrinterEvent='true'/> - - <!-- - Example of schema element that is write-only i.e. it's value can be set via a Bidi 'Set' action. - The 'accessType' attribute indicates that the schema element's value can be set. - - In the below example, the \CustomPrinter.Maintenance:Clean schema provides a way to clean the lamination unit. - - Note: The Bidi 'Set' action is defined in WS Print v1.2, which must be supported by the device - before this operation can complete successfully. - --> - <Property name='Maintenance'> - <Value name='Clean' type='BIDI_BOOL' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:Clean' drvPrinterEvent='true' accessType='Set' wsPrintVersion='1.2' /> - </Property> - - <!-- - Example of schema element that is read-write i.e. it's value can be retrieved via a Bidi 'Get' action, - or can be set via a Bidi 'Set' action. - The 'accessType' attribute indicates that the schema element's value can be either retrieved or set. - - In the below example, the \CustomPrinter.LaminationUnit.NumberPouchesUsed property defines how - many pouches are used per lamination job. - - Note: The Bidi 'Set' action is defined in WS Print v1.2, which must be supported by the device - before this operation can complete successfully. - --> - <Value name='NumberPouchesUsed' type='BIDI_INT' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:NumberPouchesUsed' drvPrinterEvent='true' accessType='GetSet' wsPrintVersion='1.2' /> - - <!-- - Example of a 'List' construct: - This construct represents a string type that comprises a comma-separated list of values. - - In the below example, the query would result in a comma-separated list that contains the types - of lamination pouches supported. - --> - <List name='SupportedPouchTypes' query='cp:CustomPrinterConfiguration' filter='cp:CustomPrinterConfiguration/cp:LaminationUnit/cp:SupportedPouchTypes'/> - - <!-- - Example of a 'Const' construct: - This construct is used for elements that don't change in value. - The construct defines the data type and the value that must be returned. - - In the below example, the constant value 'Type' is set to 'ThermalLaminator', - identifying the type of the lamination unit. It is presumed that this is the - only type of unit supported by this driver, hence it is a constant value. - --> - <Const name='Type' type='BIDI_STRING'>ThermalLaminator</Const> - </Property> - </Property> - </Schema> -</bidi:Definition>
\ No newline at end of file |
