diff --git a/767.html b/767.html new file mode 100644 index 0000000..6f33787 --- /dev/null +++ b/767.html @@ -0,0 +1,21 @@ +Part One An Overview of Section 508 Accessibility
+Chapter 1: What Is Section 508 Accessibility?
+Chapter 2: Understanding the Section 508 Requirements
+Chapter 3: Hardware, Resources, and Training
+Chapter 4: Developer Guidelines That Make Sense
+Part Two Writing Accessible Desktop Applications
+Chapter 5: Desktop Application Essentials
+Chapter 6: Using Microsoft Active Accessibility
+Chapter 7: Adding Usage Cues to Desktop Applications
+Chapter 8: Developing Special Desktop Application Capabilities
+Part Three Writing Accessible Web Applications
+Chapter 9: Web Site Essentials
+Chapter 10: Designing Easily Maintained Web Sites
+Chapter 11: Adding Usage Cues to Web Applications
+Chapter 12: Developing Special Web Application Capabilities
+Chapter 13: Accessible Scripting Solutions
+Part Four Glossary and Appendixes
+Glossary
+Appendix A: 52 Tips for Creating Accessible Applications
+Appendix B: Six Best Web Sites for Accessibility Ideas
+Appendix C: Helpful Organizations and Agencies \ No newline at end of file diff --git a/814.pdf b/814.pdf new file mode 100644 index 0000000..cb05539 Binary files /dev/null and b/814.pdf differ diff --git a/816.pdf b/816.pdf new file mode 100644 index 0000000..d2e0cee Binary files /dev/null and b/816.pdf differ diff --git a/9781590590867.jpg b/9781590590867.jpg new file mode 100644 index 0000000..8a6e74a Binary files /dev/null and b/9781590590867.jpg differ diff --git a/Chapter 03/C#/CheckHID/App.ico b/Chapter 03/C#/CheckHID/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 03/C#/CheckHID/App.ico differ diff --git a/Chapter 03/C#/CheckHID/AssemblyInfo.cs b/Chapter 03/C#/CheckHID/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 03/C#/CheckHID/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 03/C#/CheckHID/CheckHID.csproj b/Chapter 03/C#/CheckHID/CheckHID.csproj new file mode 100644 index 0000000..39ae62b --- /dev/null +++ b/Chapter 03/C#/CheckHID/CheckHID.csproj @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 03/C#/CheckHID/CheckHID.csproj.user b/Chapter 03/C#/CheckHID/CheckHID.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 03/C#/CheckHID/CheckHID.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 03/C#/CheckHID/CheckHID.sln b/Chapter 03/C#/CheckHID/CheckHID.sln new file mode 100644 index 0000000..936db44 --- /dev/null +++ b/Chapter 03/C#/CheckHID/CheckHID.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckHID", "CheckHID.csproj", "{E4AF0A9D-83FF-4957-B4ED-430C0573CE39}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E4AF0A9D-83FF-4957-B4ED-430C0573CE39}.Debug.ActiveCfg = Debug|.NET + {E4AF0A9D-83FF-4957-B4ED-430C0573CE39}.Debug.Build.0 = Debug|.NET + {E4AF0A9D-83FF-4957-B4ED-430C0573CE39}.Release.ActiveCfg = Release|.NET + {E4AF0A9D-83FF-4957-B4ED-430C0573CE39}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 03/C#/CheckHID/CheckHID.suo b/Chapter 03/C#/CheckHID/CheckHID.suo new file mode 100644 index 0000000..cd8ae5b Binary files /dev/null and b/Chapter 03/C#/CheckHID/CheckHID.suo differ diff --git a/Chapter 03/C#/CheckHID/FrmMain.cs b/Chapter 03/C#/CheckHID/FrmMain.cs new file mode 100644 index 0000000..1156264 --- /dev/null +++ b/Chapter 03/C#/CheckHID/FrmMain.cs @@ -0,0 +1,169 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using DxVBLibA; + +namespace CheckHID +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + internal System.Windows.Forms.Button btnTest; + internal System.Windows.Forms.Button btnQuit; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // btnTest + // + this.btnTest.Location = new System.Drawing.Point(208, 40); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 3; + this.btnTest.Text = "Test"; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.Location = new System.Drawing.Point(208, 8); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 2; + this.btnQuit.Text = "Quit"; + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // frmMain + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "Display HID Status"; + this.Closing += new System.ComponentModel.CancelEventHandler(this.frmMain_Closing); + this.Load += new System.EventHandler(this.frmMain_Load); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + //DirectX objects. + private DirectX8 DX8; //DirectX 8 Object + private DirectInput8 DI8; //DirectInput 8 Object + private DirectInputDeviceInstance8 DIDI8; //DirectInput 8 Device + + private void frmMain_Load(object sender, System.EventArgs e) + { + //Initialize the DirectX objects. + DX8 = new DirectX8Class(); + DI8 = DX8.DirectInputCreate(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + //Make sure the DirectInput 8 Device Instance is empty. + if (DIDI8 != null) + DIDI8 = null; + + //Get the device information. + CreateInputDeviceInstance("Mouse"); + + //Display the status information. + if ((DIDI8.GetDevType() & (UInt32)CONST_DI8DEVICESUBTYPE.DIDEVTYPE_HID) + == (UInt32)CONST_DI8DEVICESUBTYPE.DIDEVTYPE_HID) + MessageBox.Show("Mouse is a HID"); + else + MessageBox.Show("Mouse is not a HID"); + } + + private void CreateInputDeviceInstance(String DeviceName) + { + DirectInputEnumDevices8 Devs; //DirectInput device enumeration. + DirectInputDeviceInstance8 DevInst; //A single device instance. + Int32 Counter; //Loop counter + + //Create a list of devices for this machine. + Devs = DI8.GetDIDevices(CONST_DI8DEVICETYPE.DI8DEVCLASS_ALL, + CONST_DIENUMDEVICESFLAGS.DIEDFL_ATTACHEDONLY); + + //Search for the correct GUID. Remember to start the + //Counter at 1 for VB. + for (Counter = 1; Counter <= Devs.GetCount(); Counter++) + { + //Get a device instance. + DevInst = Devs.GetItem(Counter); + + if (DevInst.GetProductName().ToUpper() == DeviceName.ToUpper()) + { + DIDI8 = DevInst; + break; + } + } + } + + private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + // Clean up the objects. + DIDI8 = null; + DI8 = null; + DX8 = null; + } + } +} diff --git a/Chapter 03/C#/CheckHID/FrmMain.resx b/Chapter 03/C#/CheckHID/FrmMain.resx new file mode 100644 index 0000000..346c008 --- /dev/null +++ b/Chapter 03/C#/CheckHID/FrmMain.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Assembly + + + False + + + Private + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 03/C#/CheckHID/bin/Debug/CheckHID.exe b/Chapter 03/C#/CheckHID/bin/Debug/CheckHID.exe new file mode 100644 index 0000000..525662e Binary files /dev/null and b/Chapter 03/C#/CheckHID/bin/Debug/CheckHID.exe differ diff --git a/Chapter 03/C#/CheckHID/bin/Debug/Interop.DxVBLibA.dll b/Chapter 03/C#/CheckHID/bin/Debug/Interop.DxVBLibA.dll new file mode 100644 index 0000000..c1da79c Binary files /dev/null and b/Chapter 03/C#/CheckHID/bin/Debug/Interop.DxVBLibA.dll differ diff --git a/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.exe b/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.exe new file mode 100644 index 0000000..525662e Binary files /dev/null and b/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.exe differ diff --git a/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.frmMain.resources b/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.frmMain.resources new file mode 100644 index 0000000..f8cb80a Binary files /dev/null and b/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.frmMain.resources differ diff --git a/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.projdata b/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.projdata new file mode 100644 index 0000000..a88a0f0 Binary files /dev/null and b/Chapter 03/C#/CheckHID/obj/Debug/CheckHID.projdata differ diff --git a/Chapter 03/C#/CheckHID/obj/Interop.DxVBLibA.dll b/Chapter 03/C#/CheckHID/obj/Interop.DxVBLibA.dll new file mode 100644 index 0000000..c1da79c Binary files /dev/null and b/Chapter 03/C#/CheckHID/obj/Interop.DxVBLibA.dll differ diff --git a/Chapter 03/C#/DriverHID/App.ico b/Chapter 03/C#/DriverHID/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 03/C#/DriverHID/App.ico differ diff --git a/Chapter 03/C#/DriverHID/AssemblyInfo.cs b/Chapter 03/C#/DriverHID/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 03/C#/DriverHID/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 03/C#/DriverHID/DriverHID.csproj b/Chapter 03/C#/DriverHID/DriverHID.csproj new file mode 100644 index 0000000..251ef1d --- /dev/null +++ b/Chapter 03/C#/DriverHID/DriverHID.csproj @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 03/C#/DriverHID/DriverHID.csproj.user b/Chapter 03/C#/DriverHID/DriverHID.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 03/C#/DriverHID/DriverHID.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 03/C#/DriverHID/DriverHID.sln b/Chapter 03/C#/DriverHID/DriverHID.sln new file mode 100644 index 0000000..911bc76 --- /dev/null +++ b/Chapter 03/C#/DriverHID/DriverHID.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DriverHID", "DriverHID.csproj", "{13E0AF4D-F286-402D-9AFC-D569EB425EC6}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {13E0AF4D-F286-402D-9AFC-D569EB425EC6}.Debug.ActiveCfg = Debug|.NET + {13E0AF4D-F286-402D-9AFC-D569EB425EC6}.Debug.Build.0 = Debug|.NET + {13E0AF4D-F286-402D-9AFC-D569EB425EC6}.Release.ActiveCfg = Release|.NET + {13E0AF4D-F286-402D-9AFC-D569EB425EC6}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 03/C#/DriverHID/DriverHID.suo b/Chapter 03/C#/DriverHID/DriverHID.suo new file mode 100644 index 0000000..6d98136 Binary files /dev/null and b/Chapter 03/C#/DriverHID/DriverHID.suo differ diff --git a/Chapter 03/C#/DriverHID/FrmMain.cs b/Chapter 03/C#/DriverHID/FrmMain.cs new file mode 100644 index 0000000..73bc8ef --- /dev/null +++ b/Chapter 03/C#/DriverHID/FrmMain.cs @@ -0,0 +1,121 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Runtime.InteropServices; + +namespace DriverHID +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + internal System.Windows.Forms.Button btnTest; + internal System.Windows.Forms.Button btnQuit; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // btnTest + // + this.btnTest.Location = new System.Drawing.Point(208, 40); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 3; + this.btnTest.Text = "Test"; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.Location = new System.Drawing.Point(208, 8); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 2; + this.btnQuit.Text = "Quit"; + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // frmMain + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "Checking HIDs Using a Driver"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + // This function obtains the GUID of the top level HID devices. + [DllImport("HID.DLL", CharSet=CharSet.Auto, SetLastError=true)] + public static extern void HidD_GetHidGuid(out Guid HidGuid); + + private void btnTest_Click(object sender, System.EventArgs e) + { + Guid HidGuid; // The top level GUID + + //Get the HID GUID and display it. + HidD_GetHidGuid(out HidGuid); + MessageBox.Show("The HID GUID is: " + HidGuid.ToString(), + "Application Output", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } +} diff --git a/Chapter 03/C#/DriverHID/FrmMain.resx b/Chapter 03/C#/DriverHID/FrmMain.resx new file mode 100644 index 0000000..e7fde16 --- /dev/null +++ b/Chapter 03/C#/DriverHID/FrmMain.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Assembly + + + False + + + Private + + + Assembly + + + False + + + (Default) + + + False + + + frmMain + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 03/C#/DriverHID/bin/Debug/DriverHID.exe b/Chapter 03/C#/DriverHID/bin/Debug/DriverHID.exe new file mode 100644 index 0000000..98bae80 Binary files /dev/null and b/Chapter 03/C#/DriverHID/bin/Debug/DriverHID.exe differ diff --git a/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.exe b/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.exe new file mode 100644 index 0000000..98bae80 Binary files /dev/null and b/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.exe differ diff --git a/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.frmMain.resources b/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.frmMain.resources new file mode 100644 index 0000000..f8cb80a Binary files /dev/null and b/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.frmMain.resources differ diff --git a/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.projdata b/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.projdata new file mode 100644 index 0000000..320e19a Binary files /dev/null and b/Chapter 03/C#/DriverHID/obj/Debug/DriverHID.projdata differ diff --git a/Chapter 03/VB/CheckHID/AssemblyInfo.vb b/Chapter 03/VB/CheckHID/AssemblyInfo.vb new file mode 100644 index 0000000..8f8968c --- /dev/null +++ b/Chapter 03/VB/CheckHID/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 03/VB/CheckHID/CheckHID.sln b/Chapter 03/VB/CheckHID/CheckHID.sln new file mode 100644 index 0000000..c4c27f1 --- /dev/null +++ b/Chapter 03/VB/CheckHID/CheckHID.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CheckHID", "CheckHID.vbproj", "{F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Debug.ActiveCfg = Debug|.NET + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Debug.Build.0 = Debug|.NET + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Release.ActiveCfg = Release|.NET + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 03/VB/CheckHID/CheckHID.sln.old b/Chapter 03/VB/CheckHID/CheckHID.sln.old new file mode 100644 index 0000000..98ae7ef --- /dev/null +++ b/Chapter 03/VB/CheckHID/CheckHID.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CheckHID", "CheckHID.vbproj", "{F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Debug.ActiveCfg = Debug|.NET + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Debug.Build.0 = Debug|.NET + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Release.ActiveCfg = Release|.NET + {F7BC7FA9-F6BE-4996-BE5A-D07D6727A787}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 03/VB/CheckHID/CheckHID.suo b/Chapter 03/VB/CheckHID/CheckHID.suo new file mode 100644 index 0000000..9fba909 Binary files /dev/null and b/Chapter 03/VB/CheckHID/CheckHID.suo differ diff --git a/Chapter 03/VB/CheckHID/CheckHID.vbproj b/Chapter 03/VB/CheckHID/CheckHID.vbproj new file mode 100644 index 0000000..9701515 --- /dev/null +++ b/Chapter 03/VB/CheckHID/CheckHID.vbproj @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 03/VB/CheckHID/CheckHID.vbproj.user b/Chapter 03/VB/CheckHID/CheckHID.vbproj.user new file mode 100644 index 0000000..bdc8235 --- /dev/null +++ b/Chapter 03/VB/CheckHID/CheckHID.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 03/VB/CheckHID/FrmMain.resx b/Chapter 03/VB/CheckHID/FrmMain.resx new file mode 100644 index 0000000..c2a837d --- /dev/null +++ b/Chapter 03/VB/CheckHID/FrmMain.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + frmMain + + \ No newline at end of file diff --git a/Chapter 03/VB/CheckHID/FrmMain.vb b/Chapter 03/VB/CheckHID/FrmMain.vb new file mode 100644 index 0000000..78c2f87 --- /dev/null +++ b/Chapter 03/VB/CheckHID/FrmMain.vb @@ -0,0 +1,135 @@ +Imports DxVBLibA +Imports System.IO +Imports System.Text + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents btnTest As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.btnQuit = New System.Windows.Forms.Button() + Me.btnTest = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'btnQuit + ' + Me.btnQuit.Location = New System.Drawing.Point(208, 8) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 0 + Me.btnQuit.Text = "Quit" + ' + 'btnTest + ' + Me.btnTest.Location = New System.Drawing.Point(208, 40) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 1 + Me.btnTest.Text = "Test" + ' + 'frmMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnTest, Me.btnQuit}) + Me.Name = "frmMain" + Me.Text = "Display HID Status" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application + End + End Sub + + 'DirectX objects. + Private DX8 As DirectX8 'DirectX 8 Object + Private DI8 As DirectInput8 'DirectInput 8 Object + Private DIDI8 As DirectInputDeviceInstance8 'DirectInput 8 Device + + Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) + 'Initialize the DirectX objects. + DX8 = New DirectX8Class() + DI8 = DX8.DirectInputCreate() + + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles btnTest.Click + 'Make sure the DirectInput 8 Device Instance is empty. + If (DIDI8 Is Nothing) Then + DIDI8 = Nothing + End If + + 'Get the device information. + CreateInputDeviceInstance("Mouse") + + 'Display the status information. + If ((DIDI8.GetDevType() And CONST_DI8DEVICESUBTYPE.DIDEVTYPE_HID) _ + = CONST_DI8DEVICESUBTYPE.DIDEVTYPE_HID) Then + MessageBox.Show("Mouse is a HID") + Else + MessageBox.Show("Mouse is not a HID") + End If + End Sub + + Private Sub CreateInputDeviceInstance(ByVal DeviceName As String) + Dim Devs As DirectInputEnumDevices8 'DirectInput device enumeration. + Dim DevInst As DirectInputDeviceInstance8 'A single device instance. + Dim Counter As Integer 'Loop counter + + 'Create a list of devices for this machine. + Devs = DI8.GetDIDevices(CONST_DI8DEVICETYPE.DI8DEVCLASS_ALL, _ + CONST_DIENUMDEVICESFLAGS.DIEDFL_ATTACHEDONLY) + + 'Search for the correct GUID. Remember to start the + 'Counter at 1 for VB. + For Counter = 1 To Devs.GetCount() + 'Get a device instance. + DevInst = Devs.GetItem(Counter) + + If (DevInst.GetProductName().ToUpper() = DeviceName.ToUpper()) Then + DIDI8 = DevInst + Exit For + End If + Next + End Sub + + Protected Overrides Sub OnClosing( _ + ByVal e As System.ComponentModel.CancelEventArgs) + 'Clean up the objects. + DIDI8 = Nothing + DI8 = Nothing + DX8 = Nothing + End Sub +End Class diff --git a/Chapter 03/VB/CheckHID/bin/CheckHID.exe b/Chapter 03/VB/CheckHID/bin/CheckHID.exe new file mode 100644 index 0000000..6e7709b Binary files /dev/null and b/Chapter 03/VB/CheckHID/bin/CheckHID.exe differ diff --git a/Chapter 03/VB/CheckHID/bin/Interop.DxVBLibA.dll b/Chapter 03/VB/CheckHID/bin/Interop.DxVBLibA.dll new file mode 100644 index 0000000..b2c08bc Binary files /dev/null and b/Chapter 03/VB/CheckHID/bin/Interop.DxVBLibA.dll differ diff --git a/Chapter 03/VB/CheckHID/obj/Debug/CheckHID.exe b/Chapter 03/VB/CheckHID/obj/Debug/CheckHID.exe new file mode 100644 index 0000000..6e7709b Binary files /dev/null and b/Chapter 03/VB/CheckHID/obj/Debug/CheckHID.exe differ diff --git a/Chapter 03/VB/CheckHID/obj/Debug/CheckHID.frmMain.resources b/Chapter 03/VB/CheckHID/obj/Debug/CheckHID.frmMain.resources new file mode 100644 index 0000000..4a6704d Binary files /dev/null and b/Chapter 03/VB/CheckHID/obj/Debug/CheckHID.frmMain.resources differ diff --git a/Chapter 03/VB/CheckHID/obj/Interop.DxVBLibA.dll b/Chapter 03/VB/CheckHID/obj/Interop.DxVBLibA.dll new file mode 100644 index 0000000..b2c08bc Binary files /dev/null and b/Chapter 03/VB/CheckHID/obj/Interop.DxVBLibA.dll differ diff --git a/Chapter 03/VB/DriverHID/AssemblyInfo.vb b/Chapter 03/VB/DriverHID/AssemblyInfo.vb new file mode 100644 index 0000000..5baa307 --- /dev/null +++ b/Chapter 03/VB/DriverHID/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 03/VB/DriverHID/DriverHID.sln b/Chapter 03/VB/DriverHID/DriverHID.sln new file mode 100644 index 0000000..d3d08b0 --- /dev/null +++ b/Chapter 03/VB/DriverHID/DriverHID.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DriverHID", "DriverHID.vbproj", "{14E6090B-7526-4029-B9F1-DBC38E75CD56}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Debug.ActiveCfg = Debug|.NET + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Debug.Build.0 = Debug|.NET + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Release.ActiveCfg = Release|.NET + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 03/VB/DriverHID/DriverHID.sln.old b/Chapter 03/VB/DriverHID/DriverHID.sln.old new file mode 100644 index 0000000..7821c7f --- /dev/null +++ b/Chapter 03/VB/DriverHID/DriverHID.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DriverHID", "DriverHID.vbproj", "{14E6090B-7526-4029-B9F1-DBC38E75CD56}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Debug.ActiveCfg = Debug|.NET + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Debug.Build.0 = Debug|.NET + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Release.ActiveCfg = Release|.NET + {14E6090B-7526-4029-B9F1-DBC38E75CD56}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 03/VB/DriverHID/DriverHID.suo b/Chapter 03/VB/DriverHID/DriverHID.suo new file mode 100644 index 0000000..d64aa5c Binary files /dev/null and b/Chapter 03/VB/DriverHID/DriverHID.suo differ diff --git a/Chapter 03/VB/DriverHID/DriverHID.vbproj b/Chapter 03/VB/DriverHID/DriverHID.vbproj new file mode 100644 index 0000000..f1618b3 --- /dev/null +++ b/Chapter 03/VB/DriverHID/DriverHID.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 03/VB/DriverHID/DriverHID.vbproj.user b/Chapter 03/VB/DriverHID/DriverHID.vbproj.user new file mode 100644 index 0000000..8f26536 --- /dev/null +++ b/Chapter 03/VB/DriverHID/DriverHID.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 03/VB/DriverHID/bin/DriverHID.exe b/Chapter 03/VB/DriverHID/bin/DriverHID.exe new file mode 100644 index 0000000..a539117 Binary files /dev/null and b/Chapter 03/VB/DriverHID/bin/DriverHID.exe differ diff --git a/Chapter 03/VB/DriverHID/frmMain.resx b/Chapter 03/VB/DriverHID/frmMain.resx new file mode 100644 index 0000000..c2a837d --- /dev/null +++ b/Chapter 03/VB/DriverHID/frmMain.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + frmMain + + \ No newline at end of file diff --git a/Chapter 03/VB/DriverHID/frmMain.vb b/Chapter 03/VB/DriverHID/frmMain.vb new file mode 100644 index 0000000..0e54dcf --- /dev/null +++ b/Chapter 03/VB/DriverHID/frmMain.vb @@ -0,0 +1,89 @@ +Imports System.Runtime.InteropServices + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents btnTest As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.btnQuit = New System.Windows.Forms.Button() + Me.btnTest = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'btnQuit + ' + Me.btnQuit.Location = New System.Drawing.Point(208, 8) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 0 + Me.btnQuit.Text = "Quit" + ' + 'btnTest + ' + Me.btnTest.Location = New System.Drawing.Point(208, 40) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 1 + Me.btnTest.Text = "Test" + ' + 'frmMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnTest, Me.btnQuit}) + Me.Name = "frmMain" + Me.Text = "Checking HIDs Using a Driver" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application + End + End Sub + + 'This function obtains the GUID of the top level HID devices. + _ + Public Shared Sub HidD_GetHidGuid( ByRef HidGuid As Guid) + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles btnTest.Click + Dim HidGuid As Guid 'The top level GUID + + 'Get the HID GUID and display it. + HidD_GetHidGuid(HidGuid) + MessageBox.Show("The HID GUID is: " + HidGuid.ToString(), _ + "Application Output", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub +End Class diff --git a/Chapter 03/VB/DriverHID/obj/Debug/DriverHID.exe b/Chapter 03/VB/DriverHID/obj/Debug/DriverHID.exe new file mode 100644 index 0000000..a539117 Binary files /dev/null and b/Chapter 03/VB/DriverHID/obj/Debug/DriverHID.exe differ diff --git a/Chapter 03/VB/DriverHID/obj/Debug/DriverHID.frmMain.resources b/Chapter 03/VB/DriverHID/obj/Debug/DriverHID.frmMain.resources new file mode 100644 index 0000000..4a6704d Binary files /dev/null and b/Chapter 03/VB/DriverHID/obj/Debug/DriverHID.frmMain.resources differ diff --git a/Chapter 04/ColorCheck/App.ico b/Chapter 04/ColorCheck/App.ico new file mode 100644 index 0000000..cbe3ecb Binary files /dev/null and b/Chapter 04/ColorCheck/App.ico differ diff --git a/Chapter 04/ColorCheck/AssemblyInfo.cs b/Chapter 04/ColorCheck/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 04/ColorCheck/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 04/ColorCheck/ColorCheck.csproj b/Chapter 04/ColorCheck/ColorCheck.csproj new file mode 100644 index 0000000..18e1f8b --- /dev/null +++ b/Chapter 04/ColorCheck/ColorCheck.csproj @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 04/ColorCheck/ColorCheck.csproj.user b/Chapter 04/ColorCheck/ColorCheck.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 04/ColorCheck/ColorCheck.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 04/ColorCheck/ColorCheck.sln b/Chapter 04/ColorCheck/ColorCheck.sln new file mode 100644 index 0000000..0ef8bdc --- /dev/null +++ b/Chapter 04/ColorCheck/ColorCheck.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorCheck", "ColorCheck.csproj", "{C1621957-23A4-4CD1-BC01-15E71E75E10D}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {C1621957-23A4-4CD1-BC01-15E71E75E10D}.Debug.ActiveCfg = Debug|.NET + {C1621957-23A4-4CD1-BC01-15E71E75E10D}.Debug.Build.0 = Debug|.NET + {C1621957-23A4-4CD1-BC01-15E71E75E10D}.Release.ActiveCfg = Release|.NET + {C1621957-23A4-4CD1-BC01-15E71E75E10D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 04/ColorCheck/ColorCheck.suo b/Chapter 04/ColorCheck/ColorCheck.suo new file mode 100644 index 0000000..40fccfd Binary files /dev/null and b/Chapter 04/ColorCheck/ColorCheck.suo differ diff --git a/Chapter 04/ColorCheck/ColorTable.htm b/Chapter 04/ColorCheck/ColorTable.htm new file mode 100644 index 0000000..3a296d1 --- /dev/null +++ b/Chapter 04/ColorCheck/ColorTable.htm @@ -0,0 +1,1992 @@ + + +Safe colours - Tranformations (Dec) + + + + + + + + +
+
+

Colour + transformations - Decimal

This + table holds the standard 216 colour web palette, with an approximation of + the hues seen by colour deficient dichromats.* [Note that it is not + corrected for the loss of luminence experienced by protanopes at the + longer wavelengths.] See the + same list with Hex values on another page.
+
[ + Home + ] - [ Yellows + ] - [ Blues + ] - [ Neutrals + ] - [ Full 216 colour palette ] +
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NormalProtanopiaDeutanopiaTritanoptia
255 255 255 255 250 250 255 232 239 244 240 255 
255 255 204 255 242 200 255 223 200 253 239 255 
255 255 153 255 237 162 255 218 173 255 234 249 
255 255 102 255 234 134 255 215 157 255 230 245 
255 255 051 255 233 117 255 213 148 255 229 243 
255 255 000 255 232 113 255 213 146 255 228 242 
255 204 255 207 215 255 225 216 253 251 209 225 
255 204 204 222 216 210 241 210 203 255 202 216 
255 204 153 229 214 157 252 205 153 255 196 209 
255 204 102 233 212 105 255 202 111 255 192 205 
255 204 051 236 212 053 255 200 087 255 191 202 
255 204 000 236 211 015 255 199 080 255 190 202 
255 153 255 170 189 255 176 188 249 246 169 181 
255 153 204 177 184 224 197 181 199 252 159 170 
255 153 153 189 182 168 210 176 149 255 153 162 
255 153 102 196 180 112 218 172 098 255 149 158 
255 153 051 199 180 058 222 171 042 255 148 157 
255 153 000 200 179 023 223 170 000 255 148 156 
255 102 255 152 178 255 133 167 245 242 135 145 
255 102 204 130 160 246 160 159 195 248 121 129 
255 102 153 153 157 185 177 153 146 253 110 116 
255 102 102 165 155 124 187 149 094 255 102 108 
255 102 051 170 154 066 191 147 034 255 101 106 
255 102 000 172 154 030 192 147 000 255 101 105 
255 051 255 150 177 255 103 155 242 240 113 120 
255 051 204 119 157 255 138 146 193 247 094 099 
255 051 153 122 142 206 157 139 143 251 076 079 
255 051 102 143 140 139 167 135 092 254 061 062 
255 051 051 152 139 074 173 132 028 255 051 050 
255 051 000 154 139 035 174 134 000 255 051 049 
255 000 255 150 177 255 094 152 241 240 106 113 
255 000 204 123 160 255 131 143 192 246 085 090 
255 000 153 110 137 215 151 136 142 250 064 066 
255 000 102 136 136 146 162 131 091 253 043 040 
255 000 051 147 135 078 168 128 026 254 026 000 
255 000 000 150 135 038 169 130 000 254 028 000 
204 255 255 248 244 248 255 234 253 203 239 255 
204 255 204 255 241 197 255 222 204 211 239 255 
204 255 153 255 235 151 255 216 171 217 238 255 
204 255 102 255 232 115 255 212 151 221 238 255 
204 255 051 255 231 092 255 211 140 224 238 255 
204 255 000 255 230 085 255 211 137 224 238 255 
204 204 255 196 206 255 203 204 255 198 209 225 
204 204 204 207 203 203 222 198 205 206 202 217 
204 204 153 215 201 151 234 193 155 211 196 211 
204 204 102 219 199 100 241 190 106 215 193 207 
204 204 051 221 198 049 245 188 059 216 191 205 
204 204 000 221 198 000 246 198 000 217 190 204 
204 153 255 152 177 255 143 174 251 191 169 182 
204 153 204 158 168 215 170 167 201 199 159 171 
204 153 153 170 165 160 186 161 152 205 152 162 
204 153 102 177 164 106 196 157 101 208 146 157 
204 153 051 181 163 054 201 155 050 210 144 154 
204 153 000 181 162 014 202 154 000 211 143 153 
204 102 255 135 167 255 076 151 246 187 135 145 
204 102 204 100 140 235 123 141 197 195 121 130 
204 102 153 127 136 175 145 134 148 201 110 117 
204 102 102 140 134 117 158 129 097 204 101 108 
204 102 051 146 133 060 164 126 043 206 096 103 
204 102 000 148 132 021 166 127 000 207 095 101 
204 051 255 138 170 255 000 141 239 184 113 120 
204 051 204 067 135 255 087 126 194 193 094 100 
204 051 153 082 117 200 118 117 145 198 076 080 
204 051 102 112 115 135 133 111 095 202 061 063 
204 051 051 123 113 070 140 108 039 204 051 052 
204 051 000 126 113 027 143 109 000 204 048 048 
204 000 255 140 171 255 000 140 236 183 106 113 
204 000 204 093 145 255 075 122 192 192 085 090 
204 000 153 053 111 213 110 113 144 198 064 067 
204 000 102 100 109 144 126 106 094 202 043 043 
204 000 051 116 108 076 133 103 038 203 023 011 
204 000 000 120 108 030 136 105 000 204 022 000 
153 255 255 239 236 244 244 228 255 166 239 255 
153 255 204 247 233 193 255 221 208 172 239 255 
153 255 153 251 231 144 255 214 169 176 238 255 
153 255 102 254 230 094 255 210 145 180 238 255 
153 255 051 255 229 050 255 209 132 181 237 255 
153 255 000 255 228 028 255 208 128 182 237 255 
153 204 255 185 197 250 185 196 255 145 209 225 
153 204 204 196 193 198 206 189 207 156 202 217 
153 204 153 203 191 147 219 184 157 163 196 211 
153 204 102 207 189 097 228 181 108 168 193 207 
153 204 051 209 188 047 232 179 063 170 191 205 
153 204 000 210 188 000 233 178 042 171 190 205 
153 153 255 131 164 255 111 164 253 134 169 182 
153 153 204 143 156 206 146 155 204 146 159 171 
153 153 153 155 152 153 166 148 154 154 151 163 
153 153 102 162 150 101 178 144 104 159 146 157 
153 153 051 165 149 050 183 142 055 162 144 154 
153 153 000 166 149 000 166 149 000 162 143 153 
153 102 255 112 155 255 000 144 243 126 135 145 
153 102 204 073 123 223 080 127 199 140 121 130 
153 102 153 106 119 165 115 118 150 148 109 117 
153 102 102 120 116 109 132 112 100 154 101 108 
153 102 051 126 114 055 140 109 049 156 096 103 
153 102 000 127 114 013 142 108 000 157 095 102 
153 051 255 125 162 255 000 141 232 122 112 120 
153 051 204 000 122 246 000 115 194 136 093 100 
153 051 153 000 094 191 073 097 146 145 076 081 
153 051 102 080 091 128 098 089 097 150 061 064 
153 051 051 095 089 065 108 085 045 153 051 053 
153 051 000 099 089 019 112 086 000 154 048 050 
153 000 255 131 166 255 000 140 229 121 106 113 
153 000 204 039 130 255 000 115 192 135 085 091 
153 000 153 000 103 208 056 091 144 144 064 068 
153 000 102 057 083 143 087 083 095 150 043 044 
153 000 051 085 081 074 099 078 044 152 022 018 
153 000 000 090 081 023 103 079 000 153 017 000 
102 255 255 234 231 240 235 223 255 136 239 255 
102 255 204 241 228 191 255 221 211 139 239 255 
102 255 153 246 226 141 255 213 167 142 238 255 
102 255 102 248 225 093 255 208 139 144 238 255 
102 255 051 250 224 042 255 207 124 146 237 255 
102 255 000 250 224 000 255 206 121 146 237 255 
102 204 255 178 190 245 173 190 255 087 209 225 
102 204 204 189 187 193 195 183 209 107 202 217 
102 204 153 196 184 143 210 178 159 119 196 211 
102 204 102 200 182 094 218 174 110 126 193 207 
102 204 051 202 181 045 223 172 066 129 191 205 
102 204 000 202 181 000 224 172 046 130 190 205 
102 153 255 110 152 254 081 156 254 062 169 182 
102 153 204 133 147 199 128 147 205 090 159 171 
102 153 153 145 143 147 151 140 156 105 151 163 
102 153 102 152 140 097 164 135 106 113 146 157 
102 153 051 155 139 047 170 133 059 116 144 154 
102 153 000 155 139 000 172 132 033 117 143 154 
102 102 255 081 141 255 000 144 238 034 135 145 
102 102 204 050 110 213 000 118 201 077 121 130 
102 102 153 089 105 156 088 106 152 094 109 117 
102 102 102 104 102 102 111 099 103 103 101 108 
102 102 051 109 100 050 121 095 053 107 096 103 
102 102 000 111 099 000 123 094 017 108 095 102 
102 051 255 110 154 255 000 140 228 000 113 121 
102 051 204 000 116 234 000 118 194 068 093 100 
102 051 153 000 089 180 000 089 149 088 076 081 
102 051 102 050 070 118 061 071 099 098 061 065 
102 051 051 070 067 058 079 064 049 102 051 054 
102 051 000 074 066 011 083 064 000 103 048 051 
102 000 255 122 161 255 000 139 225 000 107 115 
102 000 204 000 124 248 000 118 191 066 084 091 
102 000 153 000 101 202 000 090 148 086 063 068 
102 000 102 000 071 142 037 061 096 096 043 045 
102 000 051 050 055 072 063 053 047 101 022 021 
102 000 000 060 054 015 069 053 000 102 011 000 
051 255 255 231 229 239 231 221 255 116 239 255 
051 255 204 238 226 189 252 219 212 118 239 255 
051 255 153 243 223 140 255 212 166 120 238 255 
051 255 102 245 222 092 255 207 136 121 238 255 
051 255 051 247 221 041 255 205 120 122 237 255 
051 255 000 247 221 000 255 205 116 122 237 255 
051 204 255 174 187 242 167 187 255 000 209 224 
051 204 204 185 183 191 189 180 209 062 202 217 
051 204 153 192 180 142 204 174 160 084 196 211 
051 204 102 196 178 093 214 171 111 094 193 207 
051 204 051 198 178 044 218 169 067 099 191 205 
051 204 000 198 177 000 219 168 048 100 191 215 
051 153 255 105 147 250 057 153 255 000 171 183 
051 153 204 127 142 195 117 143 206 000 160 172 
051 153 153 140 138 144 143 135 157 057 151 163 
051 153 102 146 135 094 157 130 107 073 146 157 
051 153 051 149 134 046 164 128 060 079 144 154 
051 153 000 149 134 000 165 134 000 081 143 154 
051 102 255 037 129 255 000 144 236 000 144 153 
051 102 204 032 103 205 000 120 201 000 127 135 
051 102 153 080 097 149 067 099 154 020 109 118 
051 102 102 094 093 097 097 091 104 053 101 109 
051 102 051 100 091 047 109 087 055 063 096 104 
051 102 000 101 091 000 112 086 023 065 095 102 
051 051 255 096 148 255 000 140 226 000 129 135 
051 051 204 000 112 225 000 120 194 000 106 112 
051 051 153 000 084 170 000 093 153 000 080 086 
051 051 102 025 055 106 000 059 101 038 060 065 
051 051 051 052 051 051 055 049 051 051 050 054 
051 051 000 055 050 000 061 047 009 054 048 051 
051 000 255 115 157 255 000 139 223 000 124 130 
051 000 204 000 121 242 000 118 191 000 100 105 
051 000 153 000 098 196 000 093 150 000 071 075 
051 000 102 000 070 139 000 063 103 033 042 045 
051 000 051 000 036 072 019 030 048 048 021 023 
051 000 000 030 027 008 034 026 000 051 006 000 
000 255 255 230 228 238 230 220 255 110 239 255 
000 255 204 237 225 189 251 218 212 112 239 255 
000 255 153 242 223 140 255 211 166 114 238 255 
000 255 102 245 221 092 255 207 135 115 238 255 
000 255 051 246 221 041 255 205 119 115 237 255 
000 255 000 246 220 000 255 205 114 115 237 255 
000 204 255 173 186 242 165 187 255 000 208 223 
000 204 204 184 182 191 187 179 209 041 202 217 
000 204 153 191 179 141 203 174 160 071 196 211 
000 204 102 195 178 093 212 170 111 084 193 207 
000 204 051 197 177 043 217 168 068 089 191 205 
000 204 000 197 176 000 218 168 049 090 191 205 
000 153 255 103 146 248 051 152 255 000 172 183 
000 153 204 126 141 194 114 142 207 000 161 172 
000 153 153 138 137 143 141 134 157 031 151 163 
000 153 102 144 134 094 155 129 108 057 146 157 
000 153 051 147 133 045 162 126 061 066 144 154 
000 153 000 148 133 000 163 126 037 068 143 154 
000 102 255 000 126 254 000 144 236 000 146 154 
000 102 204 026 102 204 000 120 201 000 130 138 
000 102 153 078 095 147 061 098 154 000 114 122 
000 102 102 092 091 095 094 090 105 021 101 109 
000 102 051 097 089 046 106 085 056 042 096 104 
000 102 000 099 088 000 109 084 024 045 095 102 
000 051 255 091 145 255 000 140 226 000 131 137 
000 051 204 000 111 222 000 120 194 000 111 116 
000 051 153 000 083 166 000 094 154 000 089 094 
000 051 102 013 051 102 000 062 104 000 067 071 
000 051 051 046 046 048 047 045 052 010 050 054 
000 051 000 049 044 000 054 042 012 023 048 051 
000 000 255 113 156 255 000 139 223 000 127 133 
000 000 204 000 120 240 000 118 190 000 106 110 
000 000 153 000 096 193 000 094 151 000 081 085 
000 000 102 000 068 135 000 065 104 000 055 057 
000 000 051 000 035 070 000 033 053 000 028 029 
000 000 000 000 000 000 000 000 000 000 000 000 
+

* Calculated by the spreadsheet calculations given at +http://www.hcirn.com/atoz/atozc/coldef.html

+
+
+Copyright © British Telecommunications plc +1998
christine.rigden @ bt.com
updated July 2001 +
diff --git a/Chapter 04/ColorCheck/FrmMain.cs b/Chapter 04/ColorCheck/FrmMain.cs new file mode 100644 index 0000000..092f5dd --- /dev/null +++ b/Chapter 04/ColorCheck/FrmMain.cs @@ -0,0 +1,1162 @@ +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace ColorCheck +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.MainMenu mainMenu1; + private System.Windows.Forms.PictureBox pbSample; + private System.Windows.Forms.MenuItem mnuFile; + private System.Windows.Forms.MenuItem mnuFileOpen; + private System.Windows.Forms.MenuItem mnuFileExit; + private System.Windows.Forms.MenuItem mnuColor; + private System.Windows.Forms.MenuItem mnuColorNormal; + private System.Windows.Forms.MenuItem mnuColorProtanopia; + private System.Windows.Forms.MenuItem mnuColorDeuteranopia; + private System.Windows.Forms.MenuItem mnuColorTritanopia; + private System.Windows.Forms.MenuItem mnuEdit; + private System.Windows.Forms.MenuItem mnuEditCut; + private System.Windows.Forms.MenuItem mnuEditCopy; + private System.Windows.Forms.MenuItem mnuEditPaste; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + // Define the transformation arrays. + private Color[,,] aProtanopia = new Color[6, 6, 6]; + private Color[,,] aDeuteranopia = new Color[6, 6, 6]; + private Color[,,] aTritanopia = new Color[6, 6, 6]; + + public frmMain() + { + // Required for Windows Form Designer support + InitializeComponent(); + + // Fill the color arrays. + aProtanopia = FillColorArray(aProtanopiaData); + aDeuteranopia = FillColorArray(aDeuteranopiaData); + aTritanopia = FillColorArray(aTritanopiaData); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain)); + this.mainMenu1 = new System.Windows.Forms.MainMenu(); + this.mnuFile = new System.Windows.Forms.MenuItem(); + this.mnuFileOpen = new System.Windows.Forms.MenuItem(); + this.mnuFileExit = new System.Windows.Forms.MenuItem(); + this.mnuEdit = new System.Windows.Forms.MenuItem(); + this.mnuEditCut = new System.Windows.Forms.MenuItem(); + this.mnuEditCopy = new System.Windows.Forms.MenuItem(); + this.mnuEditPaste = new System.Windows.Forms.MenuItem(); + this.mnuColor = new System.Windows.Forms.MenuItem(); + this.mnuColorNormal = new System.Windows.Forms.MenuItem(); + this.mnuColorProtanopia = new System.Windows.Forms.MenuItem(); + this.mnuColorDeuteranopia = new System.Windows.Forms.MenuItem(); + this.mnuColorTritanopia = new System.Windows.Forms.MenuItem(); + this.pbSample = new System.Windows.Forms.PictureBox(); + this.SuspendLayout(); + // + // mainMenu1 + // + this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuFile, + this.mnuEdit, + this.mnuColor}); + // + // mnuFile + // + this.mnuFile.Index = 0; + this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuFileOpen, + this.mnuFileExit}); + this.mnuFile.Text = "&File"; + // + // mnuFileOpen + // + this.mnuFileOpen.Index = 0; + this.mnuFileOpen.Shortcut = System.Windows.Forms.Shortcut.CtrlO; + this.mnuFileOpen.Text = "&Open"; + this.mnuFileOpen.Click += new System.EventHandler(this.mnuFileOpen_Click); + // + // mnuFileExit + // + this.mnuFileExit.Index = 1; + this.mnuFileExit.Text = "E&xit"; + this.mnuFileExit.Click += new System.EventHandler(this.mnuFileExit_Click); + // + // mnuEdit + // + this.mnuEdit.Index = 1; + this.mnuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuEditCut, + this.mnuEditCopy, + this.mnuEditPaste}); + this.mnuEdit.Text = "&Edit"; + // + // mnuEditCut + // + this.mnuEditCut.Index = 0; + this.mnuEditCut.Shortcut = System.Windows.Forms.Shortcut.CtrlX; + this.mnuEditCut.Text = "Cu&t"; + this.mnuEditCut.Click += new System.EventHandler(this.mnuEditCut_Click); + // + // mnuEditCopy + // + this.mnuEditCopy.Index = 1; + this.mnuEditCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC; + this.mnuEditCopy.Text = "&Copy"; + this.mnuEditCopy.Click += new System.EventHandler(this.mnuEditCopy_Click); + // + // mnuEditPaste + // + this.mnuEditPaste.Index = 2; + this.mnuEditPaste.Shortcut = System.Windows.Forms.Shortcut.CtrlV; + this.mnuEditPaste.Text = "&Paste"; + this.mnuEditPaste.Click += new System.EventHandler(this.mnuEditPaste_Click); + // + // mnuColor + // + this.mnuColor.Enabled = false; + this.mnuColor.Index = 2; + this.mnuColor.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuColorNormal, + this.mnuColorProtanopia, + this.mnuColorDeuteranopia, + this.mnuColorTritanopia}); + this.mnuColor.Text = "&Color Setting"; + // + // mnuColorNormal + // + this.mnuColorNormal.Checked = true; + this.mnuColorNormal.Index = 0; + this.mnuColorNormal.RadioCheck = true; + this.mnuColorNormal.Shortcut = System.Windows.Forms.Shortcut.F1; + this.mnuColorNormal.Text = "&Normal"; + this.mnuColorNormal.Click += new System.EventHandler(this.mnuColorNormal_Click); + // + // mnuColorProtanopia + // + this.mnuColorProtanopia.Index = 1; + this.mnuColorProtanopia.RadioCheck = true; + this.mnuColorProtanopia.Shortcut = System.Windows.Forms.Shortcut.F2; + this.mnuColorProtanopia.Text = "&Protanopia (Red Loss)"; + this.mnuColorProtanopia.Click += new System.EventHandler(this.mnuColorProtanopia_Click); + // + // mnuColorDeuteranopia + // + this.mnuColorDeuteranopia.Index = 2; + this.mnuColorDeuteranopia.RadioCheck = true; + this.mnuColorDeuteranopia.Shortcut = System.Windows.Forms.Shortcut.F4; + this.mnuColorDeuteranopia.Text = "&Deuteranopia (Green Loss)"; + this.mnuColorDeuteranopia.Click += new System.EventHandler(this.mnuColorDeuteranopia_Click); + // + // mnuColorTritanopia + // + this.mnuColorTritanopia.Index = 3; + this.mnuColorTritanopia.RadioCheck = true; + this.mnuColorTritanopia.Shortcut = System.Windows.Forms.Shortcut.F6; + this.mnuColorTritanopia.Text = "&Tritanopia (Blue Loss)"; + this.mnuColorTritanopia.Click += new System.EventHandler(this.mnuColorTritanopia_Click); + // + // pbSample + // + this.pbSample.AccessibleDescription = "The image that the developer wants to test."; + this.pbSample.AccessibleName = "Sample Image"; + this.pbSample.Dock = System.Windows.Forms.DockStyle.Fill; + this.pbSample.Location = new System.Drawing.Point(0, 0); + this.pbSample.Name = "pbSample"; + this.pbSample.Size = new System.Drawing.Size(320, 226); + this.pbSample.TabIndex = 0; + this.pbSample.TabStop = false; + // + // frmMain + // + this.AccessibleDescription = "This application modifies the display to simulate various types of color blindnes" + + "s."; + this.AccessibleName = "Application Color Blindness Tester"; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(320, 226); + this.Controls.Add(this.pbSample); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Menu = this.mainMenu1; + this.Name = "frmMain"; + this.Text = "Application Color Blindness Tester"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + #region File Menu + private void mnuFileExit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void mnuFileOpen_Click(object sender, System.EventArgs e) + { + OpenFileDialog Dlg; // File Open Dialog + String File2Open; // Selected Filename + Bitmap Graphic; // The opened bitmap. + PixelFormat PF; // The standard pixel format. + Bitmap Sample; // Holds sample color table. + + // Set up the File Open Dialog + Dlg = new OpenFileDialog(); + Dlg.Filter = "Windows Bitmap (*.bmp)|*.bmp|" + + "Enhanced Metafile (*.emf)|*.emf|" + + "Graphics Interchange Format File (*.gif)|*.gif|" + + "Windows Icon (*.ico)|*.ico|" + + "Joint Photographic Experts Group (*.jpg;*.jpeg)|*.jpg;*.jpeg|" + + "Portable Network Graphic (*.png)|*.png|" + + "Windows Metafile (*.wmf)|*.wmf"; + Dlg.DefaultExt = ".gif"; + Dlg.Title = "Open File Dialog"; + + // Display the File Open Dialog and obtain the name of a file and + // the file information. + if (Dlg.ShowDialog() == DialogResult.OK) + { + File2Open = Dlg.FileName; + } + else + { + // If the user didn't select anything, return. + return; + } + + // Open the document and make a copy. + Graphic = new Bitmap(File2Open, true); + + // Change the title bar. + frmMain.ActiveForm.Text = + "Application Color Blindness Tester - " + File2Open; + + // Draw a graphic normally. + pbSample.Image = Graphic; + + // Store the color palette used for this image. + if (Graphic.Palette.Entries.Length > 0) + { + // Use the color palette stored in the image if possible. + CPNormal = Graphic.Palette; + + // Create the alternate palettes. + CreatePalettes(Graphic.Palette); + } + else + { + // Create a sample graphic. + PF = PixelFormat.Format8bppIndexed; + Sample = new Bitmap(1, 1, PF); + + // Use this generic bitmap for the palette it contains. + CPNormal = Sample.Palette; + + // Create the alternate palettes. + CreatePalettes(Sample.Palette); + } + + // Enable the Color Setting menu. + mnuColor.Enabled = true; + CheckThis(mnuColorNormal); + } + #endregion + + #region Edit Menu + private void mnuEditCut_Click(object sender, System.EventArgs e) + { + // Copy the current image to the clipboard and clear the image. + Clipboard.SetDataObject(pbSample.Image); + + // Clear the image. + pbSample.Image = null; + + // Disable the Color Setting menu. + mnuColor.Enabled = false; + } + + private void mnuEditCopy_Click(object sender, System.EventArgs e) + { + // Copy the current image to the clipboard. + Clipboard.SetDataObject(pbSample.Image); + } + + private void mnuEditPaste_Click(object sender, System.EventArgs e) + { + IDataObject oData; // The clipboard data. + Bitmap Graphic; // The image to display. + PixelFormat PF; // The standard pixel format. + Bitmap Sample; // Holds sample color table. + + // Get the clipboard data. + oData = Clipboard.GetDataObject(); + + // Make sure there is some data present. + if (oData.GetDataPresent(DataFormats.Bitmap)) + { + // Place the data on screen. + pbSample.Image = (Bitmap)oData.GetData(DataFormats.Bitmap); + Graphic = (Bitmap)oData.GetData(DataFormats.Bitmap); + + // Store the color palette used for this image. + if (Graphic.Palette.Entries.Length > 0) + { + // Use the color palette stored in the image if possible. + CPNormal = Graphic.Palette; + + // Create the alternate palettes. + CreatePalettes(Graphic.Palette); + } + else + { + // Create a sample graphic. + PF = PixelFormat.Format8bppIndexed; + Sample = new Bitmap(1, 1, PF); + + // Use this generic bitmap for the palette it contains. + CPNormal = Sample.Palette; + + // Create the alternate palettes. + CreatePalettes(Sample.Palette); + } + + // Enable the Color Setting menu. + mnuColor.Enabled = true; + CheckThis(mnuColorNormal); + } + } + #endregion + + #region Palette Manipulation + // Color variable use to store the current color settings. + ColorPalette CPNormal; + ColorPalette CPProtanopia; + ColorPalette CPDeuteranopia; + ColorPalette CPTritanopia; + + private void CreatePalettes(ColorPalette CP) + { + // Create each of the color palettes in turn. + CPProtanopia = CreateModifiedPalette(CP, aProtanopia); + CPDeuteranopia = CreateModifiedPalette(CP, aDeuteranopia); + CPTritanopia = CreateModifiedPalette(CP, aTritanopia); + } + + private ColorPalette CreateModifiedPalette(ColorPalette CP, Color[,,] Data) + { + ColorPalette Temp; // Temporary data holder. + PixelFormat PF; // The standard pixel format. + Bitmap Sample; // Holds sample color table. + Int32 Red; // Red value index. + Int32 Blue; // Blue value index. + Int32 Green; // Green value index. + Double RConv; // Red conversion value. + Double BConv; // Blue conversion value. + Double GConv; // Green conversion value. + + // Create a temporary palette. + // Begin by creating a sample graphic. + PF = PixelFormat.Format8bppIndexed; + Sample = new Bitmap(1, 1, PF); + + // Use this generic bitmap for the palette it contains. + Temp = Sample.Palette; + + // Modify the entires to simulate color blindness. + for (int Counter = 0; Counter < CP.Entries.Length; Counter++) + { + // Obtain the current color values. + RConv = CP.Entries[Counter].R; + GConv = CP.Entries[Counter].G; + BConv = CP.Entries[Counter].B; + + // Define the index value used for looking up the conversion + // colors. + Red = Convert.ToInt32(5 - RConv / 51); + Green = Convert.ToInt32(5 - GConv / 51); + Blue = Convert.ToInt32(5 - BConv / 51); + + // Obtain the entry from the lookup table and place it in the + // new palette. + Temp.Entries[Counter] = Data[Red, Green, Blue]; + } + + // Return the result. + return Temp; + } + #endregion + + #region Color Menu + private void CheckThis(MenuItem MenuOption) + { + // Clear the current checks. + mnuColorNormal.Checked = false; + mnuColorProtanopia.Checked = false; + mnuColorDeuteranopia.Checked = false; + mnuColorTritanopia.Checked = false; + + // Check the selected menu option. + MenuOption.Checked = true; + } + + private void mnuColorNormal_Click(object sender, System.EventArgs e) + { + // Check this option on the menu. + CheckThis(mnuColorNormal); + + // Restore the image. + pbSample.Image.Palette = CPNormal; + pbSample.Invalidate(); + } + + private void mnuColorProtanopia_Click(object sender, System.EventArgs e) + { + // Check this option on the menu. + CheckThis(mnuColorProtanopia); + + // Modify the image palette to match. + pbSample.Image.Palette = CPProtanopia; + pbSample.Invalidate(); + } + + private void mnuColorDeuteranopia_Click(object sender, System.EventArgs e) + { + // Check this option on the menu. + CheckThis(mnuColorDeuteranopia); + + // Modify the image palette to match. + pbSample.Image.Palette = CPDeuteranopia; + pbSample.Invalidate(); + } + + private void mnuColorTritanopia_Click(object sender, System.EventArgs e) + { + // Check this option on the menu. + CheckThis(mnuColorTritanopia); + + // Modify the image palette to match. + pbSample.Image.Palette = CPTritanopia; + pbSample.Invalidate(); + } + #endregion + + #region Data Arrays + private Color[,,] FillColorArray(int[,] InputData) + { + int DataCounter = 0; // Data array counter. + Color[,,] Temp = new Color[6,6,6]; // Color array. + + // Loop through the various count value until the Protanopia array + // is filled. + for (int RCount = 0; RCount < 6; RCount++) + for (int GCount = 0; GCount < 6; GCount++) + for (int BCount = 0; BCount < 6; BCount++) + { + // Get the array value. + Temp[RCount,GCount,BCount] = + Color.FromArgb(InputData[DataCounter, 0], + InputData[DataCounter, 1], + InputData[DataCounter, 2]); + + // Increment the data counter. + DataCounter++; + } + + // Return the results. + return Temp; + } + + private int[,] aProtanopiaData = {{255, 250, 250}, + {255, 242, 200}, + {255, 237, 162}, + {255, 234, 134}, + {255, 233, 117}, + {255, 232, 113}, + {207, 215, 255}, + {222, 216, 210}, + {229, 214, 157}, + {233, 212, 105}, + {236, 212, 053}, + {236, 211, 015}, + {170, 189, 255}, + {177, 184, 224}, + {189, 182, 168}, + {196, 180, 112}, + {199, 180, 058}, + {200, 179, 023}, + {152, 178, 255}, + {130, 160, 246}, + {153, 157, 185}, + {165, 155, 124}, + {170, 154, 066}, + {172, 154, 030}, + {150, 177, 255}, + {119, 157, 255}, + {122, 142, 206}, + {143, 140, 139}, + {152, 139, 074}, + {154, 139, 035}, + {150, 177, 255}, + {123, 160, 255}, + {110, 137, 215}, + {136, 136, 146}, + {147, 135, 078}, + {150, 135, 038}, + {248, 244, 248}, + {255, 241, 197}, + {255, 235, 151}, + {255, 232, 115}, + {255, 231, 092}, + {255, 230, 085}, + {196, 206, 255}, + {207, 203, 203}, + {215, 201, 151}, + {219, 199, 100}, + {221, 198, 049}, + {221, 198, 000}, + {152, 177, 255}, + {158, 168, 215}, + {170, 165, 160}, + {177, 164, 106}, + {181, 163, 054}, + {181, 162, 014}, + {135, 167, 255}, + {100, 140, 235}, + {127, 136, 175}, + {140, 134, 117}, + {146, 133, 060}, + {148, 132, 021}, + {138, 170, 255}, + {067, 135, 255}, + {082, 117, 200}, + {112, 115, 135}, + {123, 113, 070}, + {126, 113, 027}, + {140, 171, 255}, + {093, 145, 255}, + {053, 111, 213}, + {100, 109, 144}, + {116, 108, 076}, + {120, 108, 030}, + {239, 236, 244}, + {247, 233, 193}, + {251, 231, 144}, + {254, 230, 094}, + {255, 229, 050}, + {255, 228, 028}, + {185, 197, 250}, + {196, 193, 198}, + {203, 191, 147}, + {207, 189, 097}, + {209, 188, 047}, + {210, 188, 000}, + {131, 164, 255}, + {143, 156, 206}, + {155, 152, 153}, + {162, 150, 101}, + {165, 149, 050}, + {166, 149, 000}, + {112, 155, 255}, + {073, 123, 223}, + {106, 119, 165}, + {120, 116, 109}, + {126, 114, 055}, + {127, 114, 013}, + {125, 162, 255}, + {000, 122, 246}, + {000, 094, 191}, + {080, 091, 128}, + {095, 089, 065}, + {099, 089, 019}, + {131, 166, 255}, + {039, 130, 255}, + {000, 103, 208}, + {057, 083, 143}, + {085, 081, 074}, + {090, 081, 023}, + {234, 231, 240}, + {241, 228, 191}, + {246, 226, 141}, + {248, 225, 093}, + {250, 224, 042}, + {250, 224, 000}, + {178, 190, 245}, + {189, 187, 193}, + {196, 184, 143}, + {200, 182, 094}, + {202, 181, 045}, + {202, 181, 000}, + {110, 152, 254}, + {133, 147, 199}, + {145, 143, 147}, + {152, 140, 097}, + {155, 139, 047}, + {155, 139, 000}, + {081, 141, 255}, + {050, 110, 213}, + {089, 105, 156}, + {104, 102, 102}, + {109, 100, 050}, + {111, 099, 000}, + {110, 154, 255}, + {000, 116, 234}, + {000, 089, 180}, + {050, 070, 118}, + {070, 067, 058}, + {074, 066, 011}, + {122, 161, 255}, + {000, 124, 248}, + {000, 101, 202}, + {000, 071, 142}, + {050, 055, 072}, + {060, 054, 015}, + {231, 229, 239}, + {238, 226, 189}, + {243, 223, 140}, + {245, 222, 092}, + {247, 221, 041}, + {247, 221, 000}, + {174, 187, 242}, + {185, 183, 191}, + {192, 180, 142}, + {196, 178, 093}, + {198, 178, 044}, + {198, 177, 000}, + {105, 147, 250}, + {127, 142, 195}, + {140, 138, 144}, + {146, 135, 094}, + {149, 134, 046}, + {149, 134, 000}, + {037, 129, 255}, + {032, 103, 205}, + {080, 097, 149}, + {094, 093, 097}, + {100, 091, 047}, + {101, 091, 000}, + {096, 148, 255}, + {000, 112, 225}, + {000, 084, 170}, + {025, 055, 106}, + {052, 051, 051}, + {055, 050, 000}, + {115, 157, 255}, + {000, 121, 242}, + {000, 098, 196}, + {000, 070, 139}, + {000, 036, 072}, + {030, 027, 008}, + {230, 228, 238}, + {237, 225, 189}, + {242, 223, 140}, + {245, 221, 092}, + {246, 221, 041}, + {246, 220, 000}, + {173, 186, 242}, + {184, 182, 191}, + {191, 179, 141}, + {195, 178, 093}, + {197, 177, 043}, + {197, 176, 000}, + {103, 146, 248}, + {126, 141, 194}, + {138, 137, 143}, + {144, 134, 094}, + {147, 133, 045}, + {148, 133, 000}, + {000, 126, 254}, + {026, 102, 204}, + {078, 095, 147}, + {092, 091, 095}, + {097, 089, 046}, + {099, 088, 000}, + {091, 145, 255}, + {000, 111, 222}, + {000, 083, 166}, + {013, 051, 102}, + {046, 046, 048}, + {049, 044, 000}, + {113, 156, 255}, + {000, 120, 240}, + {000, 096, 193}, + {000, 068, 135}, + {000, 035, 070}, + {000, 000, 000}}; + + private int[,] aDeuteranopiaData = {{255, 232, 239}, + {255, 223, 200}, + {255, 218, 173}, + {255, 215, 157}, + {255, 213, 148}, + {255, 213, 146}, + {225, 216, 253}, + {241, 210, 203}, + {252, 205, 153}, + {255, 202, 111}, + {255, 200, 087}, + {255, 199, 080}, + {176, 188, 249}, + {197, 181, 199}, + {210, 176, 149}, + {218, 172, 098}, + {222, 171, 042}, + {223, 170, 000}, + {133, 167, 245}, + {160, 159, 195}, + {177, 153, 146}, + {187, 149, 094}, + {191, 147, 034}, + {192, 147, 000}, + {103, 155, 242}, + {138, 146, 193}, + {157, 139, 143}, + {167, 135, 092}, + {173, 132, 028}, + {174, 134, 000}, + {094, 152, 241}, + {131, 143, 192}, + {151, 136, 142}, + {162, 131, 091}, + {168, 128, 026}, + {169, 130, 000}, + {255, 234, 253}, + {255, 222, 204}, + {255, 216, 171}, + {255, 212, 151}, + {255, 211, 140}, + {255, 211, 137}, + {203, 204, 255}, + {222, 198, 205}, + {234, 193, 155}, + {241, 190, 106}, + {245, 188, 059}, + {246, 198, 000}, + {143, 174, 251}, + {170, 167, 201}, + {186, 161, 152}, + {196, 157, 101}, + {201, 155, 050}, + {202, 154, 000}, + {076, 151, 246}, + {123, 141, 197}, + {145, 134, 148}, + {158, 129, 097}, + {164, 126, 043}, + {166, 127, 000}, + {000, 141, 239}, + {087, 126, 194}, + {118, 117, 145}, + {133, 111, 095}, + {140, 108, 039}, + {143, 109, 000}, + {000, 140, 236}, + {075, 122, 192}, + {110, 113, 144}, + {126, 106, 094}, + {133, 103, 038}, + {136, 105, 000}, + {244, 228, 255}, + {255, 221, 208}, + {255, 214, 169}, + {255, 210, 145}, + {255, 209, 132}, + {255, 208, 128}, + {185, 196, 255}, + {206, 189, 207}, + {219, 184, 157}, + {228, 181, 108}, + {232, 179, 063}, + {233, 178, 042}, + {111, 164, 253}, + {146, 155, 204}, + {166, 148, 154}, + {178, 144, 104}, + {183, 142, 055}, + {166, 149, 000}, + {000, 144, 243}, + {080, 127, 199}, + {115, 118, 150}, + {132, 112, 100}, + {140, 109, 049}, + {142, 108, 000}, + {000, 141, 232}, + {000, 115, 194}, + {073, 097, 146}, + {098, 089, 097}, + {108, 085, 045}, + {112, 086, 000}, + {000, 140, 229}, + {000, 115, 192}, + {056, 091, 144}, + {087, 083, 095}, + {099, 078, 044}, + {103, 079, 000}, + {235, 223, 255}, + {255, 221, 211}, + {255, 213, 167}, + {255, 208, 139}, + {255, 207, 124}, + {255, 206, 121}, + {173, 190, 255}, + {195, 183, 209}, + {210, 178, 159}, + {218, 174, 110}, + {223, 172, 066}, + {224, 172, 046}, + {081, 156, 254}, + {128, 147, 205}, + {151, 140, 156}, + {164, 135, 106}, + {170, 133, 059}, + {172, 132, 033}, + {000, 144, 238}, + {000, 118, 201}, + {088, 106, 152}, + {111, 099, 103}, + {121, 095, 053}, + {123, 094, 017}, + {000, 140, 228}, + {000, 118, 194}, + {000, 089, 149}, + {061, 071, 099}, + {079, 064, 049}, + {083, 064, 000}, + {000, 139, 225}, + {000, 118, 191}, + {000, 090, 148}, + {037, 061, 096}, + {063, 053, 047}, + {069, 053, 000}, + {231, 221, 255}, + {252, 219, 212}, + {255, 212, 166}, + {255, 207, 136}, + {255, 205, 120}, + {255, 205, 116}, + {167, 187, 255}, + {189, 180, 209}, + {204, 174, 160}, + {214, 171, 111}, + {218, 169, 067}, + {219, 168, 048}, + {057, 153, 255}, + {117, 143, 206}, + {143, 135, 157}, + {157, 130, 107}, + {164, 128, 060}, + {165, 134, 000}, + {000, 144, 236}, + {000, 120, 201}, + {067, 099, 154}, + {097, 091, 104}, + {109, 087, 055}, + {112, 086, 023}, + {000, 140, 226}, + {000, 120, 194}, + {000, 093, 153}, + {000, 059, 101}, + {055, 049, 051}, + {061, 047, 009}, + {000, 139, 223}, + {000, 118, 191}, + {000, 093, 150}, + {000, 063, 103}, + {019, 030, 048}, + {034, 026, 000}, + {230, 220, 255}, + {251, 218, 212}, + {255, 211, 166}, + {255, 207, 135}, + {255, 205, 119}, + {255, 205, 114}, + {165, 187, 255}, + {187, 179, 209}, + {203, 174, 160}, + {212, 170, 111}, + {217, 168, 068}, + {218, 168, 049}, + {051, 152, 255}, + {114, 142, 207}, + {141, 134, 157}, + {155, 129, 108}, + {162, 126, 061}, + {163, 126, 037}, + {000, 144, 236}, + {000, 120, 201}, + {061, 098, 154}, + {094, 090, 105}, + {106, 085, 056}, + {109, 084, 024}, + {000, 140, 226}, + {000, 120, 194}, + {000, 094, 154}, + {000, 062, 104}, + {047, 045, 052}, + {054, 042, 012}, + {000, 139, 223}, + {000, 118, 190}, + {000, 094, 151}, + {000, 065, 104}, + {000, 033, 053}, + {000, 000, 000}}; + + private int[,] aTritanopiaData = {{244, 240, 255}, + {253, 239, 255}, + {255, 234, 249}, + {255, 230, 245}, + {255, 229, 243}, + {255, 228, 242}, + {251, 209, 225}, + {255, 202, 216}, + {255, 196, 209}, + {255, 192, 205}, + {255, 191, 202}, + {255, 190, 202}, + {246, 169, 181}, + {252, 159, 170}, + {255, 153, 162}, + {255, 149, 158}, + {255, 148, 157}, + {255, 148, 156}, + {242, 135, 145}, + {248, 121, 129}, + {253, 110, 116}, + {255, 102, 108}, + {255, 101, 106}, + {255, 101, 105}, + {240, 113, 120}, + {247, 094, 099}, + {251, 076, 079}, + {254, 061, 062}, + {255, 051, 050}, + {255, 051, 049}, + {240, 106, 113}, + {246, 085, 090}, + {250, 064, 066}, + {253, 043, 040}, + {254, 026, 000}, + {254, 028, 000}, + {203, 239, 255}, + {211, 239, 255}, + {217, 238, 255}, + {221, 238, 255}, + {224, 238, 255}, + {224, 238, 255}, + {198, 209, 225}, + {206, 202, 217}, + {211, 196, 211}, + {215, 193, 207}, + {216, 191, 205}, + {217, 190, 204}, + {191, 169, 182}, + {199, 159, 171}, + {205, 152, 162}, + {208, 146, 157}, + {210, 144, 154}, + {211, 143, 153}, + {187, 135, 145}, + {195, 121, 130}, + {201, 110, 117}, + {204, 101, 108}, + {206, 096, 103}, + {207, 095, 101}, + {184, 113, 120}, + {193, 094, 100}, + {198, 076, 080}, + {202, 061, 063}, + {204, 051, 052}, + {204, 048, 048}, + {183, 106, 113}, + {192, 085, 090}, + {198, 064, 067}, + {202, 043, 043}, + {203, 023, 011}, + {204, 022, 000}, + {166, 239, 255}, + {172, 239, 255}, + {176, 238, 255}, + {180, 238, 255}, + {181, 237, 255}, + {182, 237, 255}, + {145, 209, 225}, + {156, 202, 217}, + {163, 196, 211}, + {168, 193, 207}, + {170, 191, 205}, + {171, 190, 205}, + {134, 169, 182}, + {146, 159, 171}, + {154, 151, 163}, + {159, 146, 157}, + {162, 144, 154}, + {162, 143, 153}, + {126, 135, 145}, + {140, 121, 130}, + {148, 109, 117}, + {154, 101, 108}, + {156, 096, 103}, + {157, 095, 102}, + {122, 112, 120}, + {136, 093, 100}, + {145, 076, 081}, + {150, 061, 064}, + {153, 051, 053}, + {154, 048, 050}, + {121, 106, 113}, + {135, 085, 091}, + {144, 064, 068}, + {150, 043, 044}, + {152, 022, 018}, + {153, 017, 000}, + {136, 239, 255}, + {139, 239, 255}, + {142, 238, 255}, + {144, 238, 255}, + {146, 237, 255}, + {146, 237, 255}, + {087, 209, 225}, + {107, 202, 217}, + {119, 196, 211}, + {126, 193, 207}, + {129, 191, 205}, + {130, 190, 205}, + {062, 169, 182}, + {090, 159, 171}, + {105, 151, 163}, + {113, 146, 157}, + {116, 144, 154}, + {117, 143, 154}, + {034, 135, 145}, + {077, 121, 130}, + {094, 109, 117}, + {103, 101, 108}, + {107, 096, 103}, + {108, 095, 102}, + {000, 113, 121}, + {068, 093, 100}, + {088, 076, 081}, + {098, 061, 065}, + {102, 051, 054}, + {103, 048, 051}, + {000, 107, 115}, + {066, 084, 091}, + {086, 063, 068}, + {096, 043, 045}, + {101, 022, 021}, + {102, 011, 000}, + {116, 239, 255}, + {118, 239, 255}, + {120, 238, 255}, + {121, 238, 255}, + {122, 237, 255}, + {122, 237, 255}, + {000, 209, 224}, + {062, 202, 217}, + {084, 196, 211}, + {094, 193, 207}, + {099, 191, 205}, + {100, 191, 215}, + {000, 171, 183}, + {000, 160, 172}, + {057, 151, 163}, + {073, 146, 157}, + {079, 144, 154}, + {081, 143, 154}, + {000, 144, 153}, + {000, 127, 135}, + {020, 109, 118}, + {053, 101, 109}, + {063, 096, 104}, + {065, 095, 102}, + {000, 129, 135}, + {000, 106, 112}, + {000, 080, 086}, + {038, 060, 065}, + {051, 050, 054}, + {054, 048, 051}, + {000, 124, 130}, + {000, 100, 105}, + {000, 071, 075}, + {033, 042, 045}, + {048, 021, 023}, + {051, 006, 000}, + {110, 239, 255}, + {112, 239, 255}, + {114, 238, 255}, + {115, 238, 255}, + {115, 237, 255}, + {115, 237, 255}, + {000, 208, 223}, + {041, 202, 217}, + {071, 196, 211}, + {084, 193, 207}, + {089, 191, 205}, + {090, 191, 205}, + {000, 172, 183}, + {000, 161, 172}, + {031, 151, 163}, + {057, 146, 157}, + {066, 144, 154}, + {068, 143, 154}, + {000, 146, 154}, + {000, 130, 138}, + {000, 114, 122}, + {021, 101, 109}, + {042, 096, 104}, + {045, 095, 102}, + {000, 131, 137}, + {000, 111, 116}, + {000, 089, 094}, + {000, 067, 071}, + {010, 050, 054}, + {023, 048, 051}, + {000, 127, 133}, + {000, 106, 110}, + {000, 081, 085}, + {000, 055, 057}, + {000, 028, 029}, + {000, 000, 000}}; + #endregion + } +} diff --git a/Chapter 04/ColorCheck/FrmMain.resx b/Chapter 04/ColorCheck/FrmMain.resx new file mode 100644 index 0000000..549a145 --- /dev/null +++ b/Chapter 04/ColorCheck/FrmMain.resx @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + 17, 17 + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + frmMain + + + 80 + + + True + + + Private + + + + AAABAAIAICAQAAAAAADoAgAAJgAAABAQEAAAAAAAKAEAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAAAC + AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ + AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMwAAAAAAAAAAAAAAADM + zMzMzMwAAAAAAAAAAADMzMzMzMzMzAAAAAAAAAAMzMzMzMzMzMzAAAAAAAAMzMzMzMzMzMzMzMAAAAAA + DMzMzMzMzMzMzMzAAAAAAAzMzMzMzMzMzMzMzAAAAAqgDMzMzMzMzMzMzMzAAAAKqqDMzMwAAAzMzMzA + AAAAqqqqAMzMC7sMzMzACZkAAKqqqqoMzAu7DMzACZmZAACqqqqqoAwLuwzACZmZmQAKqqqqqqqgC7sA + CZmZmZmQCqqqqqqqqgu7CZmZmZmZkAqqqqqqqqoLuwmZmZmZmZAKqqqqqqqqC7sJmZmZmZmQCqqqqqqq + qgu7CZmZmZmZkAqqqqqqqqoLuwmZmZmZmZAAqqqqqqqqC7sJmZmZmZkAAKqqqqqqqgu7CZmZmZmZAACq + qqqqqqoLuwmZmZmZmQAACqqqqqAAC7sAAJmZmZAAAAqqqqqgu7u7u7CZmZmQAAAAqqqqoAAAAAAAmZmZ + AAAAAAqqqqqqqgmZmZmZkAAAAAAKqqqqqqoJmZmZmZAAAAAAAAqqqqqqCZmZmZAAAAAAAAAAqqqqqgmZ + mZkAAAAAAAAAAACqqqoJmZkAAAAAAAAAAAAAAACqCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//w////A + A///AAD//gAAf/gAAB/wAAAP8AAAD+AAAAfAAAADwAAAA4AAAAGAAAABgAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAIAAAAGAAAABgAAAAcAAAAPAAAAD4AAAB/AAAA/wAAAP+AAAH/4AAH//AAD//8AD///8 + P/8oAAAAEAAAACAAAAABAAQAAAAAAIAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAA + AACAAIAAgIAAAICAgADAwMAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAMzMzA + AAAAAMwAAAwAAAAKDAu7DMAAAKqgC7sMCQAKqqoLuwCZkAqqqgu7CZmQCqqqC7sJmZAKqqoLuwmZkAqq + AAu7AAmQCqoLu7u7CZAAqgu7u7sJAAAKAAAAAAAAAACqqgmZAAAAAAqqCZAAAAAAAAAAAAAA+B8AAPAP + AADAAwAAwAMAAIABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAMADAADwDwAA+B8AAA== + + + \ No newline at end of file diff --git a/Chapter 04/ColorCheck/bin/Debug/ColorCheck.exe b/Chapter 04/ColorCheck/bin/Debug/ColorCheck.exe new file mode 100644 index 0000000..e8b3e0c Binary files /dev/null and b/Chapter 04/ColorCheck/bin/Debug/ColorCheck.exe differ diff --git a/Chapter 04/ColorCheck/obj/Debug/ColorCheck.exe b/Chapter 04/ColorCheck/obj/Debug/ColorCheck.exe new file mode 100644 index 0000000..e8b3e0c Binary files /dev/null and b/Chapter 04/ColorCheck/obj/Debug/ColorCheck.exe differ diff --git a/Chapter 04/ColorCheck/obj/Debug/ColorCheck.frmMain.resources b/Chapter 04/ColorCheck/obj/Debug/ColorCheck.frmMain.resources new file mode 100644 index 0000000..11198a7 Binary files /dev/null and b/Chapter 04/ColorCheck/obj/Debug/ColorCheck.frmMain.resources differ diff --git a/Chapter 04/ColorCheck/obj/Debug/ColorCheck.projdata b/Chapter 04/ColorCheck/obj/Debug/ColorCheck.projdata new file mode 100644 index 0000000..d9042b7 Binary files /dev/null and b/Chapter 04/ColorCheck/obj/Debug/ColorCheck.projdata differ diff --git a/Chapter 04/SampleColors.bmp b/Chapter 04/SampleColors.bmp new file mode 100644 index 0000000..1fa4083 Binary files /dev/null and b/Chapter 04/SampleColors.bmp differ diff --git a/Chapter 04/SampleColors.gif b/Chapter 04/SampleColors.gif new file mode 100644 index 0000000..266c2c9 Binary files /dev/null and b/Chapter 04/SampleColors.gif differ diff --git a/Chapter 04/SampleColors.png b/Chapter 04/SampleColors.png new file mode 100644 index 0000000..a7d3db9 Binary files /dev/null and b/Chapter 04/SampleColors.png differ diff --git a/Chapter 05/C#/ColorsAndFonts/App.ico b/Chapter 05/C#/ColorsAndFonts/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 05/C#/ColorsAndFonts/App.ico differ diff --git a/Chapter 05/C#/ColorsAndFonts/AssemblyInfo.cs b/Chapter 05/C#/ColorsAndFonts/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 05/C#/ColorsAndFonts/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.csproj b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.csproj new file mode 100644 index 0000000..b48aa47 --- /dev/null +++ b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.csproj @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.csproj.user b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.sln b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.sln new file mode 100644 index 0000000..f9f0957 --- /dev/null +++ b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorsAndFonts", "ColorsAndFonts.csproj", "{23749BD1-807A-4461-9C12-88DB9B5B95B7}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {23749BD1-807A-4461-9C12-88DB9B5B95B7}.Debug.ActiveCfg = Debug|.NET + {23749BD1-807A-4461-9C12-88DB9B5B95B7}.Debug.Build.0 = Debug|.NET + {23749BD1-807A-4461-9C12-88DB9B5B95B7}.Release.ActiveCfg = Release|.NET + {23749BD1-807A-4461-9C12-88DB9B5B95B7}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.suo b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.suo new file mode 100644 index 0000000..3a7d0f2 Binary files /dev/null and b/Chapter 05/C#/ColorsAndFonts/ColorsAndFonts.suo differ diff --git a/Chapter 05/C#/ColorsAndFonts/FrmMain.cs b/Chapter 05/C#/ColorsAndFonts/FrmMain.cs new file mode 100644 index 0000000..492d315 --- /dev/null +++ b/Chapter 05/C#/ColorsAndFonts/FrmMain.cs @@ -0,0 +1,167 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Runtime.InteropServices; + +namespace ColorsAndFonts +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Button btnQuit; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button displays the test information."; + this.btnTest.AccessibleName = "Test Pushbutton"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 0; + this.btnTest.Text = "&Test"; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "Use this button to exit the application."; + this.btnQuit.AccessibleName = "Quit Pushbutton"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 1; + this.btnQuit.Text = "&Quit"; + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // frmMain + // + this.AcceptButton = this.btnTest; + this.AccessibleDescription = "This application helps you understand the use of colors and fonts in an applicati" + + "on."; + this.AccessibleName = "Colors and Fonts Demonstration."; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnQuit); + this.Controls.Add(this.btnTest); + this.Name = "frmMain"; + this.Text = "Colors and Fonts Demonstration"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + Font DefFont; // Current font requirement. + Size BtnSize; // Current button size. + Size DlgSize; // Current dialog size. + Point TestLoc; // Current Test button location. + Point QuitLoc; // Current Quit button location. + + // Obtain the default font for our example. + // Begin by determining the screen state. + if (SystemInformation.HighContrast) + { + DefFont = SystemInformation.MenuFont; + BtnSize = new Size(135, 42); + DlgSize = new Size(540, 540); + TestLoc = new Point(374, 14); + QuitLoc = new Point(374, 72); + } + // Use the default sizes. + else + { + DefFont = this.Font; + BtnSize = new Size(75, 23); + DlgSize = new Size(300, 300); + TestLoc = new Point(208, 8); + QuitLoc = new Point(208, 40); + } + + // Modify the display fonts. + btnTest.Font = DefFont; + btnQuit.Font = DefFont; + + // Modify the sizes. + btnTest.Size = BtnSize; + btnQuit.Size = BtnSize; + frmMain.ActiveForm.Size = DlgSize; + + // Modify the positions. + btnTest.Location = TestLoc; + btnQuit.Location = QuitLoc; + + // Display the information. + MessageBox.Show("Name: " + DefFont.Name + + "\r\nSize: " + DefFont.SizeInPoints.ToString(), + "Font Information", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } +} diff --git a/Chapter 05/C#/ColorsAndFonts/FrmMain.resx b/Chapter 05/C#/ColorsAndFonts/FrmMain.resx new file mode 100644 index 0000000..b545ce0 --- /dev/null +++ b/Chapter 05/C#/ColorsAndFonts/FrmMain.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Private + + + frmMain + + \ No newline at end of file diff --git a/Chapter 05/C#/ColorsAndFonts/bin/Debug/ColorsAndFonts.exe b/Chapter 05/C#/ColorsAndFonts/bin/Debug/ColorsAndFonts.exe new file mode 100644 index 0000000..082b071 Binary files /dev/null and b/Chapter 05/C#/ColorsAndFonts/bin/Debug/ColorsAndFonts.exe differ diff --git a/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.exe b/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.exe new file mode 100644 index 0000000..082b071 Binary files /dev/null and b/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.exe differ diff --git a/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.frmMain.resources b/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.frmMain.resources new file mode 100644 index 0000000..b5f1977 Binary files /dev/null and b/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.frmMain.resources differ diff --git a/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.projdata b/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.projdata new file mode 100644 index 0000000..158ec31 Binary files /dev/null and b/Chapter 05/C#/ColorsAndFonts/obj/Debug/ColorsAndFonts.projdata differ diff --git a/Chapter 05/C#/DevCaps/App.ico b/Chapter 05/C#/DevCaps/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 05/C#/DevCaps/App.ico differ diff --git a/Chapter 05/C#/DevCaps/AssemblyInfo.cs b/Chapter 05/C#/DevCaps/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 05/C#/DevCaps/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 05/C#/DevCaps/DevCaps.csproj b/Chapter 05/C#/DevCaps/DevCaps.csproj new file mode 100644 index 0000000..0fe25eb --- /dev/null +++ b/Chapter 05/C#/DevCaps/DevCaps.csproj @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/C#/DevCaps/DevCaps.csproj.user b/Chapter 05/C#/DevCaps/DevCaps.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 05/C#/DevCaps/DevCaps.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/C#/DevCaps/DevCaps.sln b/Chapter 05/C#/DevCaps/DevCaps.sln new file mode 100644 index 0000000..4917f0c --- /dev/null +++ b/Chapter 05/C#/DevCaps/DevCaps.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevCaps", "DevCaps.csproj", "{75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Debug.ActiveCfg = Debug|.NET + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Debug.Build.0 = Debug|.NET + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Release.ActiveCfg = Release|.NET + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/DevCaps/DevCaps.sln.old b/Chapter 05/C#/DevCaps/DevCaps.sln.old new file mode 100644 index 0000000..4a28eb2 --- /dev/null +++ b/Chapter 05/C#/DevCaps/DevCaps.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevCaps", "DevCaps.csproj", "{75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Debug.ActiveCfg = Debug|.NET + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Debug.Build.0 = Debug|.NET + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Release.ActiveCfg = Release|.NET + {75B95561-DFBC-4F56-9E4C-13C07AAC7EB4}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/DevCaps/DevCaps.suo b/Chapter 05/C#/DevCaps/DevCaps.suo new file mode 100644 index 0000000..e7385dc Binary files /dev/null and b/Chapter 05/C#/DevCaps/DevCaps.suo differ diff --git a/Chapter 05/C#/DevCaps/FrmMain.cs b/Chapter 05/C#/DevCaps/FrmMain.cs new file mode 100644 index 0000000..56aa97d --- /dev/null +++ b/Chapter 05/C#/DevCaps/FrmMain.cs @@ -0,0 +1,365 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Runtime.InteropServices; +using System.Text; + +namespace DevCaps +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.ToolTip toolTipData; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnQuit = new System.Windows.Forms.Button(); + this.btnTest = new System.Windows.Forms.Button(); + this.toolTipData = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "Click this button to exit the application."; + this.btnQuit.AccessibleName = "Quit Pushbutton"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 1; + this.btnQuit.Text = "&Quit"; + this.toolTipData.SetToolTip(this.btnQuit, "Click this button to exit the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // btnTest + // + this.btnTest.AccessibleDescription = "Click this button to display the test information."; + this.btnTest.AccessibleName = "Test Pushbutton"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 0; + this.btnTest.Text = "&Test"; + this.toolTipData.SetToolTip(this.btnTest, "Click this button to display the test information."); + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // toolTipData + // + this.toolTipData.AutomaticDelay = 300; + this.toolTipData.AutoPopDelay = 5000; + this.toolTipData.InitialDelay = 300; + this.toolTipData.ReshowDelay = 60; + this.toolTipData.ShowAlways = true; + // + // frmMain + // + this.AccessibleDescription = "This application returns values associated with the display."; + this.AccessibleName = "Get Device Capabilities Demonstration"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "GetDeviceCaps() Demonstration"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + // The purpose of this function is to retrieve a device context; + // essentially a drawing area for the application. + [DllImport("User32.DLL", CharSet=CharSet.Auto, SetLastError=true )] + public static extern IntPtr GetDC(IntPtr hWnd); + + // Use this function to release the device context. + [DllImport("User32.DLL", CharSet=CharSet.Auto, SetLastError=true )] + public static extern Int32 ReleaseDC(IntPtr hWnd, IntPtr hDC); + + /* Device Parameters for GetDeviceCaps() */ + public enum DevCapParm + { + // General device capabilities. + DRIVERVERSION = 0, /* Device driver version */ + TECHNOLOGY = 2, /* Device classification */ + HORZSIZE = 4, /* Horizontal size in millimeters */ + VERTSIZE = 6, /* Vertical size in millimeters */ + HORZRES = 8, /* Horizontal width in pixels */ + VERTRES = 10, /* Vertical height in pixels */ + BITSPIXEL = 12, /* Number of bits per pixel */ + PLANES = 14, /* Number of planes */ + NUMBRUSHES = 16, /* Number of brushes the device has */ + NUMPENS = 18, /* Number of pens the device has */ + NUMMARKERS = 20, /* Number of markers the device has */ + NUMFONTS = 22, /* Number of fonts the device has */ + NUMCOLORS = 24, /* Number of colors the device supports */ + PDEVICESIZE = 26, /* Size required for device descriptor */ + CURVECAPS = 28, /* Curve capabilities */ + LINECAPS = 30, /* Line capabilities */ + POLYGONALCAPS = 32, /* Polygonal capabilities */ + TEXTCAPS = 34, /* Text capabilities */ + CLIPCAPS = 36, /* Clipping capabilities */ + RASTERCAPS = 38, /* Bitblt capabilities */ + ASPECTX = 40, /* Length of the X leg */ + ASPECTY = 42, /* Length of the Y leg */ + ASPECTXY = 44, /* Length of the hypotenuse */ + LOGPIXELSX = 88, /* Logical pixels/inch in X */ + LOGPIXELSY = 90, /* Logical pixels/inch in Y */ + SIZEPALETTE = 104, /* Number of entries in physical palette */ + NUMRESERVED = 106, /* Number of reserved entries in palette */ + COLORRES = 108, /* Actual color resolution */ + + // Printing related DeviceCaps. These replace the appropriate Escapes + PHYSICALWIDTH = 110, /* Physical Width in device units */ + PHYSICALHEIGHT = 111, /* Physical Height in device units */ + PHYSICALOFFSETX = 112, /* Physical Printable Area x margin */ + PHYSICALOFFSETY = 113, /* Physical Printable Area y margin */ + SCALINGFACTORX = 114, /* Scaling factor x */ + SCALINGFACTORY = 115, /* Scaling factor y */ + + // Display driver specific + VREFRESH = 116, /* Current vertical refresh rate of the */ + /* display device (for displays only) in Hz*/ + DESKTOPVERTRES = 117, /* Horizontal width of entire desktop in */ + /* pixels */ + DESKTOPHORZRES = 118, /* Vertical height of entire desktop in */ + /* pixels */ + BLTALIGNMENT = 119, /* Preferred blt alignment */ + + SHADEBLENDCAPS = 120, /* Shading and blending caps */ + COLORMGMTCAPS = 121, /* Color Management caps */ + } + + /* Device Capability Masks: */ + + /* Device Technologies */ + public enum DevTech + { + DT_PLOTTER = 0, /* Vector plotter */ + DT_RASDISPLAY = 1, /* Raster display */ + DT_RASPRINTER = 2, /* Raster printer */ + DT_RASCAMERA = 3, /* Raster camera */ + DT_CHARSTREAM = 4, /* Character-stream, PLP */ + DT_METAFILE = 5, /* Metafile, VDM */ + DT_DISPFILE = 6 /* Display-file */ + } + + /* Curve Capabilities */ + public enum CurveCap + { + CC_NONE = 0, /* Curves not supported */ + CC_CIRCLES = 1, /* Can do circles */ + CC_PIE = 2, /* Can do pie wedges */ + CC_CHORD = 4, /* Can do chord arcs */ + CC_ELLIPSES = 8, /* Can do ellipese */ + CC_WIDE = 16, /* Can do wide lines */ + CC_STYLED = 32, /* Can do styled lines */ + CC_WIDESTYLED = 64, /* Can do wide styled lines */ + CC_INTERIORS = 128, /* Can do interiors */ + CC_ROUNDRECT = 256 /* */ + } + + /* Line Capabilities */ + public enum LineCap + { + LC_NONE = 0, /* Lines not supported */ + LC_POLYLINE = 2, /* Can do polylines */ + LC_MARKER = 4, /* Can do markers */ + LC_POLYMARKER = 8, /* Can do polymarkers */ + LC_WIDE = 16, /* Can do wide lines */ + LC_STYLED = 32, /* Can do styled lines */ + LC_WIDESTYLED = 64, /* Can do wide styled lines */ + LC_INTERIORS = 128 /* Can do interiors */ + } + + /* Polygonal Capabilities */ + public enum PolygonCap + { + PC_NONE = 0, /* Polygonals not supported */ + PC_POLYGON = 1, /* Can do polygons */ + PC_RECTANGLE = 2, /* Can do rectangles */ + PC_WINDPOLYGON = 4, /* Can do winding polygons */ + PC_TRAPEZOID = 4, /* Can do trapezoids */ + PC_SCANLINE = 8, /* Can do scanlines */ + PC_WIDE = 16, /* Can do wide borders */ + PC_STYLED = 32, /* Can do styled borders */ + PC_WIDESTYLED = 64, /* Can do wide styled borders */ + PC_INTERIORS = 128, /* Can do interiors */ + PC_POLYPOLYGON = 256, /* Can do polypolygons */ + PC_PATHS = 512 /* Can do paths */ + } + + /* Clipping Capabilities */ + public enum ClippingCap + { + CP_NONE = 0, /* No clipping of output */ + CP_RECTANGLE = 1, /* Output clipped to rects */ + CP_REGION = 2 /* obsolete */ + } + + /* Text Capabilities */ + public enum TextCap + { + TC_OP_CHARACTER = 0x00000001, /* Can do OutputPrecision CHARACTER */ + TC_OP_STROKE = 0x00000002, /* Can do OutputPrecision STROKE */ + TC_CP_STROKE = 0x00000004, /* Can do ClipPrecision STROKE */ + TC_CR_90 = 0x00000008, /* Can do CharRotAbility 90 */ + TC_CR_ANY = 0x00000010, /* Can do CharRotAbility ANY */ + TC_SF_X_YINDEP = 0x00000020, /* Can do ScaleFreedom X_YINDEPENDENT */ + TC_SA_DOUBLE = 0x00000040, /* Can do ScaleAbility DOUBLE */ + TC_SA_INTEGER = 0x00000080, /* Can do ScaleAbility INTEGER */ + TC_SA_CONTIN = 0x00000100, /* Can do ScaleAbility CONTINUOUS */ + TC_EA_DOUBLE = 0x00000200, /* Can do EmboldenAbility DOUBLE */ + TC_IA_ABLE = 0x00000400, /* Can do ItalisizeAbility ABLE */ + TC_UA_ABLE = 0x00000800, /* Can do UnderlineAbility ABLE */ + TC_SO_ABLE = 0x00001000, /* Can do StrikeOutAbility ABLE */ + TC_RA_ABLE = 0x00002000, /* Can do RasterFontAble ABLE */ + TC_VA_ABLE = 0x00004000, /* Can do VectorFontAble ABLE */ + TC_RESERVED = 0x00008000, + TC_SCROLLBLT = 0x00010000 /* Don't do text scroll with blt */ + } + + /* Raster Capabilities */ + public enum RasterCap + { + RC_NONE = 0, + RC_BITBLT = 1, /* Can do standard BLT. */ + RC_BANDING = 2, /* Device requires banding support */ + RC_SCALING = 4, /* Device requires scaling support */ + RC_BITMAP64 = 8, /* Device can support >64K bitmap */ + RC_GDI20_OUTPUT = 0x0010, /* has 2.0 output calls */ + RC_GDI20_STATE = 0x0020, + RC_SAVEBITMAP = 0x0040, + RC_DI_BITMAP = 0x0080, /* supports DIB to memory */ + RC_PALETTE = 0x0100, /* supports a palette */ + RC_DIBTODEV = 0x0200, /* supports DIBitsToDevice */ + RC_BIGFONT = 0x0400, /* supports >64K fonts */ + RC_STRETCHBLT = 0x0800, /* supports StretchBlt */ + RC_FLOODFILL = 0x1000, /* supports FloodFill */ + RC_STRETCHDIB = 0x2000, /* supports StretchDIBits */ + RC_OP_DX_OUTPUT = 0x4000, + RC_DEVBITS = 0x8000 + } + + /* Shading and blending caps */ + public enum ShadeAndBlendCap + { + SB_NONE = 0x00000000, + SB_CONST_ALPHA = 0x00000001, + SB_PIXEL_ALPHA = 0x00000002, + SB_PREMULT_ALPHA = 0x00000004, + SB_GRAD_RECT = 0x00000010, + SB_GRAD_TRI = 0x00000020 + } + + /* Color Management caps */ + public enum ColorMngCap + { + CM_NONE = 0x00000000, + CM_DEVICE_ICM = 0x00000001, + CM_GAMMA_RAMP = 0x00000002, + CM_CMYK_COLOR = 0x00000004 + } + + // This function returns the device capability value specified + // by the requested index value. + [DllImport("GDI32.DLL", CharSet=CharSet.Auto, SetLastError=true )] + public static extern Int32 GetDeviceCaps(IntPtr hdc, Int32 nIndex); + + private void btnTest_Click(object sender, System.EventArgs e) + { + IntPtr hDC; // Device context for current window. + Int32 Result; // The result of the call. + StringBuilder Output; // The output for the method. + + // Obtain a device context for the current application. + hDC = GetDC(this.Handle); + + // Check for errors. + if (hDC == IntPtr.Zero) + { + // Display an error message. + MessageBox.Show("Couldn't obtain device context!", + "Application Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + return; + } + + // Obtain the current display capability. + Output = new StringBuilder(); + Result = GetDeviceCaps(hDC, (Int32)DevCapParm.DESKTOPHORZRES); + Output.Append("The horizontal resolution: " + Result.ToString()); + Result = GetDeviceCaps(hDC, (Int32)DevCapParm.DESKTOPVERTRES); + Output.Append("\r\nThe vertical resolution: " + Result.ToString()); + Result = GetDeviceCaps(hDC, (Int32)DevCapParm.BITSPIXEL); + Output.Append("\r\nThe bits/pixel value: " + Result.ToString()); + + // Display the results. + MessageBox.Show(Output.ToString(), + "Current Display Capabilities", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + + // Release the device context when finished. + ReleaseDC(this.Handle, hDC); + } + } +} diff --git a/Chapter 05/C#/DevCaps/FrmMain.resx b/Chapter 05/C#/DevCaps/FrmMain.resx new file mode 100644 index 0000000..482a4b0 --- /dev/null +++ b/Chapter 05/C#/DevCaps/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + Private + + + 17, 17 + + + Private + + + False + + + True + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 05/C#/DevCaps/bin/Debug/DevCaps.exe b/Chapter 05/C#/DevCaps/bin/Debug/DevCaps.exe new file mode 100644 index 0000000..7b756f6 Binary files /dev/null and b/Chapter 05/C#/DevCaps/bin/Debug/DevCaps.exe differ diff --git a/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.exe b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.exe new file mode 100644 index 0000000..7b756f6 Binary files /dev/null and b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.exe differ diff --git a/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.exe.incr b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.exe.incr new file mode 100644 index 0000000..4be0fae Binary files /dev/null and b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.exe.incr differ diff --git a/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.frmMain.resources b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.frmMain.resources new file mode 100644 index 0000000..f782e28 Binary files /dev/null and b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.frmMain.resources differ diff --git a/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.projdata b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.projdata new file mode 100644 index 0000000..12933fa Binary files /dev/null and b/Chapter 05/C#/DevCaps/obj/Debug/DevCaps.projdata differ diff --git a/Chapter 05/C#/NUnitDemo/App.ico b/Chapter 05/C#/NUnitDemo/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/App.ico differ diff --git a/Chapter 05/C#/NUnitDemo/AssemblyInfo.cs b/Chapter 05/C#/NUnitDemo/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 05/C#/NUnitDemo/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 05/C#/NUnitDemo/Class1.cs b/Chapter 05/C#/NUnitDemo/Class1.cs new file mode 100644 index 0000000..0700daa --- /dev/null +++ b/Chapter 05/C#/NUnitDemo/Class1.cs @@ -0,0 +1,206 @@ +using System; +using NUnit.Framework; + +namespace NUnitDemo +{ + /// + /// Summary description for Class1. + /// + class MathCheck + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main(string[] args) + { + string Value1Input; + string Value2Input; + string ResultOutput; + + // Get some input. + Console.Write("Type the first input value: "); + Value1Input = Console.ReadLine(); + Console.Write("Type the second input value: "); + Value2Input = Console.ReadLine(); + + // Perform the add operation. + ResultOutput = DoAdd(Value1Input, Value2Input); + Console.WriteLine("The Add Ouput is: {0}", ResultOutput); + + // Perform the subtract operation. + ResultOutput = DoSubtract(Value1Input, Value2Input); + Console.WriteLine("The Subtract Ouput is: {0}", ResultOutput); + + // Perform the multiply operation. + ResultOutput = DoMultiply(Value1Input, Value2Input); + Console.WriteLine("The Multiply Ouput is: {0}", ResultOutput); + + // Perform the divide operation. + ResultOutput = DoDivide(Value1Input, Value2Input); + Console.WriteLine("The Divide Ouput is: {0}", ResultOutput); + + // Wait for the user to press Enter. + Console.Write("Press any key when ready..."); + Console.ReadLine(); + } + + public static string DoAdd(string Input1, string Input2) + { + int Value1; + int Value2; + int Result; + + // Convert the strings. + Value1 = Int32.Parse(Input1); + Value2 = Int32.Parse(Input2); + + // Perform the addition. + Result = Value1 + Value2; + + // Output the result. + return Result.ToString(); + } + + public static string DoSubtract(string Input1, string Input2) + { + int Value1; + int Value2; + int Result; + + // Convert the strings. + Value1 = Int32.Parse(Input1); + Value2 = Int32.Parse(Input2); + + // Perform the addition. + Result = Value2 - Value1; + + // Output the result. + return Result.ToString(); + } + + public static string DoMultiply(string Input1, string Input2) + { + int Value1; + int Value2; + int Result; + + // Convert the strings. + Value1 = Int32.Parse(Input1); + Value2 = Int32.Parse(Input2); + + // Perform the addition. + Result = Value1 * Value2; + + // Output the result. + return Result.ToString(); + } + + public static string DoDivide(string Input1, string Input2) + { + int Value1; + int Value2; + int Result; + + // Convert the strings. + Value1 = Int32.Parse(Input1); + Value2 = Int32.Parse(Input2); + + // Perform the addition. + Result = Value1 / Value2; + + // Output the result. + return Result.ToString(); + } + } + + public class MathCheckTest: TestCase + { + // The test class must include a constructor + // that accepts a string as input. + public MathCheckTest(String name) : base(name) + { + } + + // Test the add function using a simple example. + public void TestAdd() + { + string Expected = "5"; + string Result = MathCheck.DoAdd("2", "3"); + Assert(Expected.Equals(Result)); + } + + // Test the subtract function using a simple example. + public void TestSubtract() + { + string Expected = "1"; + string Result = MathCheck.DoSubtract("3", "2"); + Assert(Expected.Equals(Result)); + } + + // Test the multiply function using a simple example. + public void TestMultiply() + { + string Expected = "6"; + string Result = MathCheck.DoMultiply("2", "3"); + Assert(Expected.Equals(Result)); + } + + // Test the divide function using a simple example. In + // some cases you need multiple tests. This one performs + // a normal divide. + public void TestDivide1() + { + string Expected = "2"; + string Result = MathCheck.DoDivide("6", "3"); + Assert(Expected.Equals(Result)); + } + + // This second divide test checks for a proper divide by + // zero response. + public void TestDivide2() + { + string Expected = "0"; + string Result = MathCheck.DoDivide("6", "0"); + Assert(Expected.Equals(Result)); + } + + // You must define a suite of tests to perform. + public static ITest Suite + { + get + { + return new TestSuite(typeof (MathCheckTest)); + } + } + } + + public class DivideByZeroTest: TestCase + { + // The test class must include a constructor + // that accepts a string as input. + public DivideByZeroTest(String name) : base(name) + { + } + + // Even if you only have one test in the suite, you + // still need to define the test suite. + public static ITest Suite + { + get + { + return new TestSuite(typeof (MathCheckTest)); + } + } + + // Sometimes it pays to place a test in a separate + // class so you can check just that functionality. + public void TestDivideByZero() + { + string Expected = "0"; + string Result = MathCheck.DoDivide("6", "0"); + Assert(Expected.Equals(Result)); + } + } +} + diff --git a/Chapter 05/C#/NUnitDemo/NUnitDemo.csproj b/Chapter 05/C#/NUnitDemo/NUnitDemo.csproj new file mode 100644 index 0000000..a80624b --- /dev/null +++ b/Chapter 05/C#/NUnitDemo/NUnitDemo.csproj @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/C#/NUnitDemo/NUnitDemo.csproj.user b/Chapter 05/C#/NUnitDemo/NUnitDemo.csproj.user new file mode 100644 index 0000000..3297e94 --- /dev/null +++ b/Chapter 05/C#/NUnitDemo/NUnitDemo.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/C#/NUnitDemo/NUnitDemo.sln b/Chapter 05/C#/NUnitDemo/NUnitDemo.sln new file mode 100644 index 0000000..eacf0ce --- /dev/null +++ b/Chapter 05/C#/NUnitDemo/NUnitDemo.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnitDemo", "NUnitDemo.csproj", "{B0B2958A-5E67-47E1-816D-A6647D05A9CB}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Debug.ActiveCfg = Debug|.NET + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Debug.Build.0 = Debug|.NET + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Release.ActiveCfg = Release|.NET + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/NUnitDemo/NUnitDemo.sln.old b/Chapter 05/C#/NUnitDemo/NUnitDemo.sln.old new file mode 100644 index 0000000..26412d4 --- /dev/null +++ b/Chapter 05/C#/NUnitDemo/NUnitDemo.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnitDemo", "NUnitDemo.csproj", "{B0B2958A-5E67-47E1-816D-A6647D05A9CB}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Debug.ActiveCfg = Debug|.NET + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Debug.Build.0 = Debug|.NET + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Release.ActiveCfg = Release|.NET + {B0B2958A-5E67-47E1-816D-A6647D05A9CB}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/NUnitDemo/NUnitDemo.suo b/Chapter 05/C#/NUnitDemo/NUnitDemo.suo new file mode 100644 index 0000000..f8b7745 Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/NUnitDemo.suo differ diff --git a/Chapter 05/C#/NUnitDemo/bin/Debug/NUnitCore.dll b/Chapter 05/C#/NUnitDemo/bin/Debug/NUnitCore.dll new file mode 100644 index 0000000..0f1873c Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/bin/Debug/NUnitCore.dll differ diff --git a/Chapter 05/C#/NUnitDemo/bin/Debug/NUnitDemo.exe b/Chapter 05/C#/NUnitDemo/bin/Debug/NUnitDemo.exe new file mode 100644 index 0000000..8561c09 Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/bin/Debug/NUnitDemo.exe differ diff --git a/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.exe b/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.exe new file mode 100644 index 0000000..8561c09 Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.exe differ diff --git a/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.exe.incr b/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.exe.incr new file mode 100644 index 0000000..acf68e3 Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.exe.incr differ diff --git a/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.projdata b/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.projdata new file mode 100644 index 0000000..b97462c Binary files /dev/null and b/Chapter 05/C#/NUnitDemo/obj/Debug/NUnitDemo.projdata differ diff --git a/Chapter 05/C#/ProfilerTest/App.ico b/Chapter 05/C#/ProfilerTest/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/App.ico differ diff --git a/Chapter 05/C#/ProfilerTest/AssemblyInfo.cs b/Chapter 05/C#/ProfilerTest/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 05/C#/ProfilerTest/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 05/C#/ProfilerTest/FrmMain.cs b/Chapter 05/C#/ProfilerTest/FrmMain.cs new file mode 100644 index 0000000..af99bde --- /dev/null +++ b/Chapter 05/C#/ProfilerTest/FrmMain.cs @@ -0,0 +1,196 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Threading; + +namespace ProfilerTest +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtCycles; + private System.Windows.Forms.TextBox txtSleep; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtCurrent; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnQuit = new System.Windows.Forms.Button(); + this.btnTest = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtCycles = new System.Windows.Forms.TextBox(); + this.txtSleep = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtCurrent = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "Click this button to exit the application."; + this.btnQuit.AccessibleName = "Application Exit"; + this.btnQuit.Location = new System.Drawing.Point(208, 8); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 0; + this.btnQuit.Text = "&Quit"; + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // btnTest + // + this.btnTest.AccessibleDescription = "Click this button to test the application."; + this.btnTest.AccessibleName = "Application Test"; + this.btnTest.Location = new System.Drawing.Point(208, 40); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 1; + this.btnTest.Text = "&Test"; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // label1 + // + this.label1.AccessibleDescription = "Number of times to run the loop within the application."; + this.label1.AccessibleName = "Application Cycles"; + this.label1.Location = new System.Drawing.Point(8, 8); + this.label1.Name = "label1"; + this.label1.TabIndex = 2; + this.label1.Text = "&Number of Cycles:"; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 64); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(144, 23); + this.label2.TabIndex = 4; + this.label2.Text = "&Sleep Time (Milliseconds):"; + // + // txtCycles + // + this.txtCycles.Location = new System.Drawing.Point(8, 24); + this.txtCycles.Name = "txtCycles"; + this.txtCycles.TabIndex = 3; + this.txtCycles.Text = "5"; + // + // txtSleep + // + this.txtSleep.AccessibleDescription = "Amount of time the application should sleep for each cycle."; + this.txtSleep.AccessibleName = "Application Sleep"; + this.txtSleep.Location = new System.Drawing.Point(8, 80); + this.txtSleep.Name = "txtSleep"; + this.txtSleep.TabIndex = 5; + this.txtSleep.Text = "1000"; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(8, 120); + this.label3.Name = "label3"; + this.label3.TabIndex = 6; + this.label3.Text = "Current Cycle:"; + // + // txtCurrent + // + this.txtCurrent.AccessibleDescription = "Current application test cycle. Displays Done when complete."; + this.txtCurrent.AccessibleName = "Application Test Cycle"; + this.txtCurrent.Location = new System.Drawing.Point(8, 136); + this.txtCurrent.Name = "txtCurrent"; + this.txtCurrent.ReadOnly = true; + this.txtCurrent.TabIndex = 7; + this.txtCurrent.TabStop = false; + this.txtCurrent.Text = "Not Run"; + // + // frmMain + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.txtCurrent, + this.label3, + this.txtSleep, + this.txtCycles, + this.label2, + this.label1, + this.btnTest, + this.btnQuit}); + this.Name = "frmMain"; + this.Text = "DevPartner Profiler Test"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + //Exit the application. + Close(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + // Loop a few times. + for (int Counter = 1; Counter <= Int32.Parse(txtCycles.Text); Counter++) + { + // Display some text on screen. + txtCurrent.Text = Counter.ToString(); + txtCurrent.Update(); + + // Cause the application to sleep. + System.Threading.Thread.Sleep(Int32.Parse(txtSleep.Text)); + } + + // Tell the user we're finished. + txtCurrent.Text = "Done"; + } + } +} diff --git a/Chapter 05/C#/ProfilerTest/FrmMain.resx b/Chapter 05/C#/ProfilerTest/FrmMain.resx new file mode 100644 index 0000000..2314113 --- /dev/null +++ b/Chapter 05/C#/ProfilerTest/FrmMain.resx @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + frmMain + + \ No newline at end of file diff --git a/Chapter 05/C#/ProfilerTest/ProfilerTest.csproj b/Chapter 05/C#/ProfilerTest/ProfilerTest.csproj new file mode 100644 index 0000000..adc0a89 --- /dev/null +++ b/Chapter 05/C#/ProfilerTest/ProfilerTest.csproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/C#/ProfilerTest/ProfilerTest.csproj.user b/Chapter 05/C#/ProfilerTest/ProfilerTest.csproj.user new file mode 100644 index 0000000..e1f4628 --- /dev/null +++ b/Chapter 05/C#/ProfilerTest/ProfilerTest.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/C#/ProfilerTest/ProfilerTest.sln b/Chapter 05/C#/ProfilerTest/ProfilerTest.sln new file mode 100644 index 0000000..0b4621f --- /dev/null +++ b/Chapter 05/C#/ProfilerTest/ProfilerTest.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfilerTest", "ProfilerTest.csproj", "{2F777FB0-02DF-4D73-9980-304C8FB8C267}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {2F777FB0-02DF-4D73-9980-304C8FB8C267}.Debug.ActiveCfg = Debug|.NET + {2F777FB0-02DF-4D73-9980-304C8FB8C267}.Debug.Build.0 = Debug|.NET + {2F777FB0-02DF-4D73-9980-304C8FB8C267}.Release.ActiveCfg = Release|.NET + {2F777FB0-02DF-4D73-9980-304C8FB8C267}.Release.Build.0 = Release|.NET + {110FE3E0-9B08-420A-BAF8-06FF3E77EEA1}.Debug.ActiveCfg = Debug|Win32 + {110FE3E0-9B08-420A-BAF8-06FF3E77EEA1}.Release.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + DPBuild = 5 + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/ProfilerTest/ProfilerTest.suo b/Chapter 05/C#/ProfilerTest/ProfilerTest.suo new file mode 100644 index 0000000..e8c40a8 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/ProfilerTest.suo differ diff --git a/Chapter 05/C#/ProfilerTest/bin/Debug/ProfilerTest.dpsession b/Chapter 05/C#/ProfilerTest/bin/Debug/ProfilerTest.dpsession new file mode 100644 index 0000000..33f64d4 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/bin/Debug/ProfilerTest.dpsession differ diff --git a/Chapter 05/C#/ProfilerTest/bin/Debug/ProfilerTest.exe b/Chapter 05/C#/ProfilerTest/bin/Debug/ProfilerTest.exe new file mode 100644 index 0000000..499e0e9 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/bin/Debug/ProfilerTest.exe differ diff --git a/Chapter 05/C#/ProfilerTest/bin/Release/ProfilerTest.exe b/Chapter 05/C#/ProfilerTest/bin/Release/ProfilerTest.exe new file mode 100644 index 0000000..ac283f8 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/bin/Release/ProfilerTest.exe differ diff --git a/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.exe b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.exe new file mode 100644 index 0000000..499e0e9 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.exe differ diff --git a/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.exe.incr b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.exe.incr new file mode 100644 index 0000000..cf6c1b7 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.exe.incr differ diff --git a/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.frmMain.resources b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.frmMain.resources new file mode 100644 index 0000000..864059a Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.frmMain.resources differ diff --git a/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.projdata b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.projdata new file mode 100644 index 0000000..4a481ce Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/obj/Debug/ProfilerTest.projdata differ diff --git a/Chapter 05/C#/ProfilerTest/obj/Release/ProfilerTest.exe b/Chapter 05/C#/ProfilerTest/obj/Release/ProfilerTest.exe new file mode 100644 index 0000000..ac283f8 Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/obj/Release/ProfilerTest.exe differ diff --git a/Chapter 05/C#/ProfilerTest/obj/Release/ProfilerTest.projdata b/Chapter 05/C#/ProfilerTest/obj/Release/ProfilerTest.projdata new file mode 100644 index 0000000..c9c389f Binary files /dev/null and b/Chapter 05/C#/ProfilerTest/obj/Release/ProfilerTest.projdata differ diff --git a/Chapter 05/C#/TestAccessibility/App.ico b/Chapter 05/C#/TestAccessibility/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 05/C#/TestAccessibility/App.ico differ diff --git a/Chapter 05/C#/TestAccessibility/AssemblyInfo.cs b/Chapter 05/C#/TestAccessibility/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 05/C#/TestAccessibility/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 05/C#/TestAccessibility/FrmMain.cs b/Chapter 05/C#/TestAccessibility/FrmMain.cs new file mode 100644 index 0000000..9784803 --- /dev/null +++ b/Chapter 05/C#/TestAccessibility/FrmMain.cs @@ -0,0 +1,154 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using Accessibility; + +namespace TestAccessibility +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.ToolTip toolTipData; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // Required for Windows Form Designer support + InitializeComponent(); + + // Set the AccessibleDefaultActionDescription property + // values for this application. + btnQuit.AccessibleDefaultActionDescription = + "Press to quit the application."; + btnTest.AccessibleDefaultActionDescription = + "Press to perform the application test function."; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnQuit = new System.Windows.Forms.Button(); + this.btnTest = new System.Windows.Forms.Button(); + this.toolTipData = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Quit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 1; + this.btnQuit.Text = "&Quit"; + this.toolTipData.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + this.btnQuit.Enter += new System.EventHandler(this.TestEnter); + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button starts the test function of the application."; + this.btnTest.AccessibleName = "Application Test"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 0; + this.btnTest.Text = "&Test"; + this.toolTipData.SetToolTip(this.btnTest, "This button starts the test function of the application."); + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + this.btnTest.Enter += new System.EventHandler(this.TestEnter); + // + // toolTipData + // + this.toolTipData.AutomaticDelay = 300; + this.toolTipData.AutoPopDelay = 5000; + this.toolTipData.InitialDelay = 300; + this.toolTipData.ReshowDelay = 60; + // + // frmMain + // + this.AcceptButton = this.btnTest; + this.AccessibleDescription = "This form contains controls that demonstration how to use the Accessibility names" + + "pace."; + this.AccessibleName = "Accessibility Test"; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "Accessibility Namespace Test"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + // Display a message box. + MessageBox.Show("This is a test message.", + "Test Message", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void TestEnter(object sender, System.EventArgs e) + { + Control Ctrl; // Control sending information. + + // Show the current accessibility information. + Ctrl = (Control)sender; + MessageBox.Show("Name = " + Ctrl.AccessibleName + + "\r\nRole = " + Ctrl.AccessibleRole + + "\r\nDescription = " + Ctrl.AccessibleDescription + + "\r\nDefault Action = " + + Ctrl.AccessibleDefaultActionDescription, + "Accessibility Information", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } +} diff --git a/Chapter 05/C#/TestAccessibility/FrmMain.resx b/Chapter 05/C#/TestAccessibility/FrmMain.resx new file mode 100644 index 0000000..42e75b8 --- /dev/null +++ b/Chapter 05/C#/TestAccessibility/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 17, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + frmMain + + + Private + + \ No newline at end of file diff --git a/Chapter 05/C#/TestAccessibility/TestAccessibility.csproj b/Chapter 05/C#/TestAccessibility/TestAccessibility.csproj new file mode 100644 index 0000000..c6860b8 --- /dev/null +++ b/Chapter 05/C#/TestAccessibility/TestAccessibility.csproj @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/C#/TestAccessibility/TestAccessibility.csproj.user b/Chapter 05/C#/TestAccessibility/TestAccessibility.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 05/C#/TestAccessibility/TestAccessibility.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/C#/TestAccessibility/TestAccessibility.sln b/Chapter 05/C#/TestAccessibility/TestAccessibility.sln new file mode 100644 index 0000000..b918be2 --- /dev/null +++ b/Chapter 05/C#/TestAccessibility/TestAccessibility.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAccessibility", "TestAccessibility.csproj", "{2A8E627E-3D95-4C67-9D37-7CC0EB9F36C5}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {2A8E627E-3D95-4C67-9D37-7CC0EB9F36C5}.Debug.ActiveCfg = Debug|.NET + {2A8E627E-3D95-4C67-9D37-7CC0EB9F36C5}.Debug.Build.0 = Debug|.NET + {2A8E627E-3D95-4C67-9D37-7CC0EB9F36C5}.Release.ActiveCfg = Release|.NET + {2A8E627E-3D95-4C67-9D37-7CC0EB9F36C5}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/C#/TestAccessibility/TestAccessibility.suo b/Chapter 05/C#/TestAccessibility/TestAccessibility.suo new file mode 100644 index 0000000..e20a4ba Binary files /dev/null and b/Chapter 05/C#/TestAccessibility/TestAccessibility.suo differ diff --git a/Chapter 05/C#/TestAccessibility/bin/Debug/TestAccessibility.exe b/Chapter 05/C#/TestAccessibility/bin/Debug/TestAccessibility.exe new file mode 100644 index 0000000..856586b Binary files /dev/null and b/Chapter 05/C#/TestAccessibility/bin/Debug/TestAccessibility.exe differ diff --git a/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.exe b/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.exe new file mode 100644 index 0000000..856586b Binary files /dev/null and b/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.exe differ diff --git a/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.frmMain.resources b/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.frmMain.resources new file mode 100644 index 0000000..f782e28 Binary files /dev/null and b/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.frmMain.resources differ diff --git a/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.projdata b/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.projdata new file mode 100644 index 0000000..6e72bb7 Binary files /dev/null and b/Chapter 05/C#/TestAccessibility/obj/Debug/TestAccessibility.projdata differ diff --git a/Chapter 05/VB/ColorsAndFonts/AssemblyInfo.vb b/Chapter 05/VB/ColorsAndFonts/AssemblyInfo.vb new file mode 100644 index 0000000..926ee89 --- /dev/null +++ b/Chapter 05/VB/ColorsAndFonts/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.sln b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.sln new file mode 100644 index 0000000..4eca713 --- /dev/null +++ b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ColorsAndFonts", "ColorsAndFonts.vbproj", "{555DFFAB-F026-4E37-AAD1-623B7308D285}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {555DFFAB-F026-4E37-AAD1-623B7308D285}.Debug.ActiveCfg = Debug|.NET + {555DFFAB-F026-4E37-AAD1-623B7308D285}.Debug.Build.0 = Debug|.NET + {555DFFAB-F026-4E37-AAD1-623B7308D285}.Release.ActiveCfg = Release|.NET + {555DFFAB-F026-4E37-AAD1-623B7308D285}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.suo b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.suo new file mode 100644 index 0000000..3ec9954 Binary files /dev/null and b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.suo differ diff --git a/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.vbproj b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.vbproj new file mode 100644 index 0000000..5741220 --- /dev/null +++ b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.vbproj.user b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 05/VB/ColorsAndFonts/ColorsAndFonts.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/VB/ColorsAndFonts/FrmMain.resx b/Chapter 05/VB/ColorsAndFonts/FrmMain.resx new file mode 100644 index 0000000..0291b82 --- /dev/null +++ b/Chapter 05/VB/ColorsAndFonts/FrmMain.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 05/VB/ColorsAndFonts/FrmMain.vb b/Chapter 05/VB/ColorsAndFonts/FrmMain.vb new file mode 100644 index 0000000..3648ace --- /dev/null +++ b/Chapter 05/VB/ColorsAndFonts/FrmMain.vb @@ -0,0 +1,125 @@ +Imports System.Runtime.InteropServices + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents btnTest As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.btnQuit = New System.Windows.Forms.Button + Me.btnTest = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "Use this button to exit the application." + Me.btnQuit.AccessibleName = "Quit Pushbutton" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 3 + Me.btnQuit.Text = "&Quit" + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button displays the test information." + Me.btnTest.AccessibleName = "Test Pushbutton" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 2 + Me.btnTest.Text = "&Test" + ' + 'frmMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.btnQuit) + Me.Controls.Add(Me.btnTest) + Me.Name = "frmMain" + Me.Text = "Colors and Fonts Demonstration" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application. + End + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + Dim DefFont As Font ' Current font requirement. + Dim BtnSize As Size ' Current button size. + Dim DlgSize As Size ' Current dialog size. + Dim TestLoc As Point ' Current Test button location. + Dim QuitLoc As Point ' Current Quit button location. + + ' Obtain the default font for our example. + ' Begin by determining the screen state. + If (SystemInformation.HighContrast) Then + DefFont = SystemInformation.MenuFont + BtnSize = New Size(135, 42) + DlgSize = New Size(540, 540) + TestLoc = New Point(374, 14) + QuitLoc = New Point(374, 72) + ' Use the default sizes. + Else + DefFont = Me.Font + BtnSize = New Size(75, 23) + DlgSize = New Size(300, 300) + TestLoc = New Point(208, 8) + QuitLoc = New Point(208, 40) + End If + + ' Modify the display fonts. + btnTest.Font = DefFont + btnQuit.Font = DefFont + + ' Modify the sizes. + btnTest.Size = BtnSize + btnQuit.Size = BtnSize + frmMain.ActiveForm.Size = DlgSize + + ' Modify the positions. + btnTest.Location = TestLoc + btnQuit.Location = QuitLoc + + ' Display the information. + MessageBox.Show("Name: " + DefFont.Name + vbCrLf + _ + "Size: " + DefFont.SizeInPoints.ToString(), _ + "Font Information", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub +End Class diff --git a/Chapter 05/VB/ColorsAndFonts/bin/ColorsAndFonts.exe b/Chapter 05/VB/ColorsAndFonts/bin/ColorsAndFonts.exe new file mode 100644 index 0000000..5775290 Binary files /dev/null and b/Chapter 05/VB/ColorsAndFonts/bin/ColorsAndFonts.exe differ diff --git a/Chapter 05/VB/ColorsAndFonts/obj/Debug/ColorsAndFonts.exe b/Chapter 05/VB/ColorsAndFonts/obj/Debug/ColorsAndFonts.exe new file mode 100644 index 0000000..5775290 Binary files /dev/null and b/Chapter 05/VB/ColorsAndFonts/obj/Debug/ColorsAndFonts.exe differ diff --git a/Chapter 05/VB/ColorsAndFonts/obj/Debug/ColorsAndFonts.frmMain.resources b/Chapter 05/VB/ColorsAndFonts/obj/Debug/ColorsAndFonts.frmMain.resources new file mode 100644 index 0000000..fdb75df Binary files /dev/null and b/Chapter 05/VB/ColorsAndFonts/obj/Debug/ColorsAndFonts.frmMain.resources differ diff --git a/Chapter 05/VB/DevCaps/AssemblyInfo.vb b/Chapter 05/VB/DevCaps/AssemblyInfo.vb new file mode 100644 index 0000000..696b39a --- /dev/null +++ b/Chapter 05/VB/DevCaps/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 05/VB/DevCaps/DevCaps.sln b/Chapter 05/VB/DevCaps/DevCaps.sln new file mode 100644 index 0000000..f6c3f70 --- /dev/null +++ b/Chapter 05/VB/DevCaps/DevCaps.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DevCaps", "DevCaps.vbproj", "{F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Debug.ActiveCfg = Debug|.NET + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Debug.Build.0 = Debug|.NET + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Release.ActiveCfg = Release|.NET + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/VB/DevCaps/DevCaps.sln.old b/Chapter 05/VB/DevCaps/DevCaps.sln.old new file mode 100644 index 0000000..68d674d --- /dev/null +++ b/Chapter 05/VB/DevCaps/DevCaps.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DevCaps", "DevCaps.vbproj", "{F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Debug.ActiveCfg = Debug|.NET + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Debug.Build.0 = Debug|.NET + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Release.ActiveCfg = Release|.NET + {F1F9C5CE-05BF-470E-A1D3-099FFEDEBDFF}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/VB/DevCaps/DevCaps.suo b/Chapter 05/VB/DevCaps/DevCaps.suo new file mode 100644 index 0000000..7a8ff5f Binary files /dev/null and b/Chapter 05/VB/DevCaps/DevCaps.suo differ diff --git a/Chapter 05/VB/DevCaps/DevCaps.vbproj b/Chapter 05/VB/DevCaps/DevCaps.vbproj new file mode 100644 index 0000000..ed5d6a7 --- /dev/null +++ b/Chapter 05/VB/DevCaps/DevCaps.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/VB/DevCaps/DevCaps.vbproj.user b/Chapter 05/VB/DevCaps/DevCaps.vbproj.user new file mode 100644 index 0000000..bdc8235 --- /dev/null +++ b/Chapter 05/VB/DevCaps/DevCaps.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/VB/DevCaps/FrmMain.resx b/Chapter 05/VB/DevCaps/FrmMain.resx new file mode 100644 index 0000000..8157ede --- /dev/null +++ b/Chapter 05/VB/DevCaps/FrmMain.resx @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + Assembly + + + frmMain + + \ No newline at end of file diff --git a/Chapter 05/VB/DevCaps/FrmMain.vb b/Chapter 05/VB/DevCaps/FrmMain.vb new file mode 100644 index 0000000..448ff77 --- /dev/null +++ b/Chapter 05/VB/DevCaps/FrmMain.vb @@ -0,0 +1,303 @@ +Imports System.Runtime.InteropServices +Imports System.Text + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents btnTest As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.btnTest = New System.Windows.Forms.Button() + Me.btnQuit = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'btnTest + ' + Me.btnTest.Location = New System.Drawing.Point(208, 40) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 3 + Me.btnTest.Text = "Test" + ' + 'btnQuit + ' + Me.btnQuit.Location = New System.Drawing.Point(208, 8) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 2 + Me.btnQuit.Text = "Quit" + ' + 'frmMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnTest, Me.btnQuit}) + Me.Name = "frmMain" + Me.Text = "GetDeviceCaps() Demonstration" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + ' Exit the application. + End + End Sub + + ' The purpose of this function is to retrieve a device context + ' essentially a drawing area for the application. + _ + Public Shared Function GetDC(ByVal hWnd As IntPtr) As IntPtr + End Function + + ' Use this function to release the device context. + _ + Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Int32 + End Function + + ' Device Parameters for GetDeviceCaps() + Public Enum DevCapParm + ' General device capabilities. + DRIVERVERSION = 0 ' Device driver version + TECHNOLOGY = 2 ' Device classification + HORZSIZE = 4 ' Horizontal size in millimeters + VERTSIZE = 6 ' Vertical size in millimeters + HORZRES = 8 ' Horizontal width in pixels + VERTRES = 10 ' Vertical height in pixels + BITSPIXEL = 12 ' Number of bits per pixel + PLANES = 14 ' Number of planes + NUMBRUSHES = 16 ' Number of brushes the device has + NUMPENS = 18 ' Number of pens the device has + NUMMARKERS = 20 ' Number of markers the device has + NUMFONTS = 22 ' Number of fonts the device has + NUMCOLORS = 24 ' Number of colors the device supports + PDEVICESIZE = 26 ' Size required for device descriptor + CURVECAPS = 28 ' Curve capabilities + LINECAPS = 30 ' Line capabilities + POLYGONALCAPS = 32 ' Polygonal capabilities + TEXTCAPS = 34 ' Text capabilities + CLIPCAPS = 36 ' Clipping capabilities + RASTERCAPS = 38 ' Bitblt capabilities + ASPECTX = 40 ' Length of the X leg + ASPECTY = 42 ' Length of the Y leg + ASPECTXY = 44 ' Length of the hypotenuse + LOGPIXELSX = 88 ' Logical pixels/inch in X + LOGPIXELSY = 90 ' Logical pixels/inch in Y + SIZEPALETTE = 104 ' Number of entries in physical palette + NUMRESERVED = 106 ' Number of reserved entries in palette + COLORRES = 108 ' Actual color resolution + + ' Printing related DeviceCaps. These replace the appropriate Escapes + PHYSICALWIDTH = 110 ' Physical Width in device units + PHYSICALHEIGHT = 111 ' Physical Height in device units + PHYSICALOFFSETX = 112 ' Physical Printable Area x margin + PHYSICALOFFSETY = 113 ' Physical Printable Area y margin + SCALINGFACTORX = 114 ' Scaling factor x + SCALINGFACTORY = 115 ' Scaling factor y + + ' Display driver specific + VREFRESH = 116 ' Current vertical refresh rate of the + ' display device (for displays only) in Hz + DESKTOPVERTRES = 117 ' Horizontal width of entire desktop in + ' pixels + DESKTOPHORZRES = 118 ' Vertical height of entire desktop in + ' pixels + BLTALIGNMENT = 119 ' Preferred blt alignment + + SHADEBLENDCAPS = 120 ' Shading and blending caps + COLORMGMTCAPS = 121 ' Color Management caps + End Enum + + ' Device Capability Masks: + + ' Device Technologies + Public Enum DevTech + DT_PLOTTER = 0 ' Vector plotter + DT_RASDISPLAY = 1 ' Raster display + DT_RASPRINTER = 2 ' Raster printer + DT_RASCAMERA = 3 ' Raster camera + DT_CHARSTREAM = 4 ' Character-stream, PLP + DT_METAFILE = 5 ' Metafile, VDM + DT_DISPFILE = 6 ' Display-file + End Enum + + ' Curve Capabilities + Public Enum CurveCap + CC_NONE = 0 ' Curves not supported + CC_CIRCLES = 1 ' Can do circles + CC_PIE = 2 ' Can do pie wedges + CC_CHORD = 4 ' Can do chord arcs + CC_ELLIPSES = 8 ' Can do ellipese + CC_WIDE = 16 ' Can do wide lines + CC_STYLED = 32 ' Can do styled lines + CC_WIDESTYLED = 64 ' Can do wide styled lines + CC_INTERIORS = 128 ' Can do interiors + CC_ROUNDRECT = 256 ' + End Enum + + ' Line Capabilities + Public Enum LineCap + LC_NONE = 0 ' Lines not supported + LC_POLYLINE = 2 ' Can do polylines + LC_MARKER = 4 ' Can do markers + LC_POLYMARKER = 8 ' Can do polymarkers + LC_WIDE = 16 ' Can do wide lines + LC_STYLED = 32 ' Can do styled lines + LC_WIDESTYLED = 64 ' Can do wide styled lines + LC_INTERIORS = 128 ' Can do interiors + End Enum + + ' Polygonal Capabilities + Public Enum PolygonCap + PC_NONE = 0 ' Polygonals not supported + PC_POLYGON = 1 ' Can do polygons + PC_RECTANGLE = 2 ' Can do rectangles + PC_WINDPOLYGON = 4 ' Can do winding polygons + PC_TRAPEZOID = 4 ' Can do trapezoids + PC_SCANLINE = 8 ' Can do scanlines + PC_WIDE = 16 ' Can do wide borders + PC_STYLED = 32 ' Can do styled borders + PC_WIDESTYLED = 64 ' Can do wide styled borders + PC_INTERIORS = 128 ' Can do interiors + PC_POLYPOLYGON = 256 ' Can do polypolygons + PC_PATHS = 512 ' Can do paths + End Enum + + ' Clipping Capabilities + Public Enum ClippingCap + CP_NONE = 0 ' No clipping of output + CP_RECTANGLE = 1 ' Output clipped to rects + CP_REGION = 2 ' obsolete + End Enum + + ' Text Capabilities + Public Enum TextCap + TC_OP_CHARACTER = &H1 ' Can do OutputPrecision CHARACTER + TC_OP_STROKE = &H2 ' Can do OutputPrecision STROKE + TC_CP_STROKE = &H4 ' Can do ClipPrecision STROKE + TC_CR_90 = &H8 ' Can do CharRotAbility 90 + TC_CR_ANY = &H10 ' Can do CharRotAbility ANY + TC_SF_X_YINDEP = &H20 ' Can do ScaleFreedom X_YINDEPENDENT + TC_SA_DOUBLE = &H40 ' Can do ScaleAbility DOUBLE + TC_SA_INTEGER = &H80 ' Can do ScaleAbility INTEGER + TC_SA_CONTIN = &H100 ' Can do ScaleAbility CONTINUOUS + TC_EA_DOUBLE = &H200 ' Can do EmboldenAbility DOUBLE + TC_IA_ABLE = &H400 ' Can do ItalisizeAbility ABLE + TC_UA_ABLE = &H800 ' Can do UnderlineAbility ABLE + TC_SO_ABLE = &H1000 ' Can do StrikeOutAbility ABLE + TC_RA_ABLE = &H2000 ' Can do RasterFontAble ABLE + TC_VA_ABLE = &H4000 ' Can do VectorFontAble ABLE + TC_RESERVED = &H8000 + TC_SCROLLBLT = &H10000 ' Don't do text scroll with blt + End Enum + + ' Raster Capabilities + Public Enum RasterCap + RC_NONE = 0 + RC_BITBLT = 1 ' Can do standard BLT. + RC_BANDING = 2 ' Device requires banding support + RC_SCALING = 4 ' Device requires scaling support + RC_BITMAP64 = 8 ' Device can support >64K bitmap + RC_GDI20_OUTPUT = &H10 ' has 2.0 output calls + RC_GDI20_STATE = &H20 + RC_SAVEBITMAP = &H40 + RC_DI_BITMAP = &H80 ' supports DIB to memory + RC_PALETTE = &H100 ' supports a palette + RC_DIBTODEV = &H200 ' supports DIBitsToDevice + RC_BIGFONT = &H400 ' supports >64K fonts + RC_STRETCHBLT = &H800 ' supports StretchBlt + RC_FLOODFILL = &H1000 ' supports FloodFill + RC_STRETCHDIB = &H2000 ' supports StretchDIBits + RC_OP_DX_OUTPUT = &H4000 + RC_DEVBITS = &H8000 + End Enum + + ' Shading and blending caps + Public Enum ShadeAndBlendCap + SB_NONE = &H0 + SB_CONST_ALPHA = &H1 + SB_PIXEL_ALPHA = &H2 + SB_PREMULT_ALPHA = &H4 + SB_GRAD_RECT = &H10 + SB_GRAD_TRI = &H20 + End Enum + + ' Color Management caps + Public Enum ColorMngCap + CM_NONE = &H0 + CM_DEVICE_ICM = &H1 + CM_GAMMA_RAMP = &H2 + CM_CMYK_COLOR = &H4 + End Enum + + ' This function returns the device capability value specified + ' by the requested index value. + _ + Public Shared Function GetDeviceCaps(ByVal hdc As IntPtr, ByVal nIndex As Int32) As Int32 + End Function + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + Dim hDC As IntPtr ' Device context for current window. + Dim Result As Int32 ' The result of the call. + Dim Output As StringBuilder ' The output for the method. + + ' Obtain a device context for the current application. + hDC = GetDC(Me.Handle) + + ' Check for errors. + If (hDC.ToInt32() = IntPtr.Zero.ToInt32()) Then + ' Display an error message. + MessageBox.Show("Couldn't obtain device context!", _ + "Application Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + Return + End If + + ' Obtain the current display capability. + Output = New StringBuilder() + Result = GetDeviceCaps(hDC, DevCapParm.DESKTOPHORZRES) + Output.Append("The horizontal resolution: " + Result.ToString()) + Result = GetDeviceCaps(hDC, DevCapParm.DESKTOPVERTRES) + Output.Append(vbCrLf + "The vertical resolution: " + Result.ToString()) + Result = GetDeviceCaps(hDC, DevCapParm.BITSPIXEL) + Output.Append(vbCrLf + "The bits/pixel value: " + Result.ToString()) + + ' Display the results. + MessageBox.Show(Output.ToString(), _ + "Current Display Capabilities", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + + ' Release the device context when finished. + ReleaseDC(Me.Handle, hDC) + End Sub +End Class diff --git a/Chapter 05/VB/DevCaps/bin/DevCaps.exe b/Chapter 05/VB/DevCaps/bin/DevCaps.exe new file mode 100644 index 0000000..1dee229 Binary files /dev/null and b/Chapter 05/VB/DevCaps/bin/DevCaps.exe differ diff --git a/Chapter 05/VB/DevCaps/obj/Debug/DevCaps.exe b/Chapter 05/VB/DevCaps/obj/Debug/DevCaps.exe new file mode 100644 index 0000000..1dee229 Binary files /dev/null and b/Chapter 05/VB/DevCaps/obj/Debug/DevCaps.exe differ diff --git a/Chapter 05/VB/DevCaps/obj/Debug/DevCaps.frmMain.resources b/Chapter 05/VB/DevCaps/obj/Debug/DevCaps.frmMain.resources new file mode 100644 index 0000000..4a6704d Binary files /dev/null and b/Chapter 05/VB/DevCaps/obj/Debug/DevCaps.frmMain.resources differ diff --git a/Chapter 05/VB/TestAccessibility/AssemblyInfo.vb b/Chapter 05/VB/TestAccessibility/AssemblyInfo.vb new file mode 100644 index 0000000..fc93ee5 --- /dev/null +++ b/Chapter 05/VB/TestAccessibility/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 05/VB/TestAccessibility/FrmMain.resx b/Chapter 05/VB/TestAccessibility/FrmMain.resx new file mode 100644 index 0000000..265d66c --- /dev/null +++ b/Chapter 05/VB/TestAccessibility/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + frmMain + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 05/VB/TestAccessibility/FrmMain.vb b/Chapter 05/VB/TestAccessibility/FrmMain.vb new file mode 100644 index 0000000..9d1daf3 --- /dev/null +++ b/Chapter 05/VB/TestAccessibility/FrmMain.vb @@ -0,0 +1,139 @@ +Imports Accessibility + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + ' Set the AccessibleDefaultActionDescription property + ' values for this application. + btnQuit.AccessibleDefaultActionDescription = _ + "Press to quit the application." + btnTest.AccessibleDefaultActionDescription = _ + "Press to perform the application test function." + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents toolTipData As System.Windows.Forms.ToolTip + Friend WithEvents btnTest As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.toolTipData = New System.Windows.Forms.ToolTip(Me.components) + Me.btnTest = New System.Windows.Forms.Button + Me.btnQuit = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'toolTipData + ' + Me.toolTipData.AutomaticDelay = 300 + Me.toolTipData.AutoPopDelay = 5000 + Me.toolTipData.InitialDelay = 300 + Me.toolTipData.ReshowDelay = 60 + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button starts the test function of the application." + Me.btnTest.AccessibleName = "Application Test" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 2 + Me.btnTest.Text = "&Test" + Me.toolTipData.SetToolTip(Me.btnTest, "This button starts the test function of the application.") + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Quit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 3 + Me.btnQuit.Text = "&Quit" + Me.toolTipData.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'frmMain + ' + Me.AcceptButton = Me.btnTest + Me.AccessibleDescription = "This form contains controls that demonstration how to use the Accessibility names" & _ + "pace." + Me.AccessibleName = "Accessibility Test" + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.btnTest) + Me.Controls.Add(Me.btnQuit) + Me.Name = "frmMain" + Me.Text = "Accessibility Namespace Test" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application. + End + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + ' Display a message box. + MessageBox.Show("This is a test message.", _ + "Test Message", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub + + Private Sub btnTest_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Enter + Dim Ctrl As Control ' Control sending information. + + ' Show the current accessibility information. + Ctrl = sender + MessageBox.Show("Name = " + Ctrl.AccessibleName + _ + vbCrLf + "Role = " + Ctrl.AccessibleRole.ToString() + _ + vbCrLf + "Description = " + Ctrl.AccessibleDescription + _ + vbCrLf + "Default Action = " + _ + Ctrl.AccessibleDefaultActionDescription, _ + "Accessibility Information", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub + + Private Sub btnQuit_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnQuit.Enter + Dim Ctrl As Control ' Control sending information. + + ' Show the current accessibility information. + Ctrl = sender + MessageBox.Show("Name = " + Ctrl.AccessibleName + _ + vbCrLf + "Role = " + Ctrl.AccessibleRole.ToString() + _ + vbCrLf + "Description = " + Ctrl.AccessibleDescription + _ + vbCrLf + "Default Action = " + _ + Ctrl.AccessibleDefaultActionDescription, _ + "Accessibility Information", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub +End Class diff --git a/Chapter 05/VB/TestAccessibility/TestAccessibility.sln b/Chapter 05/VB/TestAccessibility/TestAccessibility.sln new file mode 100644 index 0000000..1e27bf9 --- /dev/null +++ b/Chapter 05/VB/TestAccessibility/TestAccessibility.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestAccessibility", "TestAccessibility.vbproj", "{F13A780D-E7CD-492D-8131-3195CD0434DA}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F13A780D-E7CD-492D-8131-3195CD0434DA}.Debug.ActiveCfg = Debug|.NET + {F13A780D-E7CD-492D-8131-3195CD0434DA}.Debug.Build.0 = Debug|.NET + {F13A780D-E7CD-492D-8131-3195CD0434DA}.Release.ActiveCfg = Release|.NET + {F13A780D-E7CD-492D-8131-3195CD0434DA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 05/VB/TestAccessibility/TestAccessibility.suo b/Chapter 05/VB/TestAccessibility/TestAccessibility.suo new file mode 100644 index 0000000..5205077 Binary files /dev/null and b/Chapter 05/VB/TestAccessibility/TestAccessibility.suo differ diff --git a/Chapter 05/VB/TestAccessibility/TestAccessibility.vbproj b/Chapter 05/VB/TestAccessibility/TestAccessibility.vbproj new file mode 100644 index 0000000..5137d43 --- /dev/null +++ b/Chapter 05/VB/TestAccessibility/TestAccessibility.vbproj @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 05/VB/TestAccessibility/TestAccessibility.vbproj.user b/Chapter 05/VB/TestAccessibility/TestAccessibility.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 05/VB/TestAccessibility/TestAccessibility.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 05/VB/TestAccessibility/bin/TestAccessibility.exe b/Chapter 05/VB/TestAccessibility/bin/TestAccessibility.exe new file mode 100644 index 0000000..52fcb32 Binary files /dev/null and b/Chapter 05/VB/TestAccessibility/bin/TestAccessibility.exe differ diff --git a/Chapter 05/VB/TestAccessibility/obj/Debug/TestAccessibility.exe b/Chapter 05/VB/TestAccessibility/obj/Debug/TestAccessibility.exe new file mode 100644 index 0000000..52fcb32 Binary files /dev/null and b/Chapter 05/VB/TestAccessibility/obj/Debug/TestAccessibility.exe differ diff --git a/Chapter 05/VB/TestAccessibility/obj/Debug/TestAccessibility.frmMain.resources b/Chapter 05/VB/TestAccessibility/obj/Debug/TestAccessibility.frmMain.resources new file mode 100644 index 0000000..190508c Binary files /dev/null and b/Chapter 05/VB/TestAccessibility/obj/Debug/TestAccessibility.frmMain.resources differ diff --git a/Chapter 06/C#/AccessFuncs/AccessFuncs.XML b/Chapter 06/C#/AccessFuncs/AccessFuncs.XML new file mode 100644 index 0000000..deb6057 --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/AccessFuncs.XML @@ -0,0 +1,946 @@ + + + + AccessFuncs + + + + + This enumeration contains a list of common constants used + to interact with the Windows Accessibility features. + + + + + Gets the high contrast information using the + HIGHCONTRAST data structure. + + + + + Sets the high contrast information using the + HIGHCONTRAST data structure. + + + + + Gets the screen readers status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. + + + + + Sets the screen readers status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. + + + + + Gets the FilterKeys information using the + FILTERKEYS data structure. + + + + + Sets the FilterKeys information using the + FILTERKEYS data structure. + + + + + Gets the ToggleKeys information using the + TOGGLEKEYS data structure. + + + + + Sets the ToggleKeys information using the + TOGGLEKEYS data structure. + + + + + Gets the MouseKeys information using the + MOUSEKEYS data structure. + + + + + Sets the MouseKeys information using the + MOUSEKEYS data structure. + + + + + Gets the ShowSounds status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. Microsoft + recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + function in place of this call. + + + + + Sets the ShowSounds status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. Microsoft + recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + function in place of this call. + + + + + Gets the StickyKeys information using the + STICKYKEYS data structure. + + + + + Sets the StickyKeys information using the + STICKYKEYS data structure. + + + + + Gets the Windows Accessibility Timeout information + using the ACCESSTIMEOUT data structure. + + + + + Sets the Windows Accessibility Timeout information + using the ACCESSTIMEOUT data structure. + + + + + Gets the SerialKeys information using the + SERIALKEYS data structure. + + + + + Sets the SerialKeys information using the + SERIALKEYS data structure. + + + + + Gets the SoundSentry information using the + SOUNDSENTRY data structure. + + + + + Gets the SoundSentry information using the + SOUNDSENTRY data structure. + + + + + This enumeration contains the flags used to control + update of the user profile. Select SPIF_NONE if the + application does not need to update the profile. + + + + + Doesn't perform any type of profile update. + + + + + Writes the update to the user profile. + + + + + Writes the update to the user profile and + broadcasts the WM_SETTINGCHANGE message. + + + + + Writes the update to the user profile and + broadcasts the WM_SETTINGCHANGE message. + + + + + A listing of HighContrast accessibility flags. + + + + + HighContrast is On + + + + + HighContrast is available for use. + + + + + HighContrast has the hot key selected. + + + + + Confirmation dialog box displayed for + the HighContrast hot key. + + + + + Make a sound when HighContrast is selected. + + + + + Display an indicator when HighContrast is selected. + + + + + HighContrast hot key is available. + + + + + A listing of FilterKeys accessibility flags. + + + + + FilterKeys is On + + + + + FilterKeys is available for use. + + + + + The FilterKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the FilterKeys hot key. + + + + + Make a sound when changing the FilterKeys status. + + + + + Display an indicator when changing the FilterKeys status. + + + + + The FilterKeys click is set to on. + + + + + A listing of ToggleKeys accessibility flags. + + + + + ToggleKeys is On + + + + + ToggleKeys is available for use. + + + + + The ToggleKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the ToggleKeys hot key. + + + + + Make a sound when changing the ToggleKeys status. + + + + + Display an indicator when changing the ToggleKeys status. + + + + + A listing of MouseKeys accessibility flags. + + + + + MouseKeys is On + + + + + MouseKeys is available for use. + + + + + The MouseKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the MouseKeys hot key. + + + + + Make a sound when changing the MouseKeys status. + + + + + Display an indicator when changing the MouseKeys status. + + + + + Use the Ctrl key to speed the mouse up and the + Shift key to slow the mouse down. + + + + + The numeric keypad moves the mouse when Num Lock is + on when set. + + + + + The user wants to use the left button to select. + + + + + The user wants to use the right button to select. + + + + + The left button to down. + + + + + The right button to down. + + + + + The system is processing numeric keypad input as mouse movement. + + + + + A listing of StickyKeys accessibility flags. + + + + + StickyKeys is On + + + + + StickyKeys is available for use. + + + + + The StickyKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the StickyKeys hot key. + + + + + Make a sound when changing the StickyKeys status. + + + + + Display an indicator when changing the StickyKeys status. + + + + + The system plays a sound when the control keys change status. + + + + + Pressing a key twice locks it--a third time releases it. + + + + + Pressing a control and another key together turns of StickyKeys. + + + + + The left Alt key is latched. + + + + + The left Ctrl key is latched. + + + + + The left Shift key is latched. + + + + + The right Alt key is latched. + + + + + The right Ctrl key is latched. + + + + + The right Shift key is latched. + + + + + The left Windows key is latched. + + + + + The right Windows key is latched. + + + + + The left Alt key is locked. + + + + + The left Ctrl key is locked. + + + + + The left Shift key is locked. + + + + + The right Alt key is locked. + + + + + The right Ctrl key is locked. + + + + + The right Shift key is locked. + + + + + The left Windows key is locked. + + + + + The right Windows key is locked. + + + + + A listing of Windows Accessibility timeout flags. + + + + + If this flag is set, the user has set a timeout value + and the Windows Accessibility features will turn off + after a given time period. If this flag is cleared, the + Windows Accessibility features are always available. + + + + + Make a sound when changing the timeout status. + + + + + A listing of SerialKeys accessibility flags. + + + + + SerialKeys is On + + + + + SerialKeys is available for use. This flag is not + implemented + + + + + Display an indicator when changing the SerialKeys status. + + + + + A listing of SoundSentry accessibility flags. + + + + + SoundSentry is On + + + + + SoundSentry is available for use. This flag is not + implemented + + + + + Display an indicator when changing the SoundSentry + status. + + + + + Contains a list of the possible screen effects for a + full screen DOS text mode application. + + + + + Don't display an effect. + + + + + Flash the characters in the corner of the screen. + + + + + Flash the border (overscan area) of the screen. + + + + + Flash the entire screen. + + + + + Contains a list of the possible screen effects for a + full screen DOS graphics mode application. + + + + + Don't display an effect. + + + + + Flash the entire screen. + + + + + Contains a list of the possible screen effects for a + Windows application. + + + + + Don't display an effect. + + + + + Flash the title bar of the active application. + + + + + Flash the entire active application window. + + + + + Flash the entire screen. + + + + + Use the custom flashing method specified by the + SoundSentryProc() function found in the DLL + specified by the iFSWindowsEffectDLL member. + + + + + Contains the HighContrast accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains a text description of the current scheme. + + + + + Contains the FilterKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Defines the Acceptance Delay value. + + + + + Defines the Delay Until Repeat value. + + + + + Defines the Repeat Rate value. + + + + + Defines the Debounce Time value. + + + + + Contains the ToggleKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the MouseKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the maximum speed setting of the mouse. + + + + + Contains the acceleration setting of the mouse. + + + + + Contains the control speed setting of the mouse. + Ignored if MKF_MODIFIERS is not set. + + + + + Reserved--Do Not Use + + + + + Reserved--Do Not Use + + + + + Contains the StickyKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the Windows Accessibility timeout setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the timeout value for automatic shutdown in ms. + + + + + Contains the SerialKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Provides the name of the port used to receive + serial communications. If there is no port in + use, this member is zero. If the port is set to + scan all inputs, then this value returns AUTO. + + + + + Reserved--Do Not Use + + + + + Contains the SerialKeys baud rate setting. + + + + + Contains a number that indicates the current + port state. 0 = All input ignored, 1 = Input is + watched for SerialKeys activation when no other + application has the port open, 2 = All input is + treated as SerialKeys commands. + + + + + Contains the number of the active port. + + + + + Contains the SoundSentry accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Determines the type of text effect used to display + information on screen. Use with the + SoundSentryTextEffects enumeration. + + + + + Determines the duration of the text screen + effect in ms. + + + + + Determines the RGB color used to display a + text screen effect. + + + + + Determines the type of graphic effect used to display + information on screen. Use with the + SoundSentryGraphicEffects enumeration. + + + + + Determines the duration of the graphics screen + effect in ms. + + + + + Determines the RGB color used to display a + graphics screen effect. + + + + + Determines the type of Windows application effect + used to display information on screen. Use with + the SoundSentryWindowsEffects enumeration. + + + + + Determines the duration of the Windows application + screen effect in ms. + + + + + Defines the name of the DLL that contains the + SoundSentryProc callback function. This member + contains NULL if no DLL is used. + + + + + Reserved--Do Not Use + + + + + This class contains the functions required to work with the + Windows Accessibility features. + + + + + This constant contains the maximum path length + used by Windows. + + + + + This is the constant used to obtain information about + ShowSounds using the GetSystemMetrics() function. + + + + + Accessible class constructor. + + + + + This function gets or sets the Windows Accessibility + setting selected by uiAction. It can optionally + update the user profile to match the new settings. + + The AccessType enumeration member + that reflects the accessibility option you want to modify. + The actual size of the data structure. + A pointer to the local copy of the data structure. + One of the WinIniFlag values that reflects + the user profile update status. + True if the call is successful. + + + + The GetSystemMatrics function can retrieve a variety of + system metrics information, along with some types of + system configuration information. + + The index of the metric to retrieve. + A number indicating the value of the metric. + + + diff --git a/Chapter 06/C#/AccessFuncs/AccessFuncs.csproj b/Chapter 06/C#/AccessFuncs/AccessFuncs.csproj new file mode 100644 index 0000000..c0dd774 --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/AccessFuncs.csproj @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/AccessFuncs/AccessFuncs.csproj.user b/Chapter 06/C#/AccessFuncs/AccessFuncs.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/AccessFuncs.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/AccessFuncs/AccessFuncs.sln b/Chapter 06/C#/AccessFuncs/AccessFuncs.sln new file mode 100644 index 0000000..eb799ca --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/AccessFuncs.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccessFuncs", "AccessFuncs.csproj", "{E53D4F68-C8F7-4A76-9AC5-1A7F21A77D65}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E53D4F68-C8F7-4A76-9AC5-1A7F21A77D65}.Debug.ActiveCfg = Debug|.NET + {E53D4F68-C8F7-4A76-9AC5-1A7F21A77D65}.Debug.Build.0 = Debug|.NET + {E53D4F68-C8F7-4A76-9AC5-1A7F21A77D65}.Release.ActiveCfg = Release|.NET + {E53D4F68-C8F7-4A76-9AC5-1A7F21A77D65}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/AccessFuncs/AccessFuncs.suo b/Chapter 06/C#/AccessFuncs/AccessFuncs.suo new file mode 100644 index 0000000..645abe5 Binary files /dev/null and b/Chapter 06/C#/AccessFuncs/AccessFuncs.suo differ diff --git a/Chapter 06/C#/AccessFuncs/Accessible.cs b/Chapter 06/C#/AccessFuncs/Accessible.cs new file mode 100644 index 0000000..d97e55f --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/Accessible.cs @@ -0,0 +1,1120 @@ +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Text; + +namespace AccessFuncs +{ + #region Enumerations + + /// + /// This enumeration contains a list of common constants used + /// to interact with the Windows Accessibility features. + /// + [Description("This enumeration contains a list of common constants used " + + "to interact with the Windows Accessibility features.")] + public enum AccessType : uint + { + /// + /// Gets the high contrast information using the + /// HIGHCONTRAST data structure. + /// + [Description("Gets the high contrast information using the " + + "HIGHCONTRAST data structure.")] + SPI_GETHIGHCONTRAST = 0x0042, + /// + /// Sets the high contrast information using the + /// HIGHCONTRAST data structure. + /// + [Description("Sets the high contrast information using the " + + "HIGHCONTRAST data structure.")] + SPI_SETHIGHCONTRAST = 0x0043, + /// + /// Gets the screen readers status. Unlike some other + /// accessibility settings, this one relies on a BOOL, + /// rather than a data structure for input. + /// + [Description("Gets the screen readers status. Unlike some other " + + "accessibility settings, this one relies on a BOOL," + + "rather than a data structure for input.")] + SPI_GETSCREENREADER = 0x0046, + /// + /// Sets the screen readers status. Unlike some other + /// accessibility settings, this one relies on a BOOL, + /// rather than a data structure for input. + /// + [Description("Sets the screen readers status. Unlike some other " + + "accessibility settings, this one relies on a BOOL," + + "rather than a data structure for input.")] + SPI_SETSCREENREADER = 0x0047, + /// + /// Gets the FilterKeys information using the + /// FILTERKEYS data structure. + /// + [Description("Gets the FilterKeys information using the " + + "FILTERKEYS data structure.")] + SPI_GETFILTERKEYS = 0x0032, + /// + /// Sets the FilterKeys information using the + /// FILTERKEYS data structure. + /// + [Description("Sets the FilterKeys information using the " + + "FILTERKEYS data structure.")] + SPI_SETFILTERKEYS = 0x0033, + /// + /// Gets the ToggleKeys information using the + /// TOGGLEKEYS data structure. + /// + [Description("Gets the ToggleKeys information using the " + + "TOGGLEKEYS data structure.")] + SPI_GETTOGGLEKEYS = 0x0034, + /// + /// Sets the ToggleKeys information using the + /// TOGGLEKEYS data structure. + /// + [Description("Sets the ToggleKeys information using the " + + "TOGGLEKEYS data structure.")] + SPI_SETTOGGLEKEYS = 0x0035, + /// + /// Gets the MouseKeys information using the + /// MOUSEKEYS data structure. + /// + [Description("Gets the MouseKeys information using the " + + "MOUSEKEYS data structure.")] + SPI_GETMOUSEKEYS = 0x0036, + /// + /// Sets the MouseKeys information using the + /// MOUSEKEYS data structure. + /// + [Description("Sets the MouseKeys information using the " + + "MOUSEKEYS data structure.")] + SPI_SETMOUSEKEYS = 0x0037, + /// + /// Gets the ShowSounds status. Unlike some other + /// accessibility settings, this one relies on a BOOL, + /// rather than a data structure for input. Microsoft + /// recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + /// function in place of this call. + /// + [Description("Gets the ShowSounds status. Unlike some other " + + "accessibility settings, this one relies on a BOOL, " + + "rather than a data structure for input. Microsoft " + + "recommends using the GetSystemMetrics(SM_SHOWSOUNDS) " + + "function in place of this call.")] + SPI_GETSHOWSOUNDS = 0x0038, + /// + /// Sets the ShowSounds status. Unlike some other + /// accessibility settings, this one relies on a BOOL, + /// rather than a data structure for input. Microsoft + /// recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + /// function in place of this call. + /// + [Description("Sets the ShowSounds status. Unlike some other " + + "accessibility settings, this one relies on a BOOL, " + + "rather than a data structure for input. Microsoft " + + "recommends using the GetSystemMetrics(SM_SHOWSOUNDS) " + + "function in place of this call.")] + SPI_SETSHOWSOUNDS = 0x0039, + /// + /// Gets the StickyKeys information using the + /// STICKYKEYS data structure. + /// + [Description("Gets the StickyKeys information using the " + + "STICKYKEYS data structure.")] + SPI_GETSTICKYKEYS = 0x003A, + /// + /// Sets the StickyKeys information using the + /// STICKYKEYS data structure. + /// + [Description("Sets the StickyKeys information using the " + + "STICKYKEYS data structure.")] + SPI_SETSTICKYKEYS = 0x003B, + /// + /// Gets the Windows Accessibility Timeout information + /// using the ACCESSTIMEOUT data structure. + /// + [Description("Gets the Windows Accessibility Timeout information " + + "using the ACCESSTIMEOUT data structure.")] + SPI_GETACCESSTIMEOUT = 0x003C, + /// + /// Sets the Windows Accessibility Timeout information + /// using the ACCESSTIMEOUT data structure. + /// + [Description("Sets the Windows Accessibility Timeout information " + + "using the ACCESSTIMEOUT data structure.")] + SPI_SETACCESSTIMEOUT = 0x003D, + /// + /// Gets the SerialKeys information using the + /// SERIALKEYS data structure. + /// + [Description("Gets the SerialKeys information using the " + + "SERIALKEYS data structure.")] + SPI_GETSERIALKEYS = 0x003E, + /// + /// Sets the SerialKeys information using the + /// SERIALKEYS data structure. + /// + [Description("Sets the SerialKeys information using the " + + "SERIALKEYS data structure.")] + SPI_SETSERIALKEYS = 0x003F, + /// + /// Gets the SoundSentry information using the + /// SOUNDSENTRY data structure. + /// + [Description("Gets the SoundSentry information using the " + + "SOUNDSENTRY data structure.")] + SPI_GETSOUNDSENTRY = 0x0040, + /// + /// Gets the SoundSentry information using the + /// SOUNDSENTRY data structure. + /// + [Description("Gets the SoundSentry information using the " + + "SOUNDSENTRY data structure.")] + SPI_SETSOUNDSENTRY = 0x0041 + } + + /// + /// This enumeration contains the flags used to control + /// update of the user profile. Select SPIF_NONE if the + /// application does not need to update the profile. + /// + [Description("This enumeration contains the flags used to control " + + "update of the user profile. Select SPIF_NONE if the " + + "application does not need to update the profile.")] + public enum WinIniFlags + { + /// + /// Doesn't perform any type of profile update. + /// + [Description("Doesn't perform any type of profile update.")] + SPIF_NONE = 0x0000, + /// + /// Writes the update to the user profile. + /// + [Description("Writes the update to the user profile.")] + SPIF_UPDATEINIFILE = 0x0001, + /// + /// Writes the update to the user profile and + /// broadcasts the WM_SETTINGCHANGE message. + /// + [Description("Writes the update to the user profile and " + + "broadcasts the WM_SETTINGCHANGE message.")] + SPIF_SENDWININICHANGE = 0x0002, + /// + /// Writes the update to the user profile and + /// broadcasts the WM_SETTINGCHANGE message. + /// + [Description("Writes the update to the user profile and " + + "broadcasts the WM_SETTINGCHANGE message.")] + SPIF_SENDCHANGE = SPIF_SENDWININICHANGE + } + + /// + /// A listing of HighContrast accessibility flags. + /// + [Description("A listing of HighContrast accessibility flags.")] + public enum HighContrastFlags + { + /// + /// HighContrast is On + /// + [Description("HighContrast is On")] + HCF_HIGHCONTRASTON = 0x00000001, + /// + /// HighContrast is available for use. + /// + [Description("HighContrast is availble for use.")] + HCF_AVAILABLE = 0x00000002, + /// + /// HighContrast has the hot key selected. + /// + [Description("HighContrast has the hot key selected.")] + HCF_HOTKEYACTIVE = 0x00000004, + /// + /// Confirmation dialog box displayed for + /// the HighContrast hot key. + /// + [Description("Confirmation dialog box displayed for " + + "the HighContrast hot key.")] + HCF_CONFIRMHOTKEY = 0x00000008, + /// + /// Make a sound when HighContrast is selected. + /// + [Description("Make a sound when HighContrast is selected.")] + HCF_HOTKEYSOUND = 0x00000010, + /// + /// Display an indicator when HighContrast is selected. + /// + [Description("Display an indicator when HighContrast is selected.")] + HCF_INDICATOR = 0x00000020, + /// + /// HighContrast hot key is available. + /// + [Description("HighContrast hot key is available.")] + HCF_HOTKEYAVAILABLE = 0x00000040 + } + + /// + /// A listing of FilterKeys accessibility flags. + /// + [Description("A listing of FilterKeys accessibility flags.")] + public enum FilterKeysFlags + { + /// + /// FilterKeys is On + /// + [Description("FilterKeys is On")] + FKF_FILTERKEYSON = 0x00000001, + /// + /// FilterKeys is available for use. + /// + [Description("FilterKeys is available for use.")] + FKF_AVAILABLE = 0x00000002, + /// + /// The FilterKeys hotkey is active. + /// + [Description("The FilterKeys is active.")] + FKF_HOTKEYACTIVE = 0x00000004, + /// + /// Confirmation dialog box displayed for + /// the FilterKeys hot key. + /// + [Description("Confirmation dialog box displayed for " + + "the FilterKeys hot key.")] + FKF_CONFIRMHOTKEY = 0x00000008, + /// + /// Make a sound when changing the FilterKeys status. + /// + [Description("Make a sound when changing the FilterKeys status.")] + FKF_HOTKEYSOUND = 0x00000010, + /// + /// Display an indicator when changing the FilterKeys status. + /// + [Description("Display an indicator when changing the FilterKeys status.")] + FKF_INDICATOR = 0x00000020, + /// + /// The FilterKeys click is set to on. + /// + [Description("The FilterKeys click is set to on.")] + FKF_CLICKON = 0x00000040 + } + + /// + /// A listing of ToggleKeys accessibility flags. + /// + [Description("A listing of ToggleKeys accessibility flags.")] + public enum ToggleKeysFlags + { + /// + /// ToggleKeys is On + /// + [Description("ToggleKeys is On")] + TKF_TOGGLEKEYSON = 0x00000001, + /// + /// ToggleKeys is available for use. + /// + [Description("ToggleKeys is available for use.")] + TKF_AVAILABLE = 0x00000002, + /// + /// The ToggleKeys hotkey is active. + /// + [Description("The ToggleKeys is active.")] + TKF_HOTKEYACTIVE = 0x00000004, + /// + /// Confirmation dialog box displayed for + /// the ToggleKeys hot key. + /// + [Description("Confirmation dialog box displayed for " + + "the ToggleKeys hot key.")] + TKF_CONFIRMHOTKEY = 0x00000008, + /// + /// Make a sound when changing the ToggleKeys status. + /// + [Description("Make a sound when changing the ToggleKeys status.")] + TKF_HOTKEYSOUND = 0x00000010, + /// + /// Display an indicator when changing the ToggleKeys status. + /// + [Description("Display an indicator when changing the ToggleKeys status.")] + TKF_INDICATOR = 0x00000020 + } + + /// + /// A listing of MouseKeys accessibility flags. + /// + [Description("A listing of MouseKeys accessibility flags.")] + public enum MouseKeysFlags : uint + { + /// + /// MouseKeys is On + /// + [Description("MouseKeys is On")] + MKF_MOUSEKEYSON = 0x00000001, + /// + /// MouseKeys is available for use. + /// + [Description("MouseKeys is available for use.")] + MKF_AVAILABLE = 0x00000002, + /// + /// The MouseKeys hotkey is active. + /// + [Description("The MouseKeys is active.")] + MKF_HOTKEYACTIVE = 0x00000004, + /// + /// Confirmation dialog box displayed for + /// the MouseKeys hot key. + /// + [Description("Confirmation dialog box displayed for " + + "the MouseKeys hot key.")] + MKF_CONFIRMHOTKEY = 0x00000008, + /// + /// Make a sound when changing the MouseKeys status. + /// + [Description("Make a sound when changing the MouseKeys status.")] + MKF_HOTKEYSOUND = 0x00000010, + /// + /// Display an indicator when changing the MouseKeys status. + /// + [Description("Display an indicator when changing the MouseKeys status.")] + MKF_INDICATOR = 0x00000020, + /// + /// Use the Ctrl key to speed the mouse up and the + /// Shift key to slow the mouse down. + /// + [Description("Use the Ctrl key to speed the mouse up and the" + + "Shift key to slow the mouse down.")] + MKF_MODIFIERS = 0x00000040, + /// + /// The numeric keypad moves the mouse when Num Lock is + /// on when set. + /// + [Description("The numeric keypad moves the mouse when Num Lock is" + + "on when set.")] + MKF_REPLACENUMBERS = 0x00000080, + /// + /// The user wants to use the left button to select. + /// + [Description("The user wants to use the left button to select.")] + MKF_LEFTBUTTONSEL = 0x10000000, + /// + /// The user wants to use the right button to select. + /// + [Description("The user wants to use the right button to select.")] + MKF_RIGHTBUTTONSEL = 0x20000000, + /// + /// The left button to down. + /// + [Description("The left button to down.")] + MKF_LEFTBUTTONDOWN = 0x01000000, + /// + /// The right button to down. + /// + [Description("The right button to down.")] + MKF_RIGHTBUTTONDOWN = 0x02000000, + /// + /// The system is processing numeric keypad input as mouse movement. + /// + [Description("The system is processing numeric keypad input as mouse movement.")] + MKF_MOUSEMODE = 0x80000000 + } + + /// + /// A listing of StickyKeys accessibility flags. + /// + [Description("A listing of StickyKeys accessibility flags.")] + public enum StickyKeysFlags : uint + { + /// + /// StickyKeys is On + /// + [Description("StickyKeys is On")] + SKF_STICKYKEYSON = 0x00000001, + /// + /// StickyKeys is available for use. + /// + [Description("StickyKeys is available for use.")] + SKF_AVAILABLE = 0x00000002, + /// + /// The StickyKeys hotkey is active. + /// + [Description("The StickyKeys is active.")] + SKF_HOTKEYACTIVE = 0x00000004, + /// + /// Confirmation dialog box displayed for + /// the StickyKeys hot key. + /// + [Description("Confirmation dialog box displayed for " + + "the StickyKeys hot key.")] + SKF_CONFIRMHOTKEY = 0x00000008, + /// + /// Make a sound when changing the StickyKeys status. + /// + [Description("Make a sound when changing the StickyKeys status.")] + SKF_HOTKEYSOUND = 0x00000010, + /// + /// Display an indicator when changing the StickyKeys status. + /// + [Description("Display an indicator when changing the StickyKeys status.")] + SKF_INDICATOR = 0x00000020, + /// + /// The system plays a sound when the control keys change status. + /// + [Description("The system plays a sound when the control keys change status.")] + SKF_AUDIBLEFEEDBACK = 0x00000040, + /// + /// Pressing a key twice locks it--a third time releases it. + /// + [Description("Pressing a key twice locks it--a third time releases it.")] + SKF_TRISTATE = 0x00000080, + /// + /// Pressing a control and another key together turns of StickyKeys. + /// + [Description("Pressing a control and another key together turns of StickyKeys.")] + SKF_TWOKEYSOFF = 0x00000100, + /// + /// The left Alt key is latched. + /// + [Description("The left Alt key is latched.")] + SKF_LALTLATCHED = 0x10000000, + /// + /// The left Ctrl key is latched. + /// + [Description("The left Ctrl key is latched.")] + SKF_LCTLLATCHED = 0x04000000, + /// + /// The left Shift key is latched. + /// + [Description("The left Shift key is latched.")] + SKF_LSHIFTLATCHED = 0x01000000, + /// + /// The right Alt key is latched. + /// + [Description("The right Alt key is latched.")] + SKF_RALTLATCHED = 0x20000000, + /// + /// The right Ctrl key is latched. + /// + [Description("The right Ctrl key is latched.")] + SKF_RCTLLATCHED = 0x08000000, + /// + /// The right Shift key is latched. + /// + [Description("The right Shift key is latched.")] + SKF_RSHIFTLATCHED = 0x02000000, + /// + /// The left Windows key is latched. + /// + [Description("The left Windows key is latched.")] + SKF_LWINLATCHED = 0x40000000, + /// + /// The right Windows key is latched. + /// + [Description("The right Windows key is latched.")] + SKF_RWINLATCHED = 0x80000000, + /// + /// The left Alt key is locked. + /// + [Description("The left Alt key is locked.")] + SKF_LALTLOCKED = 0x00100000, + /// + /// The left Ctrl key is locked. + /// + [Description("The left Ctrl key is locked.")] + SKF_LCTLLOCKED = 0x00040000, + /// + /// The left Shift key is locked. + /// + [Description("The left Shift key is locked.")] + SKF_LSHIFTLOCKED = 0x00010000, + /// + /// The right Alt key is locked. + /// + [Description("The right Alt key is locked.")] + SKF_RALTLOCKED = 0x00200000, + /// + /// The right Ctrl key is locked. + /// + [Description("The right Ctrl key is locked.")] + SKF_RCTLLOCKED = 0x00080000, + /// + /// The right Shift key is locked. + /// + [Description("The right Shift key is locked.")] + SKF_RSHIFTLOCKED = 0x00020000, + /// + /// The left Windows key is locked. + /// + [Description("The left Windows key is locked.")] + SKF_LWINLOCKED = 0x00400000, + /// + /// The right Windows key is locked. + /// + [Description("The right Windows key is locked.")] + SKF_RWINLOCKED = 0x00800000 + } + + /// + /// A listing of Windows Accessibility timeout flags. + /// + [Description("A listing of Windows Accessibility timeout flags.")] + public enum AccessTimeoutFlags + { + /// + /// If this flag is set, the user has set a timeout value + /// and the Windows Accessibility features will turn off + /// after a given time period. If this flag is cleared, the + /// Windows Accessibility features are always available. + /// + [Description("If this flag is set, the user has set a timeout value " + + "and the Windows Accessibility features will turn off " + + "after a given time period. If this flag is cleared, the " + + "Windows Accessibility features are always available.")] + ATF_TIMEOUTON = 0x00000001, + /// + /// Make a sound when changing the timeout status. + /// + [Description("Make a sound when changing the timeout status.")] + ATF_ONOFFFEEDBACK = 0x00000002 + } + + /// + /// A listing of SerialKeys accessibility flags. + /// + [Description("A listing of SerialKeys accessibility flags.")] + public enum SerialKeysFlags + { + /// + /// SerialKeys is On + /// + [Description("SerialKeys is On")] + SERKF_SERIALKEYSON = 0x00000001, + /// + /// SerialKeys is available for use. This flag is not + /// implemented + /// + [Description("SerialKeys is available for use. This flag is not " + + "implemented")] + SERKF_AVAILABLE = 0x00000002, + /// + /// Display an indicator when changing the SerialKeys status. + /// + [Description("Display an indicator when changing the SerialKeys status.")] + SERKF_INDICATOR = 0x00000004 + } + + /// + /// A listing of SoundSentry accessibility flags. + /// + [Description("A listing of SoundSentry accessibility flags.")] + public enum SoundSentryFlags + { + /// + /// SoundSentry is On + /// + [Description("SoundSentry is On")] + SSF_SOUNDSENTRYON = 0x00000001, + /// + /// SoundSentry is available for use. This flag is not + /// implemented + /// + [Description("SoundSentry is available for use. This flag is not " + + "implemented")] + SSF_AVAILABLE = 0x00000002, + /// + /// Display an indicator when changing the SoundSentry + /// status. + /// + [Description("Display an indicator when changing the SoundSentry " + + "status.")] + SSF_INDICATOR = 0x00000004 + } + + /// + /// Contains a list of the possible screen effects for a + /// full screen DOS text mode application. + /// + [Description("Contains a list of the possible screen effects for a " + + "full screen DOS text mode application.")] + public enum SoundSentryTextEffects + { + /// + /// Don't display an effect. + /// + [Description("Don't display an effect.")] + SSTF_NONE = 0, + /// + /// Flash the characters in the corner of the screen. + /// + [Description("Flash the characters in the corner of the screen.")] + SSTF_CHARS = 1, + /// + /// Flash the border (overscan area) of the screen. + /// + [Description("Flash the border (overscan area) of the screen.")] + SSTF_BORDER = 2, + /// + /// Flash the entire screen. + /// + [Description("Flash the entire screen.")] + SSTF_DISPLAY = 3 + } + + /// + /// Contains a list of the possible screen effects for a + /// full screen DOS graphics mode application. + /// + [Description("Contains a list of the possible screen effects for a " + + "full screen DOS graphics mode application.")] + public enum SoundSentryGraphicEffects + { + /// + /// Don't display an effect. + /// + [Description("Don't display an effect.")] + SSGF_NONE = 0, + /// + /// Flash the entire screen. + /// + [Description("Flash the entire screen.")] + SSGF_DISPLAY = 3 + } + + /// + /// Contains a list of the possible screen effects for a + /// Windows application. + /// + [Description("Contains a list of the possible screen effects for a " + + "Windows application.")] + public enum SoundSentryWindowsEffects + { + /// + /// Don't display an effect. + /// + [Description("Don't display an effect.")] + SSWF_NONE = 0, + /// + /// Flash the title bar of the active application. + /// + [Description("Flash the title bar of the active application.")] + SSWF_TITLE = 1, + /// + /// Flash the entire active application window. + /// + [Description("Flash the entire active application window.")] + SSWF_WINDOW = 2, + /// + /// Flash the entire screen. + /// + [Description("Flash the entire screen.")] + SSWF_DISPLAY = 3, + /// + /// Use the custom flashing method specified by the + /// SoundSentryProc() function found in the DLL + /// specified by the iFSWindowsEffectDLL member. + /// + [Description("Use the custom flashing method specified by the " + + "SoundSentryProc() function found in the DLL " + + "specified by the iFSWindowsEffectDLL member. ")] + SSWF_CUSTOM = 4 + } + #endregion + + #region Data Structures + /// + /// Contains the HighContrast accessibility setting information. + /// + [Description("Contains the HighContrast accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct HIGHCONTRAST + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + /// + /// Contains a text description of the current scheme. + /// + [Description("Contains a text description of the current scheme.")] + [MarshalAs(UnmanagedType.LPWStr, SizeConst=80)] + public String lpszDefaultScheme; + } + + /// + /// Contains the FilterKeys accessibility setting information. + /// + [Description("Contains the FilterKeys accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct FILTERKEYS + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + /// + /// Defines the Acceptance Delay value. + /// + [Description("Defines the Acceptance Delay value.")] + public Int32 iWaitMSec; + /// + /// Defines the Delay Until Repeat value. + /// + [Description("Defines the Delay Until Repeat value.")] + public Int32 iDelayMSec; + /// + /// Defines the Repeat Rate value. + /// + [Description("Defines the Repeat Rate value.")] + public Int32 iRepeatMSec; + /// + /// Defines the Debounce Time value. + /// + [Description("Defines the Debounce Time value.")] + public Int32 iBounceMSec; + } + + /// + /// Contains the ToggleKeys accessibility setting information. + /// + [Description("Contains the ToggleKeys accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct TOGGLEKEYS + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + } + + /// + /// Contains the MouseKeys accessibility setting information. + /// + [Description("Contains the MouseKeys accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct MOUSEKEYS + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains a the settings flags for the data structure.")] + public UInt32 dwFlags; + /// + /// Contains the maximum speed setting of the mouse. + /// + [Description("Contains the maximum speed setting of the mouse.")] + public Int32 iMaxSpeed; + /// + /// Contains the acceleration setting of the mouse. + /// + [Description("Contains the acceleration setting of the mouse.")] + public Int32 iTimeToMaxSpeed; + /// + /// Contains the control speed setting of the mouse. + /// Ignored if MKF_MODIFIERS is not set. + /// + [Description("Contains the control speed setting of the mouse. " + + "Ignored if MKF_MODIFIERS is not set.")] + public Int32 iCtrlSpeed; + /// + /// Reserved--Do Not Use + /// + [Description("Reserved--Do Not Use")] + public Int32 dwReserved1; + /// + /// Reserved--Do Not Use + /// + [Description("Reserved--Do Not Use")] + public Int32 dwReserved2; + } + + /// + /// Contains the StickyKeys accessibility setting information. + /// + [Description("Contains the StickyKeys accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct STICKYKEYS + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + } + + /// + /// Contains the Windows Accessibility timeout setting information. + /// + [Description("Contains the Windows Accessibility timeout setting information")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct ACCESSTIMEOUT + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + /// + /// Contains the timeout value for automatic shutdown in ms. + /// + [Description("Contains the timeout value for automatic shutdown in ms.")] + public Int32 iTimeOutMSec; + } + + /// + /// Contains the SerialKeys accessibility setting information. + /// + [Description("Contains the SerialKeys accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct SERIALKEYS + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + /// + /// Provides the name of the port used to receive + /// serial communications. If there is no port in + /// use, this member is zero. If the port is set to + /// scan all inputs, then this value returns AUTO. + /// + [Description("Provides the name of the port used to receive " + + "serial communications. If there is no port in " + + "use, this member is zero. If the port is set to" + + "scan all inputs, then this value returns AUTO.")] + [MarshalAs(UnmanagedType.LPWStr, SizeConst=80)] + public String lpszActivePort; + /// + /// Reserved--Do Not Use + /// + [Description("Reserved--Do Not Use")] + [MarshalAs(UnmanagedType.LPWStr, SizeConst=80)] + public String lpszPort; + /// + /// Contains the SerialKeys baud rate setting. + /// + [Description("Contains the SerialKeys baud rate setting.")] + public UInt32 iBaudRate; + /// + /// Contains a number that indicates the current + /// port state. 0 = All input ignored, 1 = Input is + /// watched for SerialKeys activation when no other + /// application has the port open, 2 = All input is + /// treated as SerialKeys commands. + /// + [Description("Contains a number that indicates the current " + + "port state. 0 = All input ignored, 1 = Input is " + + "watched for SerialKeys activation when no other " + + "application has the port open, 2 = All input is " + + "treated as SerialKeys commands.")] + public UInt32 iPortState; + /// + /// Contains the number of the active port. + /// + [Description("Contains the number of the active port.")] + public UInt32 iActive; + } + + /// + /// Contains the SoundSentry accessibility setting information. + /// + [Description("Contains the SoundSentry accessibility setting information.")] + [StructLayout(LayoutKind.Sequential, Pack=1, CharSet=CharSet.Auto)] + public struct SOUNDSENTRY + { + /// + /// Contains the size of the data structure. + /// + [Description("Contains the size of the data structure.")] + public UInt32 cbSize; + /// + /// Contains the settings flags for the data structure. + /// + [Description("Contains the settings flags for the data structure.")] + public Int32 dwFlags; + /// + /// Determines the type of text effect used to display + /// information on screen. Use with the + /// SoundSentryTextEffects enumeration. + /// + [Description("Determines the type of text effect used to display " + + "information on screen. Use with the " + + "SoundSentryTextEffects enumeration.")] + public Int32 iFSTextEffect; + /// + /// Determines the duration of the text screen + /// effect in ms. + /// + [Description("Determines the duration of the text screen " + + "effect in ms.")] + public Int32 iFSTextEffectMSec; + /// + /// Determines the RGB color used to display a + /// text screen effect. + /// + [Description("Determines the RGB color used to display a " + + "text screen effect.")] + public Int32 iFSTextEffectColorBits; + /// + /// Determines the type of graphic effect used to display + /// information on screen. Use with the + /// SoundSentryGraphicEffects enumeration. + /// + [Description("Determines the type of grahic effect used to display " + + "information on screen. Use with the " + + "SoundSentryGraphicEffects enumeration.")] + public Int32 iFSGrafEffect; + /// + /// Determines the duration of the graphics screen + /// effect in ms. + /// + [Description("Determines the duration of the graphics screen " + + "effect in ms.")] + public Int32 iFSGrafEffectMSec; + /// + /// Determines the RGB color used to display a + /// graphics screen effect. + /// + [Description("Determines the RGB color used to display a " + + "graphics screen effect.")] + public Int32 iFSGrafEffectColor; + /// + /// Determines the type of Windows application effect + /// used to display information on screen. Use with + /// the SoundSentryWindowsEffects enumeration. + /// + [Description("Determines the type of Windows application effect " + + "used to display information on screen. Use with " + + "the SoundSentryWindowsEffects enumeration.")] + public Int32 iWindowsEffect; + /// + /// Determines the duration of the Windows application + /// screen effect in ms. + /// + [Description("Determines the duration of the Windows application " + + "screen effect in ms.")] + public Int32 iWindowsEffectMSec; + /// + /// Defines the name of the DLL that contains the + /// SoundSentryProc callback function. This member + /// contains NULL if no DLL is used. + /// + [Description("Defines the name of the DLL that contains the " + + "SoundSentryProc callback function. This member " + + "contains NULL if no DLL is used.")] + [MarshalAs(UnmanagedType.LPWStr, SizeConst=Accessible.MAX_PATH)] + public String lpszWindowsEffectDLL; + /// + /// Reserved--Do Not Use + /// + [Description("Reserved--Do Not Use")] + public Int32 iWindowsEffectOrdinal; + } + #endregion + + #region Accessible Class + /// + /// This class contains the functions required to work with the + /// Windows Accessibility features. + /// + [Description("This class contains the functions required to work with the" + + "Windows Accessibility features.")] + public class Accessible + { + /// + /// Accessible class constructor. + /// + [Description("Accessible class constructor.")] + public Accessible() + { + } + + /// + /// This constant contains the maximum path length + /// used by Windows. + /// + [Description("This constant contains the maximum path length " + + "used by Windows.")] + public const Int32 MAX_PATH = 260; + + /// + /// This function gets or sets the Windows Accessibility + /// setting selected by uiAction. It can optionally + /// update the user profile to match the new settings. + /// + /// The AccessType enumeration member + /// that reflects the accessibility option you want to modify. + /// The actual size of the data structure. + /// A pointer to the local copy of the data structure. + /// One of the WinIniFlag values that reflects + /// the user profile update status. + /// True if the call is successful. + [Description("This function gets or sets the Windows Accessibility" + + "setting selected by uiAction. It can optionally" + + "update the user profile to match the new settings.")] + [DllImport("User32.DLL", CharSet=CharSet.Auto, SetLastError=true)] + public static extern bool SystemParametersInfo(AccessType uiAction, + UInt32 uiParam, + IntPtr pvParam, + WinIniFlags fWinIni); + + /// + /// This is the constant used to obtain information about + /// ShowSounds using the GetSystemMetrics() function. + /// + [Description("This is the constant used to obtain information about " + + "ShowSounds using the GetSystemMetrics() function.")] + public const Int32 SM_SHOWSOUNDS = 70; + + /// + /// The GetSystemMatrics function can retrieve a variety of + /// system metrics information, along with some types of + /// system configuration information. + /// + /// The index of the metric to retrieve. + /// A number indicating the value of the metric. + [Description("The GetSystemMatrics function can retrieve a variety of " + + "system metrics information, along with some types of " + + "system configuration information.")] + [DllImport("User32.DLL", CharSet=CharSet.Auto, SetLastError=true)] + public static extern Int32 GetSystemMetrics(Int32 nIndex); + } + #endregion +} diff --git a/Chapter 06/C#/AccessFuncs/AssemblyInfo.cs b/Chapter 06/C#/AccessFuncs/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/AccessFuncs/bin/Debug/AccessFuncs.XML b/Chapter 06/C#/AccessFuncs/bin/Debug/AccessFuncs.XML new file mode 100644 index 0000000..deb6057 --- /dev/null +++ b/Chapter 06/C#/AccessFuncs/bin/Debug/AccessFuncs.XML @@ -0,0 +1,946 @@ + + + + AccessFuncs + + + + + This enumeration contains a list of common constants used + to interact with the Windows Accessibility features. + + + + + Gets the high contrast information using the + HIGHCONTRAST data structure. + + + + + Sets the high contrast information using the + HIGHCONTRAST data structure. + + + + + Gets the screen readers status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. + + + + + Sets the screen readers status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. + + + + + Gets the FilterKeys information using the + FILTERKEYS data structure. + + + + + Sets the FilterKeys information using the + FILTERKEYS data structure. + + + + + Gets the ToggleKeys information using the + TOGGLEKEYS data structure. + + + + + Sets the ToggleKeys information using the + TOGGLEKEYS data structure. + + + + + Gets the MouseKeys information using the + MOUSEKEYS data structure. + + + + + Sets the MouseKeys information using the + MOUSEKEYS data structure. + + + + + Gets the ShowSounds status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. Microsoft + recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + function in place of this call. + + + + + Sets the ShowSounds status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. Microsoft + recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + function in place of this call. + + + + + Gets the StickyKeys information using the + STICKYKEYS data structure. + + + + + Sets the StickyKeys information using the + STICKYKEYS data structure. + + + + + Gets the Windows Accessibility Timeout information + using the ACCESSTIMEOUT data structure. + + + + + Sets the Windows Accessibility Timeout information + using the ACCESSTIMEOUT data structure. + + + + + Gets the SerialKeys information using the + SERIALKEYS data structure. + + + + + Sets the SerialKeys information using the + SERIALKEYS data structure. + + + + + Gets the SoundSentry information using the + SOUNDSENTRY data structure. + + + + + Gets the SoundSentry information using the + SOUNDSENTRY data structure. + + + + + This enumeration contains the flags used to control + update of the user profile. Select SPIF_NONE if the + application does not need to update the profile. + + + + + Doesn't perform any type of profile update. + + + + + Writes the update to the user profile. + + + + + Writes the update to the user profile and + broadcasts the WM_SETTINGCHANGE message. + + + + + Writes the update to the user profile and + broadcasts the WM_SETTINGCHANGE message. + + + + + A listing of HighContrast accessibility flags. + + + + + HighContrast is On + + + + + HighContrast is available for use. + + + + + HighContrast has the hot key selected. + + + + + Confirmation dialog box displayed for + the HighContrast hot key. + + + + + Make a sound when HighContrast is selected. + + + + + Display an indicator when HighContrast is selected. + + + + + HighContrast hot key is available. + + + + + A listing of FilterKeys accessibility flags. + + + + + FilterKeys is On + + + + + FilterKeys is available for use. + + + + + The FilterKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the FilterKeys hot key. + + + + + Make a sound when changing the FilterKeys status. + + + + + Display an indicator when changing the FilterKeys status. + + + + + The FilterKeys click is set to on. + + + + + A listing of ToggleKeys accessibility flags. + + + + + ToggleKeys is On + + + + + ToggleKeys is available for use. + + + + + The ToggleKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the ToggleKeys hot key. + + + + + Make a sound when changing the ToggleKeys status. + + + + + Display an indicator when changing the ToggleKeys status. + + + + + A listing of MouseKeys accessibility flags. + + + + + MouseKeys is On + + + + + MouseKeys is available for use. + + + + + The MouseKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the MouseKeys hot key. + + + + + Make a sound when changing the MouseKeys status. + + + + + Display an indicator when changing the MouseKeys status. + + + + + Use the Ctrl key to speed the mouse up and the + Shift key to slow the mouse down. + + + + + The numeric keypad moves the mouse when Num Lock is + on when set. + + + + + The user wants to use the left button to select. + + + + + The user wants to use the right button to select. + + + + + The left button to down. + + + + + The right button to down. + + + + + The system is processing numeric keypad input as mouse movement. + + + + + A listing of StickyKeys accessibility flags. + + + + + StickyKeys is On + + + + + StickyKeys is available for use. + + + + + The StickyKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the StickyKeys hot key. + + + + + Make a sound when changing the StickyKeys status. + + + + + Display an indicator when changing the StickyKeys status. + + + + + The system plays a sound when the control keys change status. + + + + + Pressing a key twice locks it--a third time releases it. + + + + + Pressing a control and another key together turns of StickyKeys. + + + + + The left Alt key is latched. + + + + + The left Ctrl key is latched. + + + + + The left Shift key is latched. + + + + + The right Alt key is latched. + + + + + The right Ctrl key is latched. + + + + + The right Shift key is latched. + + + + + The left Windows key is latched. + + + + + The right Windows key is latched. + + + + + The left Alt key is locked. + + + + + The left Ctrl key is locked. + + + + + The left Shift key is locked. + + + + + The right Alt key is locked. + + + + + The right Ctrl key is locked. + + + + + The right Shift key is locked. + + + + + The left Windows key is locked. + + + + + The right Windows key is locked. + + + + + A listing of Windows Accessibility timeout flags. + + + + + If this flag is set, the user has set a timeout value + and the Windows Accessibility features will turn off + after a given time period. If this flag is cleared, the + Windows Accessibility features are always available. + + + + + Make a sound when changing the timeout status. + + + + + A listing of SerialKeys accessibility flags. + + + + + SerialKeys is On + + + + + SerialKeys is available for use. This flag is not + implemented + + + + + Display an indicator when changing the SerialKeys status. + + + + + A listing of SoundSentry accessibility flags. + + + + + SoundSentry is On + + + + + SoundSentry is available for use. This flag is not + implemented + + + + + Display an indicator when changing the SoundSentry + status. + + + + + Contains a list of the possible screen effects for a + full screen DOS text mode application. + + + + + Don't display an effect. + + + + + Flash the characters in the corner of the screen. + + + + + Flash the border (overscan area) of the screen. + + + + + Flash the entire screen. + + + + + Contains a list of the possible screen effects for a + full screen DOS graphics mode application. + + + + + Don't display an effect. + + + + + Flash the entire screen. + + + + + Contains a list of the possible screen effects for a + Windows application. + + + + + Don't display an effect. + + + + + Flash the title bar of the active application. + + + + + Flash the entire active application window. + + + + + Flash the entire screen. + + + + + Use the custom flashing method specified by the + SoundSentryProc() function found in the DLL + specified by the iFSWindowsEffectDLL member. + + + + + Contains the HighContrast accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains a text description of the current scheme. + + + + + Contains the FilterKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Defines the Acceptance Delay value. + + + + + Defines the Delay Until Repeat value. + + + + + Defines the Repeat Rate value. + + + + + Defines the Debounce Time value. + + + + + Contains the ToggleKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the MouseKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the maximum speed setting of the mouse. + + + + + Contains the acceleration setting of the mouse. + + + + + Contains the control speed setting of the mouse. + Ignored if MKF_MODIFIERS is not set. + + + + + Reserved--Do Not Use + + + + + Reserved--Do Not Use + + + + + Contains the StickyKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the Windows Accessibility timeout setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the timeout value for automatic shutdown in ms. + + + + + Contains the SerialKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Provides the name of the port used to receive + serial communications. If there is no port in + use, this member is zero. If the port is set to + scan all inputs, then this value returns AUTO. + + + + + Reserved--Do Not Use + + + + + Contains the SerialKeys baud rate setting. + + + + + Contains a number that indicates the current + port state. 0 = All input ignored, 1 = Input is + watched for SerialKeys activation when no other + application has the port open, 2 = All input is + treated as SerialKeys commands. + + + + + Contains the number of the active port. + + + + + Contains the SoundSentry accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Determines the type of text effect used to display + information on screen. Use with the + SoundSentryTextEffects enumeration. + + + + + Determines the duration of the text screen + effect in ms. + + + + + Determines the RGB color used to display a + text screen effect. + + + + + Determines the type of graphic effect used to display + information on screen. Use with the + SoundSentryGraphicEffects enumeration. + + + + + Determines the duration of the graphics screen + effect in ms. + + + + + Determines the RGB color used to display a + graphics screen effect. + + + + + Determines the type of Windows application effect + used to display information on screen. Use with + the SoundSentryWindowsEffects enumeration. + + + + + Determines the duration of the Windows application + screen effect in ms. + + + + + Defines the name of the DLL that contains the + SoundSentryProc callback function. This member + contains NULL if no DLL is used. + + + + + Reserved--Do Not Use + + + + + This class contains the functions required to work with the + Windows Accessibility features. + + + + + This constant contains the maximum path length + used by Windows. + + + + + This is the constant used to obtain information about + ShowSounds using the GetSystemMetrics() function. + + + + + Accessible class constructor. + + + + + This function gets or sets the Windows Accessibility + setting selected by uiAction. It can optionally + update the user profile to match the new settings. + + The AccessType enumeration member + that reflects the accessibility option you want to modify. + The actual size of the data structure. + A pointer to the local copy of the data structure. + One of the WinIniFlag values that reflects + the user profile update status. + True if the call is successful. + + + + The GetSystemMatrics function can retrieve a variety of + system metrics information, along with some types of + system configuration information. + + The index of the metric to retrieve. + A number indicating the value of the metric. + + + diff --git a/Chapter 06/C#/AccessFuncs/bin/Debug/AccessFuncs.dll b/Chapter 06/C#/AccessFuncs/bin/Debug/AccessFuncs.dll new file mode 100644 index 0000000..9387859 Binary files /dev/null and b/Chapter 06/C#/AccessFuncs/bin/Debug/AccessFuncs.dll differ diff --git a/Chapter 06/C#/AccessFuncs/obj/Debug/AccessFuncs.dll b/Chapter 06/C#/AccessFuncs/obj/Debug/AccessFuncs.dll new file mode 100644 index 0000000..9387859 Binary files /dev/null and b/Chapter 06/C#/AccessFuncs/obj/Debug/AccessFuncs.dll differ diff --git a/Chapter 06/C#/AccessFuncs/obj/Debug/AccessFuncs.projdata b/Chapter 06/C#/AccessFuncs/obj/Debug/AccessFuncs.projdata new file mode 100644 index 0000000..5acd9d1 Binary files /dev/null and b/Chapter 06/C#/AccessFuncs/obj/Debug/AccessFuncs.projdata differ diff --git a/Chapter 06/C#/AccessSettings/AccessSettings.csproj b/Chapter 06/C#/AccessSettings/AccessSettings.csproj new file mode 100644 index 0000000..9c7c6f4 --- /dev/null +++ b/Chapter 06/C#/AccessSettings/AccessSettings.csproj @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/AccessSettings/AccessSettings.csproj.user b/Chapter 06/C#/AccessSettings/AccessSettings.csproj.user new file mode 100644 index 0000000..042dd29 --- /dev/null +++ b/Chapter 06/C#/AccessSettings/AccessSettings.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/AccessSettings/AccessSettings.sln b/Chapter 06/C#/AccessSettings/AccessSettings.sln new file mode 100644 index 0000000..252dd04 --- /dev/null +++ b/Chapter 06/C#/AccessSettings/AccessSettings.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccessSettings", "AccessSettings.csproj", "{22C6579F-B8E7-43B0-B07D-79D3BCEAAC97}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {22C6579F-B8E7-43B0-B07D-79D3BCEAAC97}.Debug.ActiveCfg = Debug|.NET + {22C6579F-B8E7-43B0-B07D-79D3BCEAAC97}.Debug.Build.0 = Debug|.NET + {22C6579F-B8E7-43B0-B07D-79D3BCEAAC97}.Release.ActiveCfg = Release|.NET + {22C6579F-B8E7-43B0-B07D-79D3BCEAAC97}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/AccessSettings/AccessSettings.suo b/Chapter 06/C#/AccessSettings/AccessSettings.suo new file mode 100644 index 0000000..39f452b Binary files /dev/null and b/Chapter 06/C#/AccessSettings/AccessSettings.suo differ diff --git a/Chapter 06/C#/AccessSettings/App.ico b/Chapter 06/C#/AccessSettings/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 06/C#/AccessSettings/App.ico differ diff --git a/Chapter 06/C#/AccessSettings/AssemblyInfo.cs b/Chapter 06/C#/AccessSettings/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 06/C#/AccessSettings/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/AccessSettings/FrmMain.cs b/Chapter 06/C#/AccessSettings/FrmMain.cs new file mode 100644 index 0000000..3312e0e --- /dev/null +++ b/Chapter 06/C#/AccessSettings/FrmMain.cs @@ -0,0 +1,717 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using AccessFuncs; +using System.Runtime.InteropServices; +using System.Text; + +namespace AccessSettings +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.MainMenu mnuMain; + private System.Windows.Forms.ToolTip ToolTip; + private System.Windows.Forms.MenuItem mnuFile; + private System.Windows.Forms.MenuItem mnuFileExit; + private System.Windows.Forms.MenuItem mnuChoose; + private System.Windows.Forms.MenuItem mnuChooseAccessTimeout; + private System.Windows.Forms.MenuItem mnuChooseFilterKeys; + private System.Windows.Forms.MenuItem mnuChooseHighContrast; + private System.Windows.Forms.MenuItem mnuChooseMouseKeys; + private System.Windows.Forms.MenuItem mnuChooseScreenReader; + private System.Windows.Forms.MenuItem mnuChooseSerialKeys; + private System.Windows.Forms.MenuItem mnuChooseShowSounds; + private System.Windows.Forms.MenuItem mnuChooseSoundSentry; + private System.Windows.Forms.MenuItem mnuChooseStickyKeys; + private System.Windows.Forms.MenuItem mnuChooseToggleKeys; + private System.ComponentModel.IContainer components; + + // Data structures or Boolean values used track accessibility + // status in this application. + ACCESSTIMEOUT AT; // Access Timeout + FILTERKEYS FK; // FilterKeys + HIGHCONTRAST HC; // High Contrast + MOUSEKEYS MK; // MouseKeys + bool SR; // ScreenReader + SERIALKEYS SC; // SerialKeys + bool SSound; // ShowSounds + SOUNDSENTRY SSentry; // SoundSentry + STICKYKEYS SK; // StickyKeys + TOGGLEKEYS TK; // ToggleKeys + + public frmMain() + { + Int32 DataSize; // Size of the data structure. + + // Required for Windows Form Designer support + InitializeComponent(); + + // Initialize the data structures. + AT = new ACCESSTIMEOUT(); // Access Timeout + FK = new FILTERKEYS(); // FilterKeys + HC = new HIGHCONTRAST(); // High Contrast + MK = new MOUSEKEYS(); // MouseKeys + SR = false; // ScreenReader + SC = new SERIALKEYS(); // SerialKeys + SSound = false; // ShowSounds + SSentry = new SOUNDSENTRY(); // SoundSentry + SK = new STICKYKEYS(); // StickyKeys + TK = new TOGGLEKEYS(); // ToggleKeys + + // Initialize the data structures and Choose menu options. The + // process includes getting the current option status (which + // fills out the data structure) and then comparing the flag + // values to see if the option is on. + + // Access Timeout + DataSize = Marshal.SizeOf(AT); + AT.cbSize = Convert.ToUInt32(DataSize); + AT = (ACCESSTIMEOUT)GetAccessibleOption( + AT, + DataSize, + AccessType.SPI_GETACCESSTIMEOUT, + WinIniFlags.SPIF_NONE); + if ((AT.dwFlags & (Int32)AccessTimeoutFlags.ATF_TIMEOUTON) == + (Int32)AccessTimeoutFlags.ATF_TIMEOUTON) + mnuChooseAccessTimeout.Checked = true; + + // FilterKeys + DataSize = Marshal.SizeOf(FK); + FK.cbSize = Convert.ToUInt32(DataSize); + FK = (FILTERKEYS)GetAccessibleOption( + FK, + DataSize, + AccessType.SPI_GETFILTERKEYS, + WinIniFlags.SPIF_NONE); + if ((FK.dwFlags & (Int32)FilterKeysFlags.FKF_FILTERKEYSON) == + (Int32)FilterKeysFlags.FKF_FILTERKEYSON) + mnuChooseFilterKeys.Checked = true; + + // High Contrast + DataSize = Marshal.SizeOf(HC); + HC.cbSize = Convert.ToUInt32(DataSize); + HC = (HIGHCONTRAST)GetAccessibleOption( + HC, + DataSize, + AccessType.SPI_GETHIGHCONTRAST, + WinIniFlags.SPIF_NONE); + if ((HC.dwFlags & (Int32)HighContrastFlags.HCF_HIGHCONTRASTON) == + (Int32)HighContrastFlags.HCF_HIGHCONTRASTON) + mnuChooseHighContrast.Checked = true; + + // MouseKeys + DataSize = Marshal.SizeOf(MK); + MK.cbSize = Convert.ToUInt32(DataSize); + MK = (MOUSEKEYS)GetAccessibleOption( + MK, + DataSize, + AccessType.SPI_GETMOUSEKEYS, + WinIniFlags.SPIF_NONE); + if ((MK.dwFlags & (Int32)MouseKeysFlags.MKF_MOUSEKEYSON) == + (Int32)MouseKeysFlags.MKF_MOUSEKEYSON) + mnuChooseMouseKeys.Checked = true; + + // Screen Reader + DataSize = Marshal.SizeOf(SR); + SR = (bool)GetAccessibleOption( + SR, + DataSize, + AccessType.SPI_GETSCREENREADER, + WinIniFlags.SPIF_NONE); + if (SR) + mnuChooseScreenReader.Checked = true; + + // SerialKeys + DataSize = Marshal.SizeOf(SC); + SC.cbSize = Convert.ToUInt32(DataSize); + SC = (SERIALKEYS)GetAccessibleOption( + SC, + DataSize, + AccessType.SPI_GETSERIALKEYS, + WinIniFlags.SPIF_NONE); + if ((SC.dwFlags & (Int32)SerialKeysFlags.SERKF_SERIALKEYSON) == + (Int32)SerialKeysFlags.SERKF_SERIALKEYSON) + mnuChooseSerialKeys.Checked = true; + else if (SC.lpszActivePort == null) + + // This is one of the few accessibility options not supported + // under Windows 2000/XP. Microsoft changed this behavior to + // ensure that SerialKeys devices would appear as standard + // input devices to the application. The lpszActivePort member + // will always contain a value for operating systems that + // support the SerialKeys feature. + mnuChooseSerialKeys.Enabled = false; + + // ShowSounds + DataSize = Marshal.SizeOf(SSound); + SSound = (bool)GetAccessibleOption( + SSound, + DataSize, + AccessType.SPI_GETSHOWSOUNDS, + WinIniFlags.SPIF_NONE); + if (SSound) + mnuChooseShowSounds.Checked = true; + + // SoundSentry + DataSize = Marshal.SizeOf(SSentry); + SSentry.cbSize = Convert.ToUInt32(DataSize); + SSentry = (SOUNDSENTRY)GetAccessibleOption( + SSentry, + DataSize, + AccessType.SPI_GETSOUNDSENTRY, + WinIniFlags.SPIF_NONE); + if ((SSentry.dwFlags & (Int32)SoundSentryFlags.SSF_SOUNDSENTRYON) == + (Int32)SoundSentryFlags.SSF_SOUNDSENTRYON) + mnuChooseSoundSentry.Checked = true; + + // StickyKeys + DataSize = Marshal.SizeOf(SK); + SK.cbSize = Convert.ToUInt32(DataSize); + SK = (STICKYKEYS)GetAccessibleOption( + SK, + DataSize, + AccessType.SPI_GETSTICKYKEYS, + WinIniFlags.SPIF_NONE); + if ((SK.dwFlags & (Int32)StickyKeysFlags.SKF_STICKYKEYSON) == + (Int32)StickyKeysFlags.SKF_STICKYKEYSON) + mnuChooseStickyKeys.Checked = true; + + // ToggleKeys + DataSize = Marshal.SizeOf(TK); + TK.cbSize = Convert.ToUInt32(DataSize); + TK = (TOGGLEKEYS)GetAccessibleOption( + TK, + DataSize, + AccessType.SPI_GETTOGGLEKEYS, + WinIniFlags.SPIF_NONE); + if ((TK.dwFlags & (Int32)ToggleKeysFlags.TKF_TOGGLEKEYSON) == + (Int32)ToggleKeysFlags.TKF_TOGGLEKEYSON) + mnuChooseToggleKeys.Checked = true; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.mnuMain = new System.Windows.Forms.MainMenu(); + this.mnuFile = new System.Windows.Forms.MenuItem(); + this.mnuFileExit = new System.Windows.Forms.MenuItem(); + this.mnuChoose = new System.Windows.Forms.MenuItem(); + this.mnuChooseAccessTimeout = new System.Windows.Forms.MenuItem(); + this.mnuChooseFilterKeys = new System.Windows.Forms.MenuItem(); + this.mnuChooseHighContrast = new System.Windows.Forms.MenuItem(); + this.mnuChooseMouseKeys = new System.Windows.Forms.MenuItem(); + this.mnuChooseScreenReader = new System.Windows.Forms.MenuItem(); + this.mnuChooseSerialKeys = new System.Windows.Forms.MenuItem(); + this.mnuChooseShowSounds = new System.Windows.Forms.MenuItem(); + this.mnuChooseSoundSentry = new System.Windows.Forms.MenuItem(); + this.mnuChooseStickyKeys = new System.Windows.Forms.MenuItem(); + this.mnuChooseToggleKeys = new System.Windows.Forms.MenuItem(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + // + // mnuMain + // + this.mnuMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuFile, + this.mnuChoose}); + // + // mnuFile + // + this.mnuFile.Index = 0; + this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuFileExit}); + this.mnuFile.Text = "&File"; + // + // mnuFileExit + // + this.mnuFileExit.Index = 0; + this.mnuFileExit.Shortcut = System.Windows.Forms.Shortcut.AltF4; + this.mnuFileExit.Text = "E&xit"; + this.mnuFileExit.Click += new System.EventHandler(this.mnuFileExit_Click); + // + // mnuChoose + // + this.mnuChoose.Index = 1; + this.mnuChoose.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { + this.mnuChooseAccessTimeout, + this.mnuChooseFilterKeys, + this.mnuChooseHighContrast, + this.mnuChooseMouseKeys, + this.mnuChooseScreenReader, + this.mnuChooseSerialKeys, + this.mnuChooseShowSounds, + this.mnuChooseSoundSentry, + this.mnuChooseStickyKeys, + this.mnuChooseToggleKeys}); + this.mnuChoose.Text = "&Choose Feature"; + // + // mnuChooseAccessTimeout + // + this.mnuChooseAccessTimeout.Index = 0; + this.mnuChooseAccessTimeout.Shortcut = System.Windows.Forms.Shortcut.F2; + this.mnuChooseAccessTimeout.Text = "&Access Timeout"; + this.mnuChooseAccessTimeout.Click += new System.EventHandler(this.mnuChooseAccessTimeout_Click); + // + // mnuChooseFilterKeys + // + this.mnuChooseFilterKeys.Index = 1; + this.mnuChooseFilterKeys.Shortcut = System.Windows.Forms.Shortcut.F3; + this.mnuChooseFilterKeys.Text = "&FilterKeys"; + this.mnuChooseFilterKeys.Click += new System.EventHandler(this.mnuChooseFilterKeys_Click); + // + // mnuChooseHighContrast + // + this.mnuChooseHighContrast.Index = 2; + this.mnuChooseHighContrast.Shortcut = System.Windows.Forms.Shortcut.F4; + this.mnuChooseHighContrast.Text = "&High Contrast"; + this.mnuChooseHighContrast.Click += new System.EventHandler(this.mnuChooseHighContrast_Click); + // + // mnuChooseMouseKeys + // + this.mnuChooseMouseKeys.Index = 3; + this.mnuChooseMouseKeys.Shortcut = System.Windows.Forms.Shortcut.F5; + this.mnuChooseMouseKeys.Text = "&MouseKeys"; + this.mnuChooseMouseKeys.Click += new System.EventHandler(this.mnuChooseMouseKeys_Click); + // + // mnuChooseScreenReader + // + this.mnuChooseScreenReader.Index = 4; + this.mnuChooseScreenReader.Shortcut = System.Windows.Forms.Shortcut.F6; + this.mnuChooseScreenReader.Text = "&ScreenReader"; + this.mnuChooseScreenReader.Click += new System.EventHandler(this.mnuChooseScreenReader_Click); + // + // mnuChooseSerialKeys + // + this.mnuChooseSerialKeys.Index = 5; + this.mnuChooseSerialKeys.Shortcut = System.Windows.Forms.Shortcut.F7; + this.mnuChooseSerialKeys.Text = "S&erialKeys"; + this.mnuChooseSerialKeys.Click += new System.EventHandler(this.mnuChooseSerialKeys_Click); + // + // mnuChooseShowSounds + // + this.mnuChooseShowSounds.Index = 6; + this.mnuChooseShowSounds.Shortcut = System.Windows.Forms.Shortcut.F8; + this.mnuChooseShowSounds.Text = "Sh&owSounds"; + this.mnuChooseShowSounds.Click += new System.EventHandler(this.mnuChooseShowSounds_Click); + // + // mnuChooseSoundSentry + // + this.mnuChooseSoundSentry.Index = 7; + this.mnuChooseSoundSentry.Shortcut = System.Windows.Forms.Shortcut.F9; + this.mnuChooseSoundSentry.Text = "Sound&Sentry"; + this.mnuChooseSoundSentry.Click += new System.EventHandler(this.mnuChooseSoundSentry_Click); + // + // mnuChooseStickyKeys + // + this.mnuChooseStickyKeys.Index = 8; + this.mnuChooseStickyKeys.Shortcut = System.Windows.Forms.Shortcut.F10; + this.mnuChooseStickyKeys.Text = "Sticky&Keys"; + this.mnuChooseStickyKeys.Click += new System.EventHandler(this.mnuChooseStickyKeys_Click); + // + // mnuChooseToggleKeys + // + this.mnuChooseToggleKeys.Index = 9; + this.mnuChooseToggleKeys.Shortcut = System.Windows.Forms.Shortcut.F11; + this.mnuChooseToggleKeys.Text = "&ToggleKeys"; + this.mnuChooseToggleKeys.Click += new System.EventHandler(this.mnuChooseToggleKeys_Click); + // + // ToolTip + // + this.ToolTip.AutomaticDelay = 300; + this.ToolTip.AutoPopDelay = 7000; + this.ToolTip.InitialDelay = 300; + this.ToolTip.ReshowDelay = 60; + // + // frmMain + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(357, 256); + this.Menu = this.mnuMain; + this.Name = "frmMain"; + this.Text = "Accessibility Functionality Demonstration"; + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private Object GetAccessibleOption(Object Struct, + Int32 StructSize, + AccessType AccessType, + WinIniFlags IniFlag) + { + Object ReturnValue; // The return data. + + // Allocate enough memory to create an unmanaged version + // of the data structure. + IntPtr DataPtr = Marshal.AllocHGlobal(StructSize); + + // Point to the managed data stucture using the unmanaged + // memory pointer. + Marshal.StructureToPtr(Struct, DataPtr, true); + + // Call the SystemParametersInfo() function using the + // unmanaged data structure pointer. + Accessible.SystemParametersInfo(AccessType, + Convert.ToUInt32(StructSize), + DataPtr, + IniFlag); + + // Move the data retrieved from the umnanaged environment to + // the managed data structure and return this data structure + // as an object. + ReturnValue = Marshal.PtrToStructure(DataPtr, Struct.GetType()); + + // Deallocate the memory we previously allocated. + Marshal.FreeHGlobal(DataPtr); + + // Return the data. + return ReturnValue; + } + + private bool SetAccessibleOption(Object Struct, + Int32 StructSize, + AccessType AccessType, + WinIniFlags IniFlag) + { + bool ReturnValue; // The return value of this method. + + // Allocate enough memory to create an unmanaged version + // of the data structure. + IntPtr DataPtr = Marshal.AllocHGlobal(StructSize); + + // Point to the managed data stucture using the unmanaged + // memory pointer. + Marshal.StructureToPtr(Struct, DataPtr, true); + + // Return true if the SystemParametersInfo() function call + // successfully modifies the Windows Accessibility features + // using the data in the data structure. + ReturnValue = Accessible.SystemParametersInfo( + AccessType, + Convert.ToUInt32(StructSize), + DataPtr, + IniFlag); + + // Deallocate the memory we previously allocated. + Marshal.FreeHGlobal(DataPtr); + + // Return the data. + return ReturnValue; + } + + private void mnuFileExit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void mnuChooseAccessTimeout_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((AT.dwFlags & (Int32)AccessTimeoutFlags.ATF_TIMEOUTON) == + (Int32)AccessTimeoutFlags.ATF_TIMEOUTON) + AT.dwFlags = AT.dwFlags ^ + (Int32)AccessTimeoutFlags.ATF_TIMEOUTON; + else + AT.dwFlags = AT.dwFlags | + (Int32)AccessTimeoutFlags.ATF_TIMEOUTON; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(AT); + + // If the function fails, display an error message. + if (!SetAccessibleOption(AT, + DataSize, + AccessType.SPI_SETACCESSTIMEOUT, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the Access Timeout option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseAccessTimeout.Checked = !mnuChooseAccessTimeout.Checked; + } + + private void mnuChooseFilterKeys_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((FK.dwFlags & (Int32)FilterKeysFlags.FKF_FILTERKEYSON) == + (Int32)FilterKeysFlags.FKF_FILTERKEYSON) + FK.dwFlags = FK.dwFlags ^ + (Int32)FilterKeysFlags.FKF_FILTERKEYSON; + else + FK.dwFlags = FK.dwFlags | + (Int32)FilterKeysFlags.FKF_FILTERKEYSON; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(FK); + + // If the function fails, display an error message. + if (!SetAccessibleOption(FK, + DataSize, + AccessType.SPI_SETFILTERKEYS, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the FilterKeys option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseFilterKeys.Checked = !mnuChooseFilterKeys.Checked; + } + + private void mnuChooseHighContrast_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((HC.dwFlags & (Int32)HighContrastFlags.HCF_HIGHCONTRASTON) == + (Int32)HighContrastFlags.HCF_HIGHCONTRASTON) + HC.dwFlags = HC.dwFlags ^ + (Int32)HighContrastFlags.HCF_HIGHCONTRASTON; + else + HC.dwFlags = HC.dwFlags | + (Int32)HighContrastFlags.HCF_HIGHCONTRASTON; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(HC); + + // If the function fails, display an error message. + if (!SetAccessibleOption(HC, + DataSize, + AccessType.SPI_SETHIGHCONTRAST, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the High Contrast option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseHighContrast.Checked = !mnuChooseHighContrast.Checked; + } + + private void mnuChooseMouseKeys_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((MK.dwFlags & (Int32)MouseKeysFlags.MKF_MOUSEKEYSON) == + (Int32)MouseKeysFlags.MKF_MOUSEKEYSON) + MK.dwFlags = MK.dwFlags ^ + (Int32)MouseKeysFlags.MKF_MOUSEKEYSON; + else + MK.dwFlags = MK.dwFlags | + (Int32)MouseKeysFlags.MKF_MOUSEKEYSON; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(MK); + + // If the function fails, display an error message. + if (!SetAccessibleOption(MK, + DataSize, + AccessType.SPI_SETMOUSEKEYS, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the MouseKeys option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseMouseKeys.Checked = !mnuChooseMouseKeys.Checked; + } + + private void mnuChooseScreenReader_Click(object sender, System.EventArgs e) + { + // You can't turn the screen reader on and off using a menu option. + MessageBox.Show("This is a status indicator only. Set the screen " + + "reader on using the Narrator application on the " + + "Accessibility menu.", + "Accessibility Option Status", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + + private void mnuChooseSerialKeys_Click(object sender, System.EventArgs e) + { + // You shouldn't turn SerialKeys on and off using a menu option. + MessageBox.Show("This is a status indicator only. Set " + + "SerialKeys on by adding a SerialKeys " + + "device to your system and modifying " + + "the Control Panel setting.", + "Accessibility Option Status", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + + private void mnuChooseShowSounds_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + SSound = !SSound; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(SSound); + + // If the function fails, display an error message. + if (!SetAccessibleOption(IntPtr.Zero, + Convert.ToInt32(SSound), + AccessType.SPI_SETSHOWSOUNDS, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the ShowSounds option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseShowSounds.Checked = !mnuChooseShowSounds.Checked; + } + + private void mnuChooseSoundSentry_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((SSentry.dwFlags & (Int32)SoundSentryFlags.SSF_SOUNDSENTRYON) == + (Int32)SoundSentryFlags.SSF_SOUNDSENTRYON) + SSentry.dwFlags = SSentry.dwFlags ^ + (Int32)SoundSentryFlags.SSF_SOUNDSENTRYON; + else + { + SSentry.dwFlags = SSentry.dwFlags | + (Int32)SoundSentryFlags.SSF_SOUNDSENTRYON; + SSentry.iWindowsEffect = (Int32)SoundSentryWindowsEffects.SSWF_TITLE; + } + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(SSentry); + + // If the function fails, display an error message. + if (!SetAccessibleOption(SSentry, + DataSize, + AccessType.SPI_SETSOUNDSENTRY, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the SoundSentry option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseSoundSentry.Checked = !mnuChooseSoundSentry.Checked; + } + + private void mnuChooseStickyKeys_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((SK.dwFlags & (Int32)StickyKeysFlags.SKF_STICKYKEYSON) == + (Int32)StickyKeysFlags.SKF_STICKYKEYSON) + SK.dwFlags = SK.dwFlags ^ + (Int32)StickyKeysFlags.SKF_STICKYKEYSON; + else + SK.dwFlags = SK.dwFlags | + (Int32)StickyKeysFlags.SKF_STICKYKEYSON; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(SK); + + // If the function fails, display an error message. + if (!SetAccessibleOption(SK, + DataSize, + AccessType.SPI_SETSTICKYKEYS, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the StickyKeys option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseStickyKeys.Checked = !mnuChooseStickyKeys.Checked; + } + + private void mnuChooseToggleKeys_Click(object sender, System.EventArgs e) + { + Int32 DataSize; // Size of the data structure. + + // Set the flag value as needed to toggle the feature on or off. + if ((TK.dwFlags & (Int32)ToggleKeysFlags.TKF_TOGGLEKEYSON) == + (Int32)ToggleKeysFlags.TKF_TOGGLEKEYSON) + TK.dwFlags = TK.dwFlags ^ + (Int32)ToggleKeysFlags.TKF_TOGGLEKEYSON; + else + TK.dwFlags = TK.dwFlags | + (Int32)ToggleKeysFlags.TKF_TOGGLEKEYSON; + + // Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(TK); + + // If the function fails, display an error message. + if (!SetAccessibleOption(TK, + DataSize, + AccessType.SPI_SETTOGGLEKEYS, + WinIniFlags.SPIF_NONE)) + MessageBox.Show("Could not set the ToggleKeys option", + "Accessibility Option Error", + MessageBoxButtons.OK, + MessageBoxIcon.Error); + + // If the function succeeds, display a success message and change + // the menu setting. + else + mnuChooseToggleKeys.Checked = !mnuChooseToggleKeys.Checked; + } + } +} diff --git a/Chapter 06/C#/AccessSettings/FrmMain.resx b/Chapter 06/C#/AccessSettings/FrmMain.resx new file mode 100644 index 0000000..f334755 --- /dev/null +++ b/Chapter 06/C#/AccessSettings/FrmMain.resx @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + 17, 17 + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + Private + + + 126, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 06/C#/AccessSettings/bin/Debug/AccessFuncs.dll b/Chapter 06/C#/AccessSettings/bin/Debug/AccessFuncs.dll new file mode 100644 index 0000000..9387859 Binary files /dev/null and b/Chapter 06/C#/AccessSettings/bin/Debug/AccessFuncs.dll differ diff --git a/Chapter 06/C#/AccessSettings/bin/Debug/AccessFuncs.xml b/Chapter 06/C#/AccessSettings/bin/Debug/AccessFuncs.xml new file mode 100644 index 0000000..deb6057 --- /dev/null +++ b/Chapter 06/C#/AccessSettings/bin/Debug/AccessFuncs.xml @@ -0,0 +1,946 @@ + + + + AccessFuncs + + + + + This enumeration contains a list of common constants used + to interact with the Windows Accessibility features. + + + + + Gets the high contrast information using the + HIGHCONTRAST data structure. + + + + + Sets the high contrast information using the + HIGHCONTRAST data structure. + + + + + Gets the screen readers status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. + + + + + Sets the screen readers status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. + + + + + Gets the FilterKeys information using the + FILTERKEYS data structure. + + + + + Sets the FilterKeys information using the + FILTERKEYS data structure. + + + + + Gets the ToggleKeys information using the + TOGGLEKEYS data structure. + + + + + Sets the ToggleKeys information using the + TOGGLEKEYS data structure. + + + + + Gets the MouseKeys information using the + MOUSEKEYS data structure. + + + + + Sets the MouseKeys information using the + MOUSEKEYS data structure. + + + + + Gets the ShowSounds status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. Microsoft + recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + function in place of this call. + + + + + Sets the ShowSounds status. Unlike some other + accessibility settings, this one relies on a BOOL, + rather than a data structure for input. Microsoft + recommends using the GetSystemMetrics(SM_SHOWSOUNDS) + function in place of this call. + + + + + Gets the StickyKeys information using the + STICKYKEYS data structure. + + + + + Sets the StickyKeys information using the + STICKYKEYS data structure. + + + + + Gets the Windows Accessibility Timeout information + using the ACCESSTIMEOUT data structure. + + + + + Sets the Windows Accessibility Timeout information + using the ACCESSTIMEOUT data structure. + + + + + Gets the SerialKeys information using the + SERIALKEYS data structure. + + + + + Sets the SerialKeys information using the + SERIALKEYS data structure. + + + + + Gets the SoundSentry information using the + SOUNDSENTRY data structure. + + + + + Gets the SoundSentry information using the + SOUNDSENTRY data structure. + + + + + This enumeration contains the flags used to control + update of the user profile. Select SPIF_NONE if the + application does not need to update the profile. + + + + + Doesn't perform any type of profile update. + + + + + Writes the update to the user profile. + + + + + Writes the update to the user profile and + broadcasts the WM_SETTINGCHANGE message. + + + + + Writes the update to the user profile and + broadcasts the WM_SETTINGCHANGE message. + + + + + A listing of HighContrast accessibility flags. + + + + + HighContrast is On + + + + + HighContrast is available for use. + + + + + HighContrast has the hot key selected. + + + + + Confirmation dialog box displayed for + the HighContrast hot key. + + + + + Make a sound when HighContrast is selected. + + + + + Display an indicator when HighContrast is selected. + + + + + HighContrast hot key is available. + + + + + A listing of FilterKeys accessibility flags. + + + + + FilterKeys is On + + + + + FilterKeys is available for use. + + + + + The FilterKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the FilterKeys hot key. + + + + + Make a sound when changing the FilterKeys status. + + + + + Display an indicator when changing the FilterKeys status. + + + + + The FilterKeys click is set to on. + + + + + A listing of ToggleKeys accessibility flags. + + + + + ToggleKeys is On + + + + + ToggleKeys is available for use. + + + + + The ToggleKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the ToggleKeys hot key. + + + + + Make a sound when changing the ToggleKeys status. + + + + + Display an indicator when changing the ToggleKeys status. + + + + + A listing of MouseKeys accessibility flags. + + + + + MouseKeys is On + + + + + MouseKeys is available for use. + + + + + The MouseKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the MouseKeys hot key. + + + + + Make a sound when changing the MouseKeys status. + + + + + Display an indicator when changing the MouseKeys status. + + + + + Use the Ctrl key to speed the mouse up and the + Shift key to slow the mouse down. + + + + + The numeric keypad moves the mouse when Num Lock is + on when set. + + + + + The user wants to use the left button to select. + + + + + The user wants to use the right button to select. + + + + + The left button to down. + + + + + The right button to down. + + + + + The system is processing numeric keypad input as mouse movement. + + + + + A listing of StickyKeys accessibility flags. + + + + + StickyKeys is On + + + + + StickyKeys is available for use. + + + + + The StickyKeys hotkey is active. + + + + + Confirmation dialog box displayed for + the StickyKeys hot key. + + + + + Make a sound when changing the StickyKeys status. + + + + + Display an indicator when changing the StickyKeys status. + + + + + The system plays a sound when the control keys change status. + + + + + Pressing a key twice locks it--a third time releases it. + + + + + Pressing a control and another key together turns of StickyKeys. + + + + + The left Alt key is latched. + + + + + The left Ctrl key is latched. + + + + + The left Shift key is latched. + + + + + The right Alt key is latched. + + + + + The right Ctrl key is latched. + + + + + The right Shift key is latched. + + + + + The left Windows key is latched. + + + + + The right Windows key is latched. + + + + + The left Alt key is locked. + + + + + The left Ctrl key is locked. + + + + + The left Shift key is locked. + + + + + The right Alt key is locked. + + + + + The right Ctrl key is locked. + + + + + The right Shift key is locked. + + + + + The left Windows key is locked. + + + + + The right Windows key is locked. + + + + + A listing of Windows Accessibility timeout flags. + + + + + If this flag is set, the user has set a timeout value + and the Windows Accessibility features will turn off + after a given time period. If this flag is cleared, the + Windows Accessibility features are always available. + + + + + Make a sound when changing the timeout status. + + + + + A listing of SerialKeys accessibility flags. + + + + + SerialKeys is On + + + + + SerialKeys is available for use. This flag is not + implemented + + + + + Display an indicator when changing the SerialKeys status. + + + + + A listing of SoundSentry accessibility flags. + + + + + SoundSentry is On + + + + + SoundSentry is available for use. This flag is not + implemented + + + + + Display an indicator when changing the SoundSentry + status. + + + + + Contains a list of the possible screen effects for a + full screen DOS text mode application. + + + + + Don't display an effect. + + + + + Flash the characters in the corner of the screen. + + + + + Flash the border (overscan area) of the screen. + + + + + Flash the entire screen. + + + + + Contains a list of the possible screen effects for a + full screen DOS graphics mode application. + + + + + Don't display an effect. + + + + + Flash the entire screen. + + + + + Contains a list of the possible screen effects for a + Windows application. + + + + + Don't display an effect. + + + + + Flash the title bar of the active application. + + + + + Flash the entire active application window. + + + + + Flash the entire screen. + + + + + Use the custom flashing method specified by the + SoundSentryProc() function found in the DLL + specified by the iFSWindowsEffectDLL member. + + + + + Contains the HighContrast accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains a text description of the current scheme. + + + + + Contains the FilterKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Defines the Acceptance Delay value. + + + + + Defines the Delay Until Repeat value. + + + + + Defines the Repeat Rate value. + + + + + Defines the Debounce Time value. + + + + + Contains the ToggleKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the MouseKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the maximum speed setting of the mouse. + + + + + Contains the acceleration setting of the mouse. + + + + + Contains the control speed setting of the mouse. + Ignored if MKF_MODIFIERS is not set. + + + + + Reserved--Do Not Use + + + + + Reserved--Do Not Use + + + + + Contains the StickyKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the Windows Accessibility timeout setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Contains the timeout value for automatic shutdown in ms. + + + + + Contains the SerialKeys accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Provides the name of the port used to receive + serial communications. If there is no port in + use, this member is zero. If the port is set to + scan all inputs, then this value returns AUTO. + + + + + Reserved--Do Not Use + + + + + Contains the SerialKeys baud rate setting. + + + + + Contains a number that indicates the current + port state. 0 = All input ignored, 1 = Input is + watched for SerialKeys activation when no other + application has the port open, 2 = All input is + treated as SerialKeys commands. + + + + + Contains the number of the active port. + + + + + Contains the SoundSentry accessibility setting information. + + + + + Contains the size of the data structure. + + + + + Contains the settings flags for the data structure. + + + + + Determines the type of text effect used to display + information on screen. Use with the + SoundSentryTextEffects enumeration. + + + + + Determines the duration of the text screen + effect in ms. + + + + + Determines the RGB color used to display a + text screen effect. + + + + + Determines the type of graphic effect used to display + information on screen. Use with the + SoundSentryGraphicEffects enumeration. + + + + + Determines the duration of the graphics screen + effect in ms. + + + + + Determines the RGB color used to display a + graphics screen effect. + + + + + Determines the type of Windows application effect + used to display information on screen. Use with + the SoundSentryWindowsEffects enumeration. + + + + + Determines the duration of the Windows application + screen effect in ms. + + + + + Defines the name of the DLL that contains the + SoundSentryProc callback function. This member + contains NULL if no DLL is used. + + + + + Reserved--Do Not Use + + + + + This class contains the functions required to work with the + Windows Accessibility features. + + + + + This constant contains the maximum path length + used by Windows. + + + + + This is the constant used to obtain information about + ShowSounds using the GetSystemMetrics() function. + + + + + Accessible class constructor. + + + + + This function gets or sets the Windows Accessibility + setting selected by uiAction. It can optionally + update the user profile to match the new settings. + + The AccessType enumeration member + that reflects the accessibility option you want to modify. + The actual size of the data structure. + A pointer to the local copy of the data structure. + One of the WinIniFlag values that reflects + the user profile update status. + True if the call is successful. + + + + The GetSystemMatrics function can retrieve a variety of + system metrics information, along with some types of + system configuration information. + + The index of the metric to retrieve. + A number indicating the value of the metric. + + + diff --git a/Chapter 06/C#/AccessSettings/bin/Debug/AccessSettings.exe b/Chapter 06/C#/AccessSettings/bin/Debug/AccessSettings.exe new file mode 100644 index 0000000..c012af0 Binary files /dev/null and b/Chapter 06/C#/AccessSettings/bin/Debug/AccessSettings.exe differ diff --git a/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.exe b/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.exe new file mode 100644 index 0000000..c012af0 Binary files /dev/null and b/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.exe differ diff --git a/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.frmMain.resources b/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.frmMain.resources new file mode 100644 index 0000000..21648b6 Binary files /dev/null and b/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.frmMain.resources differ diff --git a/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.projdata b/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.projdata new file mode 100644 index 0000000..4b1b807 Binary files /dev/null and b/Chapter 06/C#/AccessSettings/obj/Debug/AccessSettings.projdata differ diff --git a/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.csproj b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.csproj new file mode 100644 index 0000000..ddafbec --- /dev/null +++ b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.csproj @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.csproj.user b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.sln b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.sln new file mode 100644 index 0000000..931b70a --- /dev/null +++ b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccessibleObjectDemo", "AccessibleObjectDemo.csproj", "{CC09F344-1B73-48C4-B601-615C80E2AF89}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CC09F344-1B73-48C4-B601-615C80E2AF89}.Debug.ActiveCfg = Debug|.NET + {CC09F344-1B73-48C4-B601-615C80E2AF89}.Debug.Build.0 = Debug|.NET + {CC09F344-1B73-48C4-B601-615C80E2AF89}.Release.ActiveCfg = Release|.NET + {CC09F344-1B73-48C4-B601-615C80E2AF89}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.suo b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.suo new file mode 100644 index 0000000..4e9c678 Binary files /dev/null and b/Chapter 06/C#/AccessibleObjectDemo/AccessibleObjectDemo.suo differ diff --git a/Chapter 06/C#/AccessibleObjectDemo/App.ico b/Chapter 06/C#/AccessibleObjectDemo/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 06/C#/AccessibleObjectDemo/App.ico differ diff --git a/Chapter 06/C#/AccessibleObjectDemo/AssemblyInfo.cs b/Chapter 06/C#/AccessibleObjectDemo/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 06/C#/AccessibleObjectDemo/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/AccessibleObjectDemo/FrmMain.cs b/Chapter 06/C#/AccessibleObjectDemo/FrmMain.cs new file mode 100644 index 0000000..3f8f8a8 --- /dev/null +++ b/Chapter 06/C#/AccessibleObjectDemo/FrmMain.cs @@ -0,0 +1,202 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Text; + +namespace AccessibleObjectDemo +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtMessage; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // Required for Windows Form Designer support + InitializeComponent(); + + // Initialize the accessible objects. + btnQuit.AccessibleDefaultActionDescription = + "Press to exit the application."; + btnTest.AccessibleDefaultActionDescription = + "Press to test the application."; + txtMessage.AccessibleDefaultActionDescription = + "Type to change test message."; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnQuit = new System.Windows.Forms.Button(); + this.btnTest = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.txtMessage = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button lets you to exit the application."; + this.btnQuit.AccessibleName = "Exit the Application"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 3; + this.btnQuit.Text = "&Quit"; + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + this.btnQuit.MouseHover += new System.EventHandler(this.SpecialTip); + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button tests application functionality."; + this.btnTest.AccessibleName = "Test the Application"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 2; + this.btnTest.Text = "&Test"; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + this.btnTest.MouseHover += new System.EventHandler(this.SpecialTip); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 8); + this.label1.Name = "label1"; + this.label1.TabIndex = 4; + this.label1.Text = "Test &Messsage"; + // + // txtMessage + // + this.txtMessage.AccessibleDescription = "Contains the message you want to display during test."; + this.txtMessage.AccessibleName = "Application Test Message"; + this.txtMessage.AccessibleRole = System.Windows.Forms.AccessibleRole.Text; + this.txtMessage.Location = new System.Drawing.Point(8, 32); + this.txtMessage.Name = "txtMessage"; + this.txtMessage.Size = new System.Drawing.Size(176, 20); + this.txtMessage.TabIndex = 5; + this.txtMessage.Text = "This is a test message box."; + this.txtMessage.MouseHover += new System.EventHandler(this.SpecialTip); + // + // frmMain + // + this.AcceptButton = this.btnTest; + this.AccessibleDescription = "This application demonstrates use of the AccessibleObject class."; + this.AccessibleName = "Accessible Object Demonstration"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.txtMessage); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnQuit); + this.Controls.Add(this.btnTest); + this.Name = "frmMain"; + this.Text = "AccessibleObject Demonstration"; + this.MouseHover += new System.EventHandler(this.SpecialTip); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + // Display a message box. + MessageBox.Show(txtMessage.Text, + "Test Message", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + + private void SpecialTip(object sender, System.EventArgs e) + { + Control Ctrl; // The control in question. + AccessibleObject AO; // The accessibility information. + ToolTip TT; // Special ToolTip + StringBuilder Output; // ToolTip Output String. + + // Initialize the ToolTip. + TT = new ToolTip(); + TT.AutoPopDelay = 7000; + TT.AutomaticDelay = 300; + + // Get the sender information. + Ctrl = (Control)sender; + + // Obtain access to the accessibility information. + AO = Ctrl.AccessibilityObject; + + // Create the output string. + Output = new StringBuilder(); + Output.Append("Name: "); + Output.Append(AO.Name); + Output.Append("\r\nRole: "); + Output.Append(AO.Role); + Output.Append("\r\nDescription: "); + Output.Append(AO.Description); + Output.Append("\r\nDefault Action: "); + if (AO.DefaultAction == null) + Output.Append("None"); + else + Output.Append(AO.DefaultAction); + Output.Append("\r\nKeyboard Shortcut: "); + if (AO.KeyboardShortcut == null) + Output.Append("None"); + else + Output.Append(AO.KeyboardShortcut); + Output.Append("\r\nState: "); + Output.Append(AO.State); + Output.Append("\r\nValue: "); + if (AO.Value == null) + Output.Append("None"); + else + Output.Append(AO.Value); + + // Display the information on screen. + TT.SetToolTip(Ctrl, Output.ToString()); + TT.Active = true; + } + } +} diff --git a/Chapter 06/C#/AccessibleObjectDemo/FrmMain.resx b/Chapter 06/C#/AccessibleObjectDemo/FrmMain.resx new file mode 100644 index 0000000..33cc9be --- /dev/null +++ b/Chapter 06/C#/AccessibleObjectDemo/FrmMain.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 06/C#/AccessibleObjectDemo/bin/Debug/AccessibleObjectDemo.exe b/Chapter 06/C#/AccessibleObjectDemo/bin/Debug/AccessibleObjectDemo.exe new file mode 100644 index 0000000..d6af198 Binary files /dev/null and b/Chapter 06/C#/AccessibleObjectDemo/bin/Debug/AccessibleObjectDemo.exe differ diff --git a/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.exe b/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.exe new file mode 100644 index 0000000..d6af198 Binary files /dev/null and b/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.exe differ diff --git a/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.frmMain.resources b/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.frmMain.resources new file mode 100644 index 0000000..390bd9b Binary files /dev/null and b/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.frmMain.resources differ diff --git a/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.projdata b/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.projdata new file mode 100644 index 0000000..a16a868 Binary files /dev/null and b/Chapter 06/C#/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.projdata differ diff --git a/Chapter 06/C#/CursorData/App.ico b/Chapter 06/C#/CursorData/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 06/C#/CursorData/App.ico differ diff --git a/Chapter 06/C#/CursorData/AssemblyInfo.cs b/Chapter 06/C#/CursorData/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 06/C#/CursorData/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/CursorData/CursorData.csproj b/Chapter 06/C#/CursorData/CursorData.csproj new file mode 100644 index 0000000..86e4a32 --- /dev/null +++ b/Chapter 06/C#/CursorData/CursorData.csproj @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/CursorData/CursorData.csproj.user b/Chapter 06/C#/CursorData/CursorData.csproj.user new file mode 100644 index 0000000..3bc5f62 --- /dev/null +++ b/Chapter 06/C#/CursorData/CursorData.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/CursorData/CursorData.sln b/Chapter 06/C#/CursorData/CursorData.sln new file mode 100644 index 0000000..0e74348 --- /dev/null +++ b/Chapter 06/C#/CursorData/CursorData.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CursorData", "CursorData.csproj", "{B3C610CF-5C85-44CD-B275-1AAE7567EF68}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {B3C610CF-5C85-44CD-B275-1AAE7567EF68}.Debug.ActiveCfg = Debug|.NET + {B3C610CF-5C85-44CD-B275-1AAE7567EF68}.Debug.Build.0 = Debug|.NET + {B3C610CF-5C85-44CD-B275-1AAE7567EF68}.Release.ActiveCfg = Release|.NET + {B3C610CF-5C85-44CD-B275-1AAE7567EF68}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/CursorData/CursorData.suo b/Chapter 06/C#/CursorData/CursorData.suo new file mode 100644 index 0000000..207b237 Binary files /dev/null and b/Chapter 06/C#/CursorData/CursorData.suo differ diff --git a/Chapter 06/C#/CursorData/FrmMain.cs b/Chapter 06/C#/CursorData/FrmMain.cs new file mode 100644 index 0000000..af829f5 --- /dev/null +++ b/Chapter 06/C#/CursorData/FrmMain.cs @@ -0,0 +1,147 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Text; + +namespace CursorData +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.ToolTip ToolTip; + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.Button btnGetCursor; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.btnGetCursor = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // ToolTip + // + this.ToolTip.AutomaticDelay = 300; + this.ToolTip.AutoPopDelay = 7000; + this.ToolTip.InitialDelay = 300; + this.ToolTip.ReshowDelay = 60; + // + // btnGetCursor + // + this.btnGetCursor.AccessibleDescription = "This button tests the Get Cursor feature of the application."; + this.btnGetCursor.AccessibleName = "Get Cursor Test Button"; + this.btnGetCursor.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnGetCursor.Location = new System.Drawing.Point(208, 8); + this.btnGetCursor.Name = "btnGetCursor"; + this.btnGetCursor.TabIndex = 6; + this.btnGetCursor.Text = "&Get Cursor"; + this.ToolTip.SetToolTip(this.btnGetCursor, "This button tests the Get Cursor feature of the application."); + this.btnGetCursor.Click += new System.EventHandler(this.btnGetCursor_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Quit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 7; + this.btnQuit.Text = "&Quit"; + this.ToolTip.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // frmMain + // + this.AcceptButton = this.btnGetCursor; + this.AccessibleDescription = "This application shows how to obtain cursor information."; + this.AccessibleName = "Cursor Statistics Demonstration"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnGetCursor); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "Cursor Statistics Demonstration"; + this.ToolTip.SetToolTip(this, "This application shows how to obtain cursor information."); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnGetCursor_Click(object sender, System.EventArgs e) + { + StringBuilder CursorData; // Cursor information. + + // Initialize the StringBuilder + CursorData = new StringBuilder(); + + // Get the cursor information. + CursorData.Append("The current cursor size is:\r\n\r\nHeight: "); + CursorData.Append(SystemInformation.CursorSize.Height.ToString()); + CursorData.Append("\r\nWidth: "); + CursorData.Append(SystemInformation.CursorSize.Width.ToString()); + + // Display the information. + MessageBox.Show(CursorData.ToString(), + "Cursor Data", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } +} diff --git a/Chapter 06/C#/CursorData/FrmMain.resx b/Chapter 06/C#/CursorData/FrmMain.resx new file mode 100644 index 0000000..0e9280a --- /dev/null +++ b/Chapter 06/C#/CursorData/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + 17, 17 + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + frmMain + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 06/C#/CursorData/bin/Debug/CursorData.exe b/Chapter 06/C#/CursorData/bin/Debug/CursorData.exe new file mode 100644 index 0000000..e077481 Binary files /dev/null and b/Chapter 06/C#/CursorData/bin/Debug/CursorData.exe differ diff --git a/Chapter 06/C#/CursorData/obj/Debug/CursorData.exe b/Chapter 06/C#/CursorData/obj/Debug/CursorData.exe new file mode 100644 index 0000000..e077481 Binary files /dev/null and b/Chapter 06/C#/CursorData/obj/Debug/CursorData.exe differ diff --git a/Chapter 06/C#/CursorData/obj/Debug/CursorData.frmMain.resources b/Chapter 06/C#/CursorData/obj/Debug/CursorData.frmMain.resources new file mode 100644 index 0000000..4234528 Binary files /dev/null and b/Chapter 06/C#/CursorData/obj/Debug/CursorData.frmMain.resources differ diff --git a/Chapter 06/C#/CursorData/obj/Debug/CursorData.projdata b/Chapter 06/C#/CursorData/obj/Debug/CursorData.projdata new file mode 100644 index 0000000..189338b Binary files /dev/null and b/Chapter 06/C#/CursorData/obj/Debug/CursorData.projdata differ diff --git a/Chapter 06/C#/MouseCheck/App.ico b/Chapter 06/C#/MouseCheck/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 06/C#/MouseCheck/App.ico differ diff --git a/Chapter 06/C#/MouseCheck/AssemblyInfo.cs b/Chapter 06/C#/MouseCheck/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 06/C#/MouseCheck/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/MouseCheck/FrmMain.cs b/Chapter 06/C#/MouseCheck/FrmMain.cs new file mode 100644 index 0000000..560e3ed --- /dev/null +++ b/Chapter 06/C#/MouseCheck/FrmMain.cs @@ -0,0 +1,187 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; +using System.Text; + +namespace MouseCheck +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.ToolTip ToolTip; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button starts the test function of the application."; + this.btnTest.AccessibleName = "Application Test"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 4; + this.btnTest.Text = "&Test"; + this.ToolTip.SetToolTip(this.btnTest, "This button starts the test function of the application."); + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Quit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 5; + this.btnQuit.Text = "&Quit"; + this.ToolTip.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // ToolTip + // + this.ToolTip.AutomaticDelay = 300; + this.ToolTip.AutoPopDelay = 7000; + this.ToolTip.InitialDelay = 300; + this.ToolTip.ReshowDelay = 60; + // + // frmMain + // + this.AcceptButton = this.btnTest; + this.AccessibleDescription = "This application demonstrates techniques for obtaining mouse information."; + this.AccessibleName = "Mouse Data Demonstration"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "Mouse Data Demonstration"; + this.ToolTip.SetToolTip(this, "This application demonstrates techniques for obtaining mouse information."); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + StringBuilder MouseData; // The mouse setup information. + + // Initialize the StringBuilder. + MouseData = new StringBuilder(); + + // Check for the presence of a mouse. + if (SystemInformation.MousePresent) + { + // Begin building the MouseData string. + MouseData.Append("System includes a mouse with the " + + "following characteristics:\r\n"); + + // Get the clicking information. + MouseData.Append("\r\nDouble Click Area (pixels): "); + MouseData.Append( + SystemInformation.DoubleClickSize.ToString()); + MouseData.Append("\r\nDouble Click Time (ms): "); + MouseData.Append( + SystemInformation.DoubleClickTime.ToString()); + + // Get the mouse specific information. + MouseData.Append("\r\n\r\nNumber of Mouse Buttons: "); + MouseData.Append( + SystemInformation.MouseButtons.ToString()); + MouseData.Append("\r\nAre the buttons swapped? "); + MouseData.Append( + SystemInformation.MouseButtonsSwapped.ToString()); + MouseData.Append("\r\n\r\nIs a mouse wheel available? "); + MouseData.Append( + SystemInformation.MouseWheelPresent.ToString()); + + // Display this information only for systems with + // mouse wheel support. + if (SystemInformation.MouseWheelPresent) + { + MouseData.Append("\r\nMouse wheel scroll lines: "); + MouseData.Append( + SystemInformation.MouseWheelScrollLines.ToString()); + MouseData.Append("\r\nNative mouse wheel support? "); + MouseData.Append( + SystemInformation.NativeMouseWheelSupport.ToString()); + } + + // Display the results. + MessageBox.Show(MouseData.ToString(), + "Mouse Access Information", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + + // If no mouse is present, display a message and exit. + else + MessageBox.Show("There is no mouse connected to this system.", + "No Mouse Access", + MessageBoxButtons.OK, + MessageBoxIcon.Exclamation); + } + } +} diff --git a/Chapter 06/C#/MouseCheck/FrmMain.resx b/Chapter 06/C#/MouseCheck/FrmMain.resx new file mode 100644 index 0000000..f351265 --- /dev/null +++ b/Chapter 06/C#/MouseCheck/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 17, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + frmMain + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 06/C#/MouseCheck/MouseCheck.csproj b/Chapter 06/C#/MouseCheck/MouseCheck.csproj new file mode 100644 index 0000000..300f389 --- /dev/null +++ b/Chapter 06/C#/MouseCheck/MouseCheck.csproj @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/MouseCheck/MouseCheck.csproj.user b/Chapter 06/C#/MouseCheck/MouseCheck.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 06/C#/MouseCheck/MouseCheck.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/MouseCheck/MouseCheck.sln b/Chapter 06/C#/MouseCheck/MouseCheck.sln new file mode 100644 index 0000000..23eea73 --- /dev/null +++ b/Chapter 06/C#/MouseCheck/MouseCheck.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseCheck", "MouseCheck.csproj", "{484EE143-9A9A-4BA5-AE89-8E1639434F57}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {484EE143-9A9A-4BA5-AE89-8E1639434F57}.Debug.ActiveCfg = Debug|.NET + {484EE143-9A9A-4BA5-AE89-8E1639434F57}.Debug.Build.0 = Debug|.NET + {484EE143-9A9A-4BA5-AE89-8E1639434F57}.Release.ActiveCfg = Release|.NET + {484EE143-9A9A-4BA5-AE89-8E1639434F57}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/MouseCheck/MouseCheck.suo b/Chapter 06/C#/MouseCheck/MouseCheck.suo new file mode 100644 index 0000000..22cddfc Binary files /dev/null and b/Chapter 06/C#/MouseCheck/MouseCheck.suo differ diff --git a/Chapter 06/C#/MouseCheck/bin/Debug/MouseCheck.exe b/Chapter 06/C#/MouseCheck/bin/Debug/MouseCheck.exe new file mode 100644 index 0000000..ceef0a0 Binary files /dev/null and b/Chapter 06/C#/MouseCheck/bin/Debug/MouseCheck.exe differ diff --git a/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.exe b/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.exe new file mode 100644 index 0000000..ceef0a0 Binary files /dev/null and b/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.exe differ diff --git a/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.frmMain.resources b/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.frmMain.resources new file mode 100644 index 0000000..d3da1c7 Binary files /dev/null and b/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.frmMain.resources differ diff --git a/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.projdata b/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.projdata new file mode 100644 index 0000000..1caea31 Binary files /dev/null and b/Chapter 06/C#/MouseCheck/obj/Debug/MouseCheck.projdata differ diff --git a/Chapter 06/C#/PlaySound/AssemblyInfo.cs b/Chapter 06/C#/PlaySound/AssemblyInfo.cs new file mode 100644 index 0000000..a0886e9 --- /dev/null +++ b/Chapter 06/C#/PlaySound/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("..\\..\\MyKey")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/PlaySound/MyKey b/Chapter 06/C#/PlaySound/MyKey new file mode 100644 index 0000000..b9fd688 Binary files /dev/null and b/Chapter 06/C#/PlaySound/MyKey differ diff --git a/Chapter 06/C#/PlaySound/PlaySound.XML b/Chapter 06/C#/PlaySound/PlaySound.XML new file mode 100644 index 0000000..03d4e0b --- /dev/null +++ b/Chapter 06/C#/PlaySound/PlaySound.XML @@ -0,0 +1,71 @@ + + + + PlaySound + + + + + Summary description for Class1. + + + + + PlaySound constructor. + + + + + Outputs a sound and/or a sound description based + upon the current ShowSound Windows Accessiblity setting. + + The control hosting the sound. + + + + Obtains the current status of the ShowSounds + Windows Accessibility setting. + + True or False depending on setting value + + + + This event fires when the system displays a + ShowSounds message. + + + + + This event fires when the system generates a + sound. + + + + + Determines if the system will make a sound. + + + + + Contains the name of the file to play. + + + + + Describes the sound to the person using ShowSounds. + + + + + Determines the hover delay for the tooltip + displaying the sound description. (1 ms minimum) + + + + + Determines the amount of time the tooltip + will appear on screen. (3000 ms minimum) + + + + diff --git a/Chapter 06/C#/PlaySound/PlaySound.bmp b/Chapter 06/C#/PlaySound/PlaySound.bmp new file mode 100644 index 0000000..57159dc Binary files /dev/null and b/Chapter 06/C#/PlaySound/PlaySound.bmp differ diff --git a/Chapter 06/C#/PlaySound/PlaySound.cs b/Chapter 06/C#/PlaySound/PlaySound.cs new file mode 100644 index 0000000..ae39709 --- /dev/null +++ b/Chapter 06/C#/PlaySound/PlaySound.cs @@ -0,0 +1,238 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Design; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using System.Windows.Forms.Design; + +namespace PlaySound +{ + /// + /// Summary description for Class1. + /// + public class PlaySound : Component + { + #region Private field values. + // Determines if the system will make a sound. + private bool _MakeSound; + // Contains the name of the file to play. + private string _SoundFileName; + // Describes the sound to the person using ShowSounds. + private string _ShowSoundsDescription; + // Determines the hover delay for the tooltip + // displaying the sound description. + private int _AutomaticDelay; + // Determines the amount of time the tooltip + // will appear on screen. + private int _AutoPopDelay; + + // Sound Text Description ToolTip + private ToolTip TT; + + // This special object controls the disappearance of + // the sound description tooltip. + private Timer NoShow; + #endregion + + /// + /// PlaySound constructor. + /// + public PlaySound() + { + // Initialize the property values. + _MakeSound = true; + _SoundFileName = ""; + _ShowSoundsDescription = "The System Plays a Sound"; + _AutomaticDelay = 300; + _AutoPopDelay = 7000; + NoShow = new Timer(); + } + + #region PlaySound Events + /// + /// This event fires when the system displays a + /// ShowSounds message. + /// + [Description("This event fires when the system displays a " + + "ShowSounds message.")] + public event EventHandler SoundDisplayed; + + /// + /// This event fires when the system generates a + /// sound. + /// + [Description("This event fires when the system generates a" + + "sound.")] + public event EventHandler SoundGenerated; + #endregion + + #region PlaySound Properties + // Each of these properties gets and/or sets a private + // field within the component. + + /// + /// Determines if the system will make a sound. + /// + [Description("Determines if the system will make a sound.")] + public bool MakeSound + { + get {return _MakeSound;} + set {_MakeSound = value;} + } + + // This property requires a special editor to ensure it works + // as intended. + /// + /// Contains the name of the file to play. + /// + [Description("Contains the name of the file to play.")] + [EditorAttribute(typeof(FileNameEditor), typeof(UITypeEditor))] + public string SoundFileName + { + get + { + return _SoundFileName; + } + set + { + _SoundFileName = value; + } + } + + /// + /// Describes the sound to the person using ShowSounds. + /// + [Description("Describes the sound to the person using ShowSounds.")] + public string ShowSoundsDescription + { + get {return _ShowSoundsDescription;} + set + { + if (value != null) + _ShowSoundsDescription = value; + } + } + + /// + /// Determines the hover delay for the tooltip + /// displaying the sound description. (1 ms minimum) + /// + [Description("Determines the hover delay for the tooltip " + + "displaying the sound description. (1 ms minimum)")] + public int AutomaticDelay + { + get {return _AutomaticDelay;} + set + { + if (value >= 1) + _AutomaticDelay = value; + } + } + + /// + /// Determines the amount of time the tooltip + /// will appear on screen. (3000 ms minimum) + /// + [Description("Determines the amount of time the tooltip " + + "will appear on screen. (3000 ms minimum)")] + public int AutoPopDelay + { + get {return _AutoPopDelay;} + set + { + if (value >= 3000) + _AutoPopDelay = value; + } + } + #endregion + + #region PlaySound Methods + /// + /// Outputs a sound and/or a sound description based + /// upon the current ShowSound Windows Accessiblity setting. + /// + /// The control hosting the sound. + [Description("Plays the sound requested by the user " + + "or displays a text equivlaent.")] + public void GenerateSound(Control Parent) + { + System.EventArgs EA; // Used When Raising an Event. + + // Initialize the EventArgs. + EA = new EventArgs(); + + // Initialize the ToolTip. + TT = new ToolTip(); + TT.AutomaticDelay = _AutomaticDelay; + TT.AutoPopDelay = _AutoPopDelay; + + // Intitialze the Timer. + NoShow.Interval = _AutoPopDelay; + NoShow.Tick += new EventHandler(this.NoShow_Tick); + + // If the ShowSounds option is selected, display text. + if (IsShowSoundsSelected()) + { + // Display the information on screen. + TT.SetToolTip(Parent, _ShowSoundsDescription); + TT.Active = true; + NoShow.Start(); + + // Fire the event. + if (SoundDisplayed != null) + SoundDisplayed(this, EA); + } + + if (_MakeSound) + { + // Play a sound only when the user requests it. + WinPlaySound(@_SoundFileName, + 0, + SND_FILENAME | SND_ASYNC); + + // Fire the event. + if (SoundGenerated != null) + SoundGenerated(this, EA); + } + } + + /// + /// Obtains the current status of the ShowSounds + /// Windows Accessibility setting. + /// + /// True or False depending on setting value + [Description("Returns true when the user has ShowSounds enabled.")] + public bool IsShowSoundsSelected() + { + return SystemInformation.ShowSounds; + } + #endregion + + #region Win32 API Code + // Define some constants for using the PlaySound() function. + private const int SND_SYNC = 0x0000; + private const int SND_ASYNC = 0x0001; + private const int SND_FILENAME = 0x00020000; + + // Import the Windows PlaySound() function. + [DllImport("winmm.dll", + EntryPoint="PlaySound", CharSet=CharSet.Auto, SetLastError=true)] + private static extern bool WinPlaySound(string pszSound, + int hmod, + int fdwSound); + #endregion + + #region EventHandlers + private void NoShow_Tick(Object sender, System.EventArgs e) + { + // Stop displaying the sound description. + TT.Active = false; + + // Stop the timer. + NoShow.Stop(); + } + #endregion + } +} diff --git a/Chapter 06/C#/PlaySound/PlaySound.csproj b/Chapter 06/C#/PlaySound/PlaySound.csproj new file mode 100644 index 0000000..9dc4b99 --- /dev/null +++ b/Chapter 06/C#/PlaySound/PlaySound.csproj @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/PlaySound/PlaySound.csproj.user b/Chapter 06/C#/PlaySound/PlaySound.csproj.user new file mode 100644 index 0000000..3bc5f62 --- /dev/null +++ b/Chapter 06/C#/PlaySound/PlaySound.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/PlaySound/PlaySound.ico b/Chapter 06/C#/PlaySound/PlaySound.ico new file mode 100644 index 0000000..5c92213 Binary files /dev/null and b/Chapter 06/C#/PlaySound/PlaySound.ico differ diff --git a/Chapter 06/C#/PlaySound/PlaySound.sln b/Chapter 06/C#/PlaySound/PlaySound.sln new file mode 100644 index 0000000..d0bf636 --- /dev/null +++ b/Chapter 06/C#/PlaySound/PlaySound.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlaySound", "PlaySound.csproj", "{BA5A15B3-AECD-4A4E-9CA2-D6003BBAFFFC}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {BA5A15B3-AECD-4A4E-9CA2-D6003BBAFFFC}.Debug.ActiveCfg = Debug|.NET + {BA5A15B3-AECD-4A4E-9CA2-D6003BBAFFFC}.Debug.Build.0 = Debug|.NET + {BA5A15B3-AECD-4A4E-9CA2-D6003BBAFFFC}.Release.ActiveCfg = Release|.NET + {BA5A15B3-AECD-4A4E-9CA2-D6003BBAFFFC}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/PlaySound/PlaySound.suo b/Chapter 06/C#/PlaySound/PlaySound.suo new file mode 100644 index 0000000..e30eb22 Binary files /dev/null and b/Chapter 06/C#/PlaySound/PlaySound.suo differ diff --git a/Chapter 06/C#/PlaySound/PlaySoundSmall.bmp b/Chapter 06/C#/PlaySound/PlaySoundSmall.bmp new file mode 100644 index 0000000..de931b2 Binary files /dev/null and b/Chapter 06/C#/PlaySound/PlaySoundSmall.bmp differ diff --git a/Chapter 06/C#/PlaySound/bin/Debug/PlaySound.XML b/Chapter 06/C#/PlaySound/bin/Debug/PlaySound.XML new file mode 100644 index 0000000..03d4e0b --- /dev/null +++ b/Chapter 06/C#/PlaySound/bin/Debug/PlaySound.XML @@ -0,0 +1,71 @@ + + + + PlaySound + + + + + Summary description for Class1. + + + + + PlaySound constructor. + + + + + Outputs a sound and/or a sound description based + upon the current ShowSound Windows Accessiblity setting. + + The control hosting the sound. + + + + Obtains the current status of the ShowSounds + Windows Accessibility setting. + + True or False depending on setting value + + + + This event fires when the system displays a + ShowSounds message. + + + + + This event fires when the system generates a + sound. + + + + + Determines if the system will make a sound. + + + + + Contains the name of the file to play. + + + + + Describes the sound to the person using ShowSounds. + + + + + Determines the hover delay for the tooltip + displaying the sound description. (1 ms minimum) + + + + + Determines the amount of time the tooltip + will appear on screen. (3000 ms minimum) + + + + diff --git a/Chapter 06/C#/PlaySound/bin/Debug/PlaySound.dll b/Chapter 06/C#/PlaySound/bin/Debug/PlaySound.dll new file mode 100644 index 0000000..95c77c6 Binary files /dev/null and b/Chapter 06/C#/PlaySound/bin/Debug/PlaySound.dll differ diff --git a/Chapter 06/C#/PlaySound/obj/Debug/PlaySound.dll b/Chapter 06/C#/PlaySound/obj/Debug/PlaySound.dll new file mode 100644 index 0000000..95c77c6 Binary files /dev/null and b/Chapter 06/C#/PlaySound/obj/Debug/PlaySound.dll differ diff --git a/Chapter 06/C#/PlaySound/obj/Debug/PlaySound.projdata b/Chapter 06/C#/PlaySound/obj/Debug/PlaySound.projdata new file mode 100644 index 0000000..d723045 Binary files /dev/null and b/Chapter 06/C#/PlaySound/obj/Debug/PlaySound.projdata differ diff --git a/Chapter 06/C#/ShowSounds/App.ico b/Chapter 06/C#/ShowSounds/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 06/C#/ShowSounds/App.ico differ diff --git a/Chapter 06/C#/ShowSounds/AssemblyInfo.cs b/Chapter 06/C#/ShowSounds/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 06/C#/ShowSounds/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 06/C#/ShowSounds/FrmMain.cs b/Chapter 06/C#/ShowSounds/FrmMain.cs new file mode 100644 index 0000000..0103c98 --- /dev/null +++ b/Chapter 06/C#/ShowSounds/FrmMain.cs @@ -0,0 +1,223 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace ShowSounds +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.CheckBox cbSound; + private System.Windows.Forms.CheckBox cbSoundGenerate; + private System.Windows.Forms.CheckBox cbSoundDisplay; + private System.Windows.Forms.ToolTip ToolTip; + private PlaySound.PlaySound MySound; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.cbSound = new System.Windows.Forms.CheckBox(); + this.cbSoundGenerate = new System.Windows.Forms.CheckBox(); + this.cbSoundDisplay = new System.Windows.Forms.CheckBox(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.MySound = new PlaySound.PlaySound(); + this.SuspendLayout(); + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button starts the test function of the application."; + this.btnTest.AccessibleName = "Application Test"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 2; + this.btnTest.Text = "&Test"; + this.ToolTip.SetToolTip(this.btnTest, "This button starts the test function of the application."); + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Quit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 3; + this.btnQuit.Text = "&Quit"; + this.ToolTip.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // cbSound + // + this.cbSound.AccessibleDescription = "Tells system to play a sound."; + this.cbSound.AccessibleName = "Play Sound Selection"; + this.cbSound.AccessibleRole = System.Windows.Forms.AccessibleRole.CheckButton; + this.cbSound.Checked = true; + this.cbSound.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbSound.Location = new System.Drawing.Point(8, 16); + this.cbSound.Name = "cbSound"; + this.cbSound.Size = new System.Drawing.Size(170, 24); + this.cbSound.TabIndex = 4; + this.cbSound.Text = "&Play the Sound"; + this.ToolTip.SetToolTip(this.cbSound, "Tells system to play a sound."); + // + // cbSoundGenerate + // + this.cbSoundGenerate.AccessibleDescription = "Instruct the application to use the event handler for sound generation."; + this.cbSoundGenerate.AccessibleName = "Select Sound Generate Event"; + this.cbSoundGenerate.AccessibleRole = System.Windows.Forms.AccessibleRole.CheckButton; + this.cbSoundGenerate.Location = new System.Drawing.Point(8, 40); + this.cbSoundGenerate.Name = "cbSoundGenerate"; + this.cbSoundGenerate.Size = new System.Drawing.Size(170, 24); + this.cbSoundGenerate.TabIndex = 5; + this.cbSoundGenerate.Text = "Sound&Generate Event"; + this.ToolTip.SetToolTip(this.cbSoundGenerate, "Instruct the application to use the event handler for sound generation."); + // + // cbSoundDisplay + // + this.cbSoundDisplay.AccessibleDescription = "Instruct the application to use the event handler for sound description."; + this.cbSoundDisplay.AccessibleName = "Select Sound Display Event"; + this.cbSoundDisplay.AccessibleRole = System.Windows.Forms.AccessibleRole.CheckButton; + this.cbSoundDisplay.Location = new System.Drawing.Point(8, 64); + this.cbSoundDisplay.Name = "cbSoundDisplay"; + this.cbSoundDisplay.Size = new System.Drawing.Size(170, 24); + this.cbSoundDisplay.TabIndex = 6; + this.cbSoundDisplay.Text = "Sound&Display Event"; + this.ToolTip.SetToolTip(this.cbSoundDisplay, "Instruct the application to use the event handler for sound description."); + // + // ToolTip + // + this.ToolTip.AutomaticDelay = 300; + this.ToolTip.AutoPopDelay = 7000; + this.ToolTip.InitialDelay = 300; + this.ToolTip.ReshowDelay = 60; + // + // MySound + // + this.MySound.AutomaticDelay = 300; + this.MySound.AutoPopDelay = 7000; + this.MySound.MakeSound = true; + this.MySound.ShowSoundsDescription = "The system plays the sound of bells."; + this.MySound.SoundFileName = "Bells.wav"; + // + // frmMain + // + this.AcceptButton = this.btnTest; + this.AccessibleDescription = "This application provides support for the PlaySound component."; + this.AccessibleName = "ShowSounds Demonstration"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.cbSoundDisplay); + this.Controls.Add(this.cbSoundGenerate); + this.Controls.Add(this.cbSound); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "ShowSounds Demonstration"; + this.ToolTip.SetToolTip(this, "This application provides support for the PlaySound component."); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + // Check to see if the user wants to play a sound. + if (cbSound.Checked) + MySound.MakeSound = true; + else + MySound.MakeSound = false; + + // Check to see if the user wants the SoundDisplayed event. + if (cbSoundDisplay.Checked) + MySound.SoundDisplayed += + new EventHandler(playSound1_SoundDisplayed); + else + MySound.SoundDisplayed -= + new EventHandler(playSound1_SoundDisplayed); + + // Check to see if the user wans the SoundGenerated event. + if (cbSoundGenerate.Checked) + MySound.SoundGenerated += + new EventHandler(playSound1_SoundGenerated); + else + MySound.SoundGenerated -= + new EventHandler(playSound1_SoundGenerated); + + // Perform the sound related task. + MySound.GenerateSound(btnTest); + } + + private void playSound1_SoundDisplayed(object sender, System.EventArgs e) + { + // Display a message box. + MessageBox.Show("Sound Displayed"); + } + + private void playSound1_SoundGenerated(object sender, System.EventArgs e) + { + // Display a message box. + MessageBox.Show("Sound Generated"); + } + } +} diff --git a/Chapter 06/C#/ShowSounds/FrmMain.resx b/Chapter 06/C#/ShowSounds/FrmMain.resx new file mode 100644 index 0000000..27b949d --- /dev/null +++ b/Chapter 06/C#/ShowSounds/FrmMain.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 17, 17 + + + Private + + + Private + + + 105, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 06/C#/ShowSounds/ShowSounds.csproj b/Chapter 06/C#/ShowSounds/ShowSounds.csproj new file mode 100644 index 0000000..1de1647 --- /dev/null +++ b/Chapter 06/C#/ShowSounds/ShowSounds.csproj @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/C#/ShowSounds/ShowSounds.csproj.user b/Chapter 06/C#/ShowSounds/ShowSounds.csproj.user new file mode 100644 index 0000000..fd5e312 --- /dev/null +++ b/Chapter 06/C#/ShowSounds/ShowSounds.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/C#/ShowSounds/ShowSounds.sln b/Chapter 06/C#/ShowSounds/ShowSounds.sln new file mode 100644 index 0000000..f5fcce9 --- /dev/null +++ b/Chapter 06/C#/ShowSounds/ShowSounds.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowSounds", "ShowSounds.csproj", "{3F999291-1603-4E8D-AE61-823B967A7D32}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3F999291-1603-4E8D-AE61-823B967A7D32}.Debug.ActiveCfg = Debug|.NET + {3F999291-1603-4E8D-AE61-823B967A7D32}.Debug.Build.0 = Debug|.NET + {3F999291-1603-4E8D-AE61-823B967A7D32}.Release.ActiveCfg = Release|.NET + {3F999291-1603-4E8D-AE61-823B967A7D32}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/C#/ShowSounds/ShowSounds.suo b/Chapter 06/C#/ShowSounds/ShowSounds.suo new file mode 100644 index 0000000..ff429c4 Binary files /dev/null and b/Chapter 06/C#/ShowSounds/ShowSounds.suo differ diff --git a/Chapter 06/C#/ShowSounds/bin/Debug/BELLS.WAV b/Chapter 06/C#/ShowSounds/bin/Debug/BELLS.WAV new file mode 100644 index 0000000..1be8f7f Binary files /dev/null and b/Chapter 06/C#/ShowSounds/bin/Debug/BELLS.WAV differ diff --git a/Chapter 06/C#/ShowSounds/bin/Debug/ShowSounds.exe b/Chapter 06/C#/ShowSounds/bin/Debug/ShowSounds.exe new file mode 100644 index 0000000..1d9c008 Binary files /dev/null and b/Chapter 06/C#/ShowSounds/bin/Debug/ShowSounds.exe differ diff --git a/Chapter 06/C#/ShowSounds/bin/Debug/playsound.dll b/Chapter 06/C#/ShowSounds/bin/Debug/playsound.dll new file mode 100644 index 0000000..95c77c6 Binary files /dev/null and b/Chapter 06/C#/ShowSounds/bin/Debug/playsound.dll differ diff --git a/Chapter 06/C#/ShowSounds/bin/Debug/playsound.xml b/Chapter 06/C#/ShowSounds/bin/Debug/playsound.xml new file mode 100644 index 0000000..03d4e0b --- /dev/null +++ b/Chapter 06/C#/ShowSounds/bin/Debug/playsound.xml @@ -0,0 +1,71 @@ + + + + PlaySound + + + + + Summary description for Class1. + + + + + PlaySound constructor. + + + + + Outputs a sound and/or a sound description based + upon the current ShowSound Windows Accessiblity setting. + + The control hosting the sound. + + + + Obtains the current status of the ShowSounds + Windows Accessibility setting. + + True or False depending on setting value + + + + This event fires when the system displays a + ShowSounds message. + + + + + This event fires when the system generates a + sound. + + + + + Determines if the system will make a sound. + + + + + Contains the name of the file to play. + + + + + Describes the sound to the person using ShowSounds. + + + + + Determines the hover delay for the tooltip + displaying the sound description. (1 ms minimum) + + + + + Determines the amount of time the tooltip + will appear on screen. (3000 ms minimum) + + + + diff --git a/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.exe b/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.exe new file mode 100644 index 0000000..1d9c008 Binary files /dev/null and b/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.exe differ diff --git a/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.frmMain.resources b/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.frmMain.resources new file mode 100644 index 0000000..319fa0f Binary files /dev/null and b/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.frmMain.resources differ diff --git a/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.projdata b/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.projdata new file mode 100644 index 0000000..2b8c8fb Binary files /dev/null and b/Chapter 06/C#/ShowSounds/obj/Debug/ShowSounds.projdata differ diff --git a/Chapter 06/VB/AccessFuncs/AccessFuncs.sln b/Chapter 06/VB/AccessFuncs/AccessFuncs.sln new file mode 100644 index 0000000..0c251e0 --- /dev/null +++ b/Chapter 06/VB/AccessFuncs/AccessFuncs.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AccessFuncs", "AccessFuncs.vbproj", "{970D728B-CF88-4370-B55C-A3AE4E59158B}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {970D728B-CF88-4370-B55C-A3AE4E59158B}.Debug.ActiveCfg = Debug|.NET + {970D728B-CF88-4370-B55C-A3AE4E59158B}.Debug.Build.0 = Debug|.NET + {970D728B-CF88-4370-B55C-A3AE4E59158B}.Release.ActiveCfg = Release|.NET + {970D728B-CF88-4370-B55C-A3AE4E59158B}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/AccessFuncs/AccessFuncs.suo b/Chapter 06/VB/AccessFuncs/AccessFuncs.suo new file mode 100644 index 0000000..4c97657 Binary files /dev/null and b/Chapter 06/VB/AccessFuncs/AccessFuncs.suo differ diff --git a/Chapter 06/VB/AccessFuncs/AccessFuncs.vbproj b/Chapter 06/VB/AccessFuncs/AccessFuncs.vbproj new file mode 100644 index 0000000..00bd54a --- /dev/null +++ b/Chapter 06/VB/AccessFuncs/AccessFuncs.vbproj @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/AccessFuncs/AccessFuncs.vbproj.user b/Chapter 06/VB/AccessFuncs/AccessFuncs.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 06/VB/AccessFuncs/AccessFuncs.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/AccessFuncs/Accessible.vb b/Chapter 06/VB/AccessFuncs/Accessible.vb new file mode 100644 index 0000000..7bf9ac0 --- /dev/null +++ b/Chapter 06/VB/AccessFuncs/Accessible.vb @@ -0,0 +1,499 @@ +Imports System.Runtime.InteropServices +Imports System.Text +Imports System.ComponentModel + +Namespace AccessFuncs +#Region "Enumerations" + + _ + Public Enum AccessType : uint + _ + SPI_GETHIGHCONTRAST = &H42 + _ + SPI_SETHIGHCONTRAST = &H43 + _ + SPI_GETSCREENREADER = &H46 + _ + SPI_SETSCREENREADER = &H47 + _ + SPI_GETFILTERKEYS = &H32 + _ + SPI_SETFILTERKEYS = &H33 + _ + SPI_GETTOGGLEKEYS = &H34 + _ + SPI_SETTOGGLEKEYS = &H35 + _ + SPI_GETMOUSEKEYS = &H36 + _ + SPI_SETMOUSEKEYS = &H37 + _ + SPI_GETSHOWSOUNDS = &H38 + _ + SPI_SETSHOWSOUNDS = &H39 + _ + SPI_GETSTICKYKEYS = &H3A + _ + SPI_SETSTICKYKEYS = &H3B + _ + SPI_GETACCESSTIMEOUT = &H3C + _ + SPI_SETACCESSTIMEOUT = &H3D + _ + SPI_GETSERIALKEYS = &H3E + _ + SPI_SETSERIALKEYS = &H3F + _ + SPI_GETSOUNDSENTRY = &H40 + _ + SPI_SETSOUNDSENTRY = &H41 + End Enum + + _ + Public Enum WinIniFlags + _ + SPIF_NONE = &H0 + _ + SPIF_UPDATEINIFILE = &H1 + _ + SPIF_SENDWININICHANGE = &H2 + _ + SPIF_SENDCHANGE = SPIF_SENDWININICHANGE + End Enum + + _ + Public Enum HighContrastFlags + _ + HCF_HIGHCONTRASTON = &H1 + _ + HCF_AVAILABLE = &H2 + _ + HCF_HOTKEYACTIVE = &H4 + _ + HCF_CONFIRMHOTKEY = &H8 + _ + HCF_HOTKEYSOUND = &H10 + _ + HCF_INDICATOR = &H20 + _ + HCF_HOTKEYAVAILABLE = &H40 + End Enum + + _ + Public Enum FilterKeysFlags + _ + FKF_FILTERKEYSON = &H1 + _ + FKF_AVAILABLE = &H2 + _ + FKF_HOTKEYACTIVE = &H4 + _ + FKF_CONFIRMHOTKEY = &H8 + _ + FKF_HOTKEYSOUND = &H10 + _ + FKF_INDICATOR = &H20 + _ + FKF_CLICKON = &H40 + End Enum + + _ + Public Enum ToggleKeysFlags + _ + TKF_TOGGLEKEYSON = &H1 + _ + TKF_AVAILABLE = &H2 + _ + TKF_HOTKEYACTIVE = &H4 + _ + TKF_CONFIRMHOTKEY = &H8 + _ + TKF_HOTKEYSOUND = &H10 + _ + TKF_INDICATOR = &H20 + End Enum + + _ + Public Enum MouseKeysFlags : uint + _ + MKF_MOUSEKEYSON = &H1 + _ + MKF_AVAILABLE = &H2 + _ + MKF_HOTKEYACTIVE = &H4 + _ + MKF_CONFIRMHOTKEY = &H8 + _ + MKF_HOTKEYSOUND = &H10 + _ + MKF_INDICATOR = &H20 + _ + MKF_MODIFIERS = &H40 + _ + MKF_REPLACENUMBERS = &H80 + _ + MKF_LEFTBUTTONSEL = &H10000000 + _ + MKF_RIGHTBUTTONSEL = &H20000000 + _ + MKF_LEFTBUTTONDOWN = &H1000000 + _ + MKF_RIGHTBUTTONDOWN = &H2000000 + _ + MKF_MOUSEMODE = &H80000000 + End Enum + + _ + Public Enum StickyKeysFlags : uint + _ + SKF_STICKYKEYSON = &H1 + _ + SKF_AVAILABLE = &H2 + _ + SKF_HOTKEYACTIVE = &H4 + _ + SKF_CONFIRMHOTKEY = &H8 + _ + SKF_HOTKEYSOUND = &H10 + _ + SKF_INDICATOR = &H20 + _ + SKF_AUDIBLEFEEDBACK = &H40 + _ + SKF_TRISTATE = &H80 + _ + SKF_TWOKEYSOFF = &H100 + _ + SKF_LALTLATCHED = &H10000000 + _ + SKF_LCTLLATCHED = &H4000000 + _ + SKF_LSHIFTLATCHED = &H1000000 + _ + SKF_RALTLATCHED = &H20000000 + _ + SKF_RCTLLATCHED = &H8000000 + _ + SKF_RSHIFTLATCHED = &H2000000 + _ + SKF_LWINLATCHED = &H40000000 + _ + SKF_RWINLATCHED = &H80000000 + _ + SKF_LALTLOCKED = &H100000 + _ + SKF_LCTLLOCKED = &H40000 + _ + SKF_LSHIFTLOCKED = &H10000 + _ + SKF_RALTLOCKED = &H200000 + _ + SKF_RCTLLOCKED = &H80000 + _ + SKF_RSHIFTLOCKED = &H20000 + _ + SKF_LWINLOCKED = &H400000 + _ + SKF_RWINLOCKED = &H800000 + End Enum + + _ + Public Enum AccessTimeoutFlags + _ + ATF_TIMEOUTON = &H1 + _ + ATF_ONOFFFEEDBACK = &H2 + End Enum + + _ + Public Enum SerialKeysFlags + _ + SERKF_SERIALKEYSON = &H1 + _ + SERKF_AVAILABLE = &H2 + _ + SERKF_INDICATOR = &H4 + End Enum + + _ + Public Enum SoundSentryFlags + _ + SSF_SOUNDSENTRYON = &H1 + _ + SSF_AVAILABLE = &H2 + _ + SSF_INDICATOR = &H4 + End Enum + + _ + Public Enum SoundSentryTextEffects + _ + SSTF_NONE = 0 + _ + SSTF_CHARS = 1 + _ + SSTF_BORDER = 2 + _ + SSTF_DISPLAY = 3 + End Enum + + _ + Public Enum SoundSentryGraphicEffects + _ + SSGF_NONE = 0 + _ + SSGF_DISPLAY = 3 + End Enum + + _ + Public Enum SoundSentryWindowsEffects + _ + SSWF_NONE = 0 + _ + SSWF_TITLE = 1 + _ + SSWF_WINDOW = 2 + _ + SSWF_DISPLAY = 3 + _ + SSWF_CUSTOM = 4 + End Enum +#End Region + +#Region "Data Structures" + _ + Public Structure HIGHCONTRAST + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + _ + Public lpszDefaultScheme As String + End Structure + + _ + Public Structure FILTERKEYS + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + _ + Public iWaitMSec As Int32 + _ + Public iDelayMSec As Int32 + _ + Public iRepeatMSec As Int32 + _ + Public iBounceMSec As Int32 + End Structure + + _ + Public Structure TOGGLEKEYS + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + End Structure + + _ + Public Structure MOUSEKEYS + _ + Public cbSize As UInt32 + _ + Public dwFlags As UInt32 + _ + Public iMaxSpeed As Int32 + _ + Public iTimeToMaxSpeed As Int32 + _ + Public iCtrlSpeed As Int32 + _ + Public dwReserved1 As Int32 + _ + Public dwReserved2 As Int32 + End Structure + + _ + Public Structure STICKYKEYS + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + End Structure + + _ + Public Structure ACCESSTIMEOUT + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + _ + Public iTimeOutMSec As Int32 + End Structure + + _ + Public Structure SERIALKEYS + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + _ + Public lpszActivePort As String + _ + Public lpszPort As String + _ + Public iBaudRate As UInt32 + _ + Public iPortState As UInt32 + _ + Public iActive As UInt32 + End Structure + + _ + Public Structure SOUNDSENTRY + _ + Public cbSize As UInt32 + _ + Public dwFlags As Int32 + _ + Public iFSTextEffect As Int32 + _ + Public iFSTextEffectMSec As Int32 + _ + Public iFSTextEffectColorBits As Int32 + _ + Public iFSGrafEffect As Int32 + _ + Public iFSGrafEffectMSec As Int32 + _ + Public iFSGrafEffectColor As Int32 + _ + Public iWindowsEffect As Int32 + _ + Public iWindowsEffectMSec As Int32 + _ + Public lpszWindowsEffectDLL As String + _ + Public iWindowsEffectOrdinal As Int32 + End Structure +#End Region + +#Region "Accessible Class" + _ + Public Class Accessible + _ + Public Sub Accessible() + End Sub + + _ + Public Const MAX_PATH As Int32 = 260 + + _ + Public Shared Function SystemParametersInfo(ByVal uiAction As AccessType, _ + ByVal uiParam As UInt32, _ + ByVal pvParam As IntPtr, _ + ByVal fWinIni As WinIniFlags) As Boolean + End Function + + _ + Public Const SM_SHOWSOUNDS As Int32 = 70 + + _ + Public Shared Function GetSystemMetrics(ByVal nIndex As Int32) As Int32 + End Function + End Class +#End Region +End Namespace diff --git a/Chapter 06/VB/AccessFuncs/AssemblyInfo.vb b/Chapter 06/VB/AccessFuncs/AssemblyInfo.vb new file mode 100644 index 0000000..d4c7c46 --- /dev/null +++ b/Chapter 06/VB/AccessFuncs/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/AccessFuncs/bin/AccessFuncs.dll b/Chapter 06/VB/AccessFuncs/bin/AccessFuncs.dll new file mode 100644 index 0000000..50cac1b Binary files /dev/null and b/Chapter 06/VB/AccessFuncs/bin/AccessFuncs.dll differ diff --git a/Chapter 06/VB/AccessFuncs/obj/Debug/AccessFuncs.dll b/Chapter 06/VB/AccessFuncs/obj/Debug/AccessFuncs.dll new file mode 100644 index 0000000..50cac1b Binary files /dev/null and b/Chapter 06/VB/AccessFuncs/obj/Debug/AccessFuncs.dll differ diff --git a/Chapter 06/VB/AccessSettings/AccessSettings.sln b/Chapter 06/VB/AccessSettings/AccessSettings.sln new file mode 100644 index 0000000..92cf5bd --- /dev/null +++ b/Chapter 06/VB/AccessSettings/AccessSettings.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AccessSettings", "AccessSettings.vbproj", "{6B9DE581-56FA-412D-827A-805A5BF7E3B5}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {6B9DE581-56FA-412D-827A-805A5BF7E3B5}.Debug.ActiveCfg = Debug|.NET + {6B9DE581-56FA-412D-827A-805A5BF7E3B5}.Debug.Build.0 = Debug|.NET + {6B9DE581-56FA-412D-827A-805A5BF7E3B5}.Release.ActiveCfg = Release|.NET + {6B9DE581-56FA-412D-827A-805A5BF7E3B5}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/AccessSettings/AccessSettings.suo b/Chapter 06/VB/AccessSettings/AccessSettings.suo new file mode 100644 index 0000000..752d94d Binary files /dev/null and b/Chapter 06/VB/AccessSettings/AccessSettings.suo differ diff --git a/Chapter 06/VB/AccessSettings/AccessSettings.vbproj b/Chapter 06/VB/AccessSettings/AccessSettings.vbproj new file mode 100644 index 0000000..84f6075 --- /dev/null +++ b/Chapter 06/VB/AccessSettings/AccessSettings.vbproj @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/AccessSettings/AccessSettings.vbproj.user b/Chapter 06/VB/AccessSettings/AccessSettings.vbproj.user new file mode 100644 index 0000000..6b793af --- /dev/null +++ b/Chapter 06/VB/AccessSettings/AccessSettings.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/AccessSettings/AssemblyInfo.vb b/Chapter 06/VB/AccessSettings/AssemblyInfo.vb new file mode 100644 index 0000000..d54e8a8 --- /dev/null +++ b/Chapter 06/VB/AccessSettings/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/AccessSettings/FrmMain.resx b/Chapter 06/VB/AccessSettings/FrmMain.resx new file mode 100644 index 0000000..f6e0a56 --- /dev/null +++ b/Chapter 06/VB/AccessSettings/FrmMain.resx @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + 114, 17 + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + frmMain + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 06/VB/AccessSettings/FrmMain.vb b/Chapter 06/VB/AccessSettings/FrmMain.vb new file mode 100644 index 0000000..31df5ce --- /dev/null +++ b/Chapter 06/VB/AccessSettings/FrmMain.vb @@ -0,0 +1,680 @@ +Imports AccessFuncs.AccessFuncs +Imports System.Runtime.InteropServices +Imports System.Text + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + ' Data structures or Boolean values used track accessibility + ' status in this application. + Private AT As ACCESSTIMEOUT ' Access Timeout + Private FK As FILTERKEYS ' FilterKeys + Private HC As HIGHCONTRAST ' High Contrast + Private MK As MOUSEKEYS ' MouseKeys + Private SR As Boolean ' ScreenReader + Private SC As SERIALKEYS ' SerialKeys + Private SSound As Boolean ' ShowSounds + Private SSentry As SOUNDSENTRY ' SoundSentry + Private SK As STICKYKEYS ' StickyKeys + Private TK As TOGGLEKEYS ' ToggleKeys + + Public Sub New() + MyBase.New() + Dim DataSize As Int32 ' Size of the data structure. + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + ' Initialize the data structures. + AT = New ACCESSTIMEOUT ' Access Timeout + FK = New FILTERKEYS ' FilterKeys + HC = New HIGHCONTRAST ' High Contrast + MK = New MOUSEKEYS ' MouseKeys + SR = False ' ScreenReader + SC = New SERIALKEYS ' SerialKeys + SSound = False ' ShowSounds + SSentry = New SOUNDSENTRY ' SoundSentry + SK = New STICKYKEYS ' StickyKeys + TK = New TOGGLEKEYS ' ToggleKeys + + ' Initialize the data structures and Choose menu options. The + ' process includes getting the current option status (which + ' fills out the data structure) and then comparing the flag + ' values to see if the option is on. + + ' Access Timeout + DataSize = Marshal.SizeOf(AT) + AT.cbSize = Convert.ToUInt32(DataSize) + AT = GetAccessibleOption( _ + AT, _ + DataSize, _ + AccessType.SPI_GETACCESSTIMEOUT, _ + WinIniFlags.SPIF_NONE) + If ((AT.dwFlags & AccessTimeoutFlags.ATF_TIMEOUTON) = _ + AccessTimeoutFlags.ATF_TIMEOUTON) Then + mnuChooseAccessTimeout.Checked = True + End If + + ' FilterKeys + DataSize = Marshal.SizeOf(FK) + FK.cbSize = Convert.ToUInt32(DataSize) + FK = GetAccessibleOption( _ + FK, _ + DataSize, _ + AccessType.SPI_GETFILTERKEYS, _ + WinIniFlags.SPIF_NONE) + if ((FK.dwFlags & FilterKeysFlags.FKF_FILTERKEYSON) = _ + FilterKeysFlags.FKF_FILTERKEYSON) then + mnuChooseFilterKeys.Checked = True + End If + + ' High Contrast + DataSize = Marshal.SizeOf(HC) + HC.cbSize = Convert.ToUInt32(DataSize) + HC = GetAccessibleOption( _ + HC, _ + DataSize, _ + AccessType.SPI_GETHIGHCONTRAST, _ + WinIniFlags.SPIF_NONE) + if ((HC.dwFlags & HighContrastFlags.HCF_HIGHCONTRASTON) = _ + HighContrastFlags.HCF_HIGHCONTRASTON) then + mnuChooseHighContrast.Checked = True + End If + + ' MouseKeys + DataSize = Marshal.SizeOf(MK) + MK.cbSize = Convert.ToUInt32(DataSize) + MK = GetAccessibleOption( _ + MK, _ + DataSize, _ + AccessType.SPI_GETMOUSEKEYS, _ + WinIniFlags.SPIF_NONE) + If ((Convert.ToInt32(MK.dwFlags) And MouseKeysFlags.MKF_MOUSEKEYSON) = _ + MouseKeysFlags.MKF_MOUSEKEYSON) Then + mnuChooseMouseKeys.Checked = True + End If + + ' Screen Reader + DataSize = Marshal.SizeOf(SR) + SR = GetAccessibleOption( _ + SR, _ + DataSize, _ + AccessType.SPI_GETSCREENREADER, _ + WinIniFlags.SPIF_NONE) + If (SR) Then + mnuChooseScreenReader.Checked = True + End If + + ' SerialKeys + DataSize = Marshal.SizeOf(SC) + SC.cbSize = Convert.ToUInt32(DataSize) + SC = GetAccessibleOption( _ + SC, _ + DataSize, _ + AccessType.SPI_GETSERIALKEYS, _ + WinIniFlags.SPIF_NONE) + If ((SC.dwFlags And SerialKeysFlags.SERKF_SERIALKEYSON) = _ + SerialKeysFlags.SERKF_SERIALKEYSON) Then + mnuChooseSerialKeys.Checked = True + ElseIf (SC.lpszActivePort = Nothing) Then + + ' This is one of the few accessibility options not supported + ' under Windows 2000/XP. Microsoft changed this behavior to + ' ensure that SerialKeys devices would appear as standard + ' input devices to the application. The lpszActivePort member + ' will always contain a value for operating systems that + ' support the SerialKeys feature. + mnuChooseSerialKeys.Enabled = False + End If + + ' ShowSounds + DataSize = Marshal.SizeOf(SSound) + SSound = GetAccessibleOption( _ + SSound, _ + DataSize, _ + AccessType.SPI_GETSHOWSOUNDS, _ + WinIniFlags.SPIF_NONE) + If (SSound) Then + mnuChooseShowSounds.Checked = True + End If + + ' SoundSentry + DataSize = Marshal.SizeOf(SSentry) + SSentry.cbSize = Convert.ToUInt32(DataSize) + SSentry = GetAccessibleOption( _ + SSentry, _ + DataSize, _ + AccessType.SPI_GETSOUNDSENTRY, _ + WinIniFlags.SPIF_NONE) + If ((SSentry.dwFlags And SoundSentryFlags.SSF_SOUNDSENTRYON) = _ + SoundSentryFlags.SSF_SOUNDSENTRYON) Then + mnuChooseSoundSentry.Checked = True + End If + + ' StickyKeys + DataSize = Marshal.SizeOf(SK) + SK.cbSize = Convert.ToUInt32(DataSize) + SK = GetAccessibleOption( _ + SK, _ + DataSize, _ + AccessType.SPI_GETSTICKYKEYS, _ + WinIniFlags.SPIF_NONE) + If ((SK.dwFlags And StickyKeysFlags.SKF_STICKYKEYSON) = _ + StickyKeysFlags.SKF_STICKYKEYSON) Then + mnuChooseStickyKeys.Checked = True + End If + + ' ToggleKeys + DataSize = Marshal.SizeOf(TK) + TK.cbSize = Convert.ToUInt32(DataSize) + TK = GetAccessibleOption( _ + TK, _ + DataSize, _ + AccessType.SPI_GETTOGGLEKEYS, _ + WinIniFlags.SPIF_NONE) + If ((TK.dwFlags And ToggleKeysFlags.TKF_TOGGLEKEYSON) = _ + ToggleKeysFlags.TKF_TOGGLEKEYSON) Then + mnuChooseToggleKeys.Checked = True + End If + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents mnuMain As System.Windows.Forms.MainMenu + Friend WithEvents mnuFile As System.Windows.Forms.MenuItem + Friend WithEvents mnuFileExit As System.Windows.Forms.MenuItem + Friend WithEvents mnuChoose As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseAccessTimeout As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseFilterKeys As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseHighContrast As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseMouseKeys As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseScreenReader As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseSerialKeys As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseShowSounds As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseSoundSentry As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseStickyKeys As System.Windows.Forms.MenuItem + Friend WithEvents mnuChooseToggleKeys As System.Windows.Forms.MenuItem + Friend WithEvents ToolTip As System.Windows.Forms.ToolTip + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.mnuMain = New System.Windows.Forms.MainMenu + Me.mnuFile = New System.Windows.Forms.MenuItem + Me.mnuFileExit = New System.Windows.Forms.MenuItem + Me.mnuChoose = New System.Windows.Forms.MenuItem + Me.mnuChooseAccessTimeout = New System.Windows.Forms.MenuItem + Me.mnuChooseFilterKeys = New System.Windows.Forms.MenuItem + Me.mnuChooseHighContrast = New System.Windows.Forms.MenuItem + Me.mnuChooseMouseKeys = New System.Windows.Forms.MenuItem + Me.mnuChooseScreenReader = New System.Windows.Forms.MenuItem + Me.mnuChooseSerialKeys = New System.Windows.Forms.MenuItem + Me.mnuChooseShowSounds = New System.Windows.Forms.MenuItem + Me.mnuChooseSoundSentry = New System.Windows.Forms.MenuItem + Me.mnuChooseStickyKeys = New System.Windows.Forms.MenuItem + Me.mnuChooseToggleKeys = New System.Windows.Forms.MenuItem + Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components) + ' + 'mnuMain + ' + Me.mnuMain.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile, Me.mnuChoose}) + ' + 'mnuFile + ' + Me.mnuFile.Index = 0 + Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFileExit}) + Me.mnuFile.Text = "&File" + ' + 'mnuFileExit + ' + Me.mnuFileExit.Index = 0 + Me.mnuFileExit.Shortcut = System.Windows.Forms.Shortcut.AltF4 + Me.mnuFileExit.Text = "E&xit" + ' + 'mnuChoose + ' + Me.mnuChoose.Index = 1 + Me.mnuChoose.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuChooseAccessTimeout, Me.mnuChooseFilterKeys, Me.mnuChooseHighContrast, Me.mnuChooseMouseKeys, Me.mnuChooseScreenReader, Me.mnuChooseSerialKeys, Me.mnuChooseShowSounds, Me.mnuChooseSoundSentry, Me.mnuChooseStickyKeys, Me.mnuChooseToggleKeys}) + Me.mnuChoose.Text = "&Choose Feature" + ' + 'mnuChooseAccessTimeout + ' + Me.mnuChooseAccessTimeout.Index = 0 + Me.mnuChooseAccessTimeout.Shortcut = System.Windows.Forms.Shortcut.F2 + Me.mnuChooseAccessTimeout.Text = "&Access Timeout" + ' + 'mnuChooseFilterKeys + ' + Me.mnuChooseFilterKeys.Index = 1 + Me.mnuChooseFilterKeys.Shortcut = System.Windows.Forms.Shortcut.F3 + Me.mnuChooseFilterKeys.Text = "&FilterKeys" + ' + 'mnuChooseHighContrast + ' + Me.mnuChooseHighContrast.Index = 2 + Me.mnuChooseHighContrast.Shortcut = System.Windows.Forms.Shortcut.F4 + Me.mnuChooseHighContrast.Text = "&High Contrast" + ' + 'mnuChooseMouseKeys + ' + Me.mnuChooseMouseKeys.Index = 3 + Me.mnuChooseMouseKeys.Shortcut = System.Windows.Forms.Shortcut.F5 + Me.mnuChooseMouseKeys.Text = "&MouseKeys" + ' + 'mnuChooseScreenReader + ' + Me.mnuChooseScreenReader.Index = 4 + Me.mnuChooseScreenReader.Shortcut = System.Windows.Forms.Shortcut.F6 + Me.mnuChooseScreenReader.Text = "&ScreenReader" + ' + 'mnuChooseSerialKeys + ' + Me.mnuChooseSerialKeys.Index = 5 + Me.mnuChooseSerialKeys.Shortcut = System.Windows.Forms.Shortcut.F7 + Me.mnuChooseSerialKeys.Text = "S&erialKeys" + ' + 'mnuChooseShowSounds + ' + Me.mnuChooseShowSounds.Index = 6 + Me.mnuChooseShowSounds.Shortcut = System.Windows.Forms.Shortcut.F8 + Me.mnuChooseShowSounds.Text = "Sh&owSounds" + ' + 'mnuChooseSoundSentry + ' + Me.mnuChooseSoundSentry.Index = 7 + Me.mnuChooseSoundSentry.Shortcut = System.Windows.Forms.Shortcut.F9 + Me.mnuChooseSoundSentry.Text = "Sound&Sentry" + ' + 'mnuChooseStickyKeys + ' + Me.mnuChooseStickyKeys.Index = 8 + Me.mnuChooseStickyKeys.Shortcut = System.Windows.Forms.Shortcut.F10 + Me.mnuChooseStickyKeys.Text = "Sticky&Keys" + ' + 'mnuChooseToggleKeys + ' + Me.mnuChooseToggleKeys.Index = 9 + Me.mnuChooseToggleKeys.Shortcut = System.Windows.Forms.Shortcut.F11 + Me.mnuChooseToggleKeys.Text = "&ToggleKeys" + ' + 'ToolTip + ' + Me.ToolTip.AutomaticDelay = 300 + Me.ToolTip.AutoPopDelay = 7000 + Me.ToolTip.InitialDelay = 300 + Me.ToolTip.ReshowDelay = 60 + ' + 'frmMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Menu = Me.mnuMain + Me.Name = "frmMain" + Me.Text = "Accessibility Functionality Demonstration" + + End Sub + +#End Region + + Private Function GetAccessibleOption(ByVal Struct As Object, _ + ByVal StructSize As Int32, _ + ByVal AccessType As AccessType, _ + ByVal IniFlag As WinIniFlags) As Object + Dim ReturnValue As Object ' The return data. + + ' Allocate enough memory to create an unmanaged version + ' of the data structure. + Dim DataPtr As IntPtr = Marshal.AllocHGlobal(StructSize) + + ' Point to the managed data stucture using the unmanaged + ' memory pointer. + Marshal.StructureToPtr(Struct, DataPtr, True) + + ' Call the SystemParametersInfo() function using the + ' unmanaged data structure pointer. + Accessible.SystemParametersInfo(AccessType, _ + Convert.ToUInt32(StructSize), _ + DataPtr, _ + IniFlag) + + ' Move the data retrieved from the umnanaged environment to + ' the managed data structure and return this data structure + ' as an object. + ReturnValue = Marshal.PtrToStructure(DataPtr, Struct.GetType()) + + ' Deallocate the memory we previously allocated. + Marshal.FreeHGlobal(DataPtr) + + ' Return the data. + Return ReturnValue + End Function + + Private Function SetAccessibleOption(ByVal Struct As Object, _ + ByVal StructSize As Int32, _ + ByVal AccessType As AccessType, _ + ByVal IniFlag As WinIniFlags) As Boolean + Dim ReturnValue As Boolean ' The return value of this method. + + ' Allocate enough memory to create an unmanaged version + ' of the data structure. + Dim DataPtr As IntPtr = Marshal.AllocHGlobal(StructSize) + + ' Point to the managed data stucture using the unmanaged + ' memory pointer. + Marshal.StructureToPtr(Struct, DataPtr, True) + + ' Return true if the SystemParametersInfo() function call + ' successfully modifies the Windows Accessibility features + ' using the data in the data structure. + ReturnValue = Accessible.SystemParametersInfo( _ + AccessType, _ + Convert.ToUInt32(StructSize), _ + DataPtr, _ + IniFlag) + + ' Deallocate the memory we previously allocated. + Marshal.FreeHGlobal(DataPtr) + + ' Return the data. + Return ReturnValue + End Function + + Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click + ' Exit the application. + End + End Sub + + Private Sub mnuChooseAccessTimeout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseAccessTimeout.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((AT.dwFlags & AccessTimeoutFlags.ATF_TIMEOUTON) = _ + AccessTimeoutFlags.ATF_TIMEOUTON) Then + AT.dwFlags = AT.dwFlags Or _ + AccessTimeoutFlags.ATF_TIMEOUTON + Else + AT.dwFlags = AT.dwFlags And _ + AccessTimeoutFlags.ATF_TIMEOUTON + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(AT) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(AT, _ + DataSize, _ + AccessType.SPI_SETACCESSTIMEOUT, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the Access Timeout option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseAccessTimeout.Checked = Not mnuChooseAccessTimeout.Checked + End If + End Sub + + Private Sub mnuChooseFilterKeys_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseFilterKeys.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((FK.dwFlags & FilterKeysFlags.FKF_FILTERKEYSON) = _ + FilterKeysFlags.FKF_FILTERKEYSON) Then + FK.dwFlags = FK.dwFlags Or _ + FilterKeysFlags.FKF_FILTERKEYSON + Else + FK.dwFlags = FK.dwFlags And _ + FilterKeysFlags.FKF_FILTERKEYSON + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(FK) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(FK, _ + DataSize, _ + AccessType.SPI_SETFILTERKEYS, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the FilterKeys option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseFilterKeys.Checked = Not mnuChooseFilterKeys.Checked + End If + End Sub + + Private Sub mnuChooseHighContrast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseHighContrast.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((HC.dwFlags & HighContrastFlags.HCF_HIGHCONTRASTON) = _ + HighContrastFlags.HCF_HIGHCONTRASTON) Then + HC.dwFlags = HC.dwFlags Or _ + HighContrastFlags.HCF_HIGHCONTRASTON + Else + HC.dwFlags = HC.dwFlags And _ + HighContrastFlags.HCF_HIGHCONTRASTON + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(HC) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(HC, _ + DataSize, _ + AccessType.SPI_SETHIGHCONTRAST, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the High Contrast option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseHighContrast.Checked = Not mnuChooseHighContrast.Checked + End If + End Sub + + Private Sub mnuChooseMouseKeys_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseMouseKeys.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((Convert.ToInt32(MK.dwFlags) & MouseKeysFlags.MKF_MOUSEKEYSON) = _ + MouseKeysFlags.MKF_MOUSEKEYSON) Then + MK.dwFlags = Convert.ToUInt32(Convert.ToInt32(MK.dwFlags) Or _ + MouseKeysFlags.MKF_MOUSEKEYSON) + Else + MK.dwFlags = Convert.ToUInt32(Convert.ToInt32(MK.dwFlags) And _ + MouseKeysFlags.MKF_MOUSEKEYSON) + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(MK) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(MK, _ + DataSize, _ + AccessType.SPI_SETMOUSEKEYS, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the MouseKeys option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseMouseKeys.Checked = Not mnuChooseMouseKeys.Checked + End If + End Sub + + Private Sub mnuChooseScreenReader_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseScreenReader.Click + ' You can't turn the screen reader on and off using a menu option. + MessageBox.Show("This is a status indicator only. Set the screen " + _ + "reader on using the Narrator application on the " + _ + "Accessibility menu.", _ + "Accessibility Option Status", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub + + Private Sub mnuChooseSerialKeys_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseSerialKeys.Click + ' You shouldn't turn SerialKeys on and off using a menu option. + MessageBox.Show("This is a status indicator only. Set " + _ + "SerialKeys on by adding a SerialKeys " + _ + "device to your system and modifying " + _ + "the Control Panel setting.", _ + "Accessibility Option Status", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub + + Private Sub mnuChooseShowSounds_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseShowSounds.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + SSound = Not SSound + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(SSound) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(IntPtr.Zero, _ + Convert.ToInt32(SSound), _ + AccessType.SPI_SETSHOWSOUNDS, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the ShowSounds option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseShowSounds.Checked = Not mnuChooseShowSounds.Checked + End If + End Sub + + Private Sub mnuChooseSoundSentry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseSoundSentry.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((SSentry.dwFlags & SoundSentryFlags.SSF_SOUNDSENTRYON) = _ + SoundSentryFlags.SSF_SOUNDSENTRYON) Then + SSentry.dwFlags = SSentry.dwFlags Or _ + SoundSentryFlags.SSF_SOUNDSENTRYON + Else + SSentry.dwFlags = SSentry.dwFlags And _ + SoundSentryFlags.SSF_SOUNDSENTRYON + SSentry.iWindowsEffect = SoundSentryWindowsEffects.SSWF_TITLE + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(SSentry) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(SSentry, _ + DataSize, _ + AccessType.SPI_SETSOUNDSENTRY, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the SoundSentry option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseSoundSentry.Checked = Not mnuChooseSoundSentry.Checked + End If + End Sub + + Private Sub mnuChooseStickyKeys_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseStickyKeys.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((SK.dwFlags & StickyKeysFlags.SKF_STICKYKEYSON) = _ + StickyKeysFlags.SKF_STICKYKEYSON) Then + SK.dwFlags = SK.dwFlags Or _ + StickyKeysFlags.SKF_STICKYKEYSON + Else + SK.dwFlags = SK.dwFlags And _ + StickyKeysFlags.SKF_STICKYKEYSON + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(SK) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(SK, _ + DataSize, _ + AccessType.SPI_SETSTICKYKEYS, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the StickyKeys option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseStickyKeys.Checked = Not mnuChooseStickyKeys.Checked + End If + End Sub + + Private Sub mnuChooseToggleKeys_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChooseToggleKeys.Click + Dim DataSize As Int32 ' Size of the data structure. + + ' Set the flag value as needed to toggle the feature on or off. + If ((TK.dwFlags & ToggleKeysFlags.TKF_TOGGLEKEYSON) = _ + ToggleKeysFlags.TKF_TOGGLEKEYSON) Then + TK.dwFlags = TK.dwFlags Or _ + ToggleKeysFlags.TKF_TOGGLEKEYSON + Else + TK.dwFlags = TK.dwFlags And _ + ToggleKeysFlags.TKF_TOGGLEKEYSON + End If + + ' Call on the library function to set the new FilterKeys status. + DataSize = Marshal.SizeOf(TK) + + ' If the function fails, display an error message. + If (Not SetAccessibleOption(TK, _ + DataSize, _ + AccessType.SPI_SETTOGGLEKEYS, _ + WinIniFlags.SPIF_NONE)) Then + MessageBox.Show("Could not set the ToggleKeys option", _ + "Accessibility Option Error", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Error) + + ' If the function succeeds, display a success message and change + ' the menu setting. + Else + mnuChooseToggleKeys.Checked = Not mnuChooseToggleKeys.Checked + End If + End Sub +End Class diff --git a/Chapter 06/VB/AccessSettings/bin/AccessFuncs.dll b/Chapter 06/VB/AccessSettings/bin/AccessFuncs.dll new file mode 100644 index 0000000..50cac1b Binary files /dev/null and b/Chapter 06/VB/AccessSettings/bin/AccessFuncs.dll differ diff --git a/Chapter 06/VB/AccessSettings/bin/AccessSettings.exe b/Chapter 06/VB/AccessSettings/bin/AccessSettings.exe new file mode 100644 index 0000000..6f82f43 Binary files /dev/null and b/Chapter 06/VB/AccessSettings/bin/AccessSettings.exe differ diff --git a/Chapter 06/VB/AccessSettings/obj/Debug/AccessSettings.exe b/Chapter 06/VB/AccessSettings/obj/Debug/AccessSettings.exe new file mode 100644 index 0000000..6f82f43 Binary files /dev/null and b/Chapter 06/VB/AccessSettings/obj/Debug/AccessSettings.exe differ diff --git a/Chapter 06/VB/AccessSettings/obj/Debug/AccessSettings.frmMain.resources b/Chapter 06/VB/AccessSettings/obj/Debug/AccessSettings.frmMain.resources new file mode 100644 index 0000000..0e49721 Binary files /dev/null and b/Chapter 06/VB/AccessSettings/obj/Debug/AccessSettings.frmMain.resources differ diff --git a/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.sln b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.sln new file mode 100644 index 0000000..9e98ffd --- /dev/null +++ b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AccessibleObjectDemo", "AccessibleObjectDemo.vbproj", "{E099AF78-7295-4834-8630-FE77739391A5}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E099AF78-7295-4834-8630-FE77739391A5}.Debug.ActiveCfg = Debug|.NET + {E099AF78-7295-4834-8630-FE77739391A5}.Debug.Build.0 = Debug|.NET + {E099AF78-7295-4834-8630-FE77739391A5}.Release.ActiveCfg = Release|.NET + {E099AF78-7295-4834-8630-FE77739391A5}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.suo b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.suo new file mode 100644 index 0000000..487ce0f Binary files /dev/null and b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.suo differ diff --git a/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.vbproj b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.vbproj new file mode 100644 index 0000000..de8787e --- /dev/null +++ b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.vbproj @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.vbproj.user b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 06/VB/AccessibleObjectDemo/AccessibleObjectDemo.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/AccessibleObjectDemo/AssemblyInfo.vb b/Chapter 06/VB/AccessibleObjectDemo/AssemblyInfo.vb new file mode 100644 index 0000000..62e3e4b --- /dev/null +++ b/Chapter 06/VB/AccessibleObjectDemo/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/AccessibleObjectDemo/FrmMain.resx b/Chapter 06/VB/AccessibleObjectDemo/FrmMain.resx new file mode 100644 index 0000000..498fbf4 --- /dev/null +++ b/Chapter 06/VB/AccessibleObjectDemo/FrmMain.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 06/VB/AccessibleObjectDemo/FrmMain.vb b/Chapter 06/VB/AccessibleObjectDemo/FrmMain.vb new file mode 100644 index 0000000..66046ed --- /dev/null +++ b/Chapter 06/VB/AccessibleObjectDemo/FrmMain.vb @@ -0,0 +1,174 @@ +Imports System.Text + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents txtMessage As System.Windows.Forms.TextBox + Friend WithEvents label1 As System.Windows.Forms.Label + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents btnTest As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.txtMessage = New System.Windows.Forms.TextBox + Me.label1 = New System.Windows.Forms.Label + Me.btnQuit = New System.Windows.Forms.Button + Me.btnTest = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'txtMessage + ' + Me.txtMessage.AccessibleDescription = "Contains the message you want to display during test." + Me.txtMessage.AccessibleName = "Application Test Message" + Me.txtMessage.AccessibleRole = System.Windows.Forms.AccessibleRole.Text + Me.txtMessage.Location = New System.Drawing.Point(8, 32) + Me.txtMessage.Name = "txtMessage" + Me.txtMessage.Size = New System.Drawing.Size(176, 20) + Me.txtMessage.TabIndex = 9 + Me.txtMessage.Text = "This is a test message box." + ' + 'label1 + ' + Me.label1.Location = New System.Drawing.Point(8, 8) + Me.label1.Name = "label1" + Me.label1.TabIndex = 8 + Me.label1.Text = "Test &Messsage" + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button lets you to exit the application." + Me.btnQuit.AccessibleName = "Exit the Application" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 7 + Me.btnQuit.Text = "&Quit" + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button tests application functionality." + Me.btnTest.AccessibleName = "Test the Application" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 6 + Me.btnTest.Text = "&Test" + ' + 'frmMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.txtMessage) + Me.Controls.Add(Me.label1) + Me.Controls.Add(Me.btnQuit) + Me.Controls.Add(Me.btnTest) + Me.Name = "frmMain" + Me.Text = "AccessibleObject Demonstration" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application. + End + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + ' Display a message box. + MessageBox.Show(txtMessage.Text, _ + "Test Message", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub + Private Sub SpecialTip(ByVal sender As System.Object, ByVal e As System.EventArgs) + Dim Ctrl As Control ' The control in question. + Dim AO As AccessibleObject ' The accessibility information. + Dim TT As ToolTip ' Special ToolTip + Dim Output As StringBuilder ' ToolTip Output String. + + ' Initialize the ToolTip. + TT = New ToolTip + TT.AutoPopDelay = 7000 + TT.AutomaticDelay = 300 + + ' Get the sender information. + Ctrl = sender + + ' Obtain access to the accessibility information. + AO = Ctrl.AccessibilityObject + + ' Create the output string. + Output = New StringBuilder + Output.Append("Name: ") + Output.Append(AO.Name) + Output.Append(vbCrLf + "Role: ") + Output.Append(AO.Role) + Output.Append(vbCrLf + "Description: ") + Output.Append(AO.Description) + Output.Append(vbCrLf + "Default Action: ") + If (AO.DefaultAction = Nothing) Then + Output.Append("None") + Else + Output.Append(AO.DefaultAction) + Output.Append(vbCrLf + "Keyboard Shortcut: ") + End If + If (AO.KeyboardShortcut = Nothing) Then + Output.Append("None") + Else + Output.Append(AO.KeyboardShortcut) + Output.Append(vbCrLf + "State: ") + Output.Append(AO.State) + Output.Append(vbCrLf + "Value: ") + End If + If (AO.Value = Nothing) Then + Output.Append("None") + Else + Output.Append(AO.Value) + End If + + ' Display the information on screen. + TT.SetToolTip(Ctrl, Output.ToString()) + TT.Active = True + End Sub + + Private Sub btnQuit_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnQuit.MouseHover + SpecialTip(btnQuit, New System.EventArgs) + End Sub + + Private Sub btnTest_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.MouseHover + SpecialTip(btnTest, New System.EventArgs) + End Sub + + Private Sub txtMessage_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtMessage.MouseHover + SpecialTip(txtMessage, New System.EventArgs) + End Sub +End Class diff --git a/Chapter 06/VB/AccessibleObjectDemo/bin/AccessibleObjectDemo.exe b/Chapter 06/VB/AccessibleObjectDemo/bin/AccessibleObjectDemo.exe new file mode 100644 index 0000000..a53f777 Binary files /dev/null and b/Chapter 06/VB/AccessibleObjectDemo/bin/AccessibleObjectDemo.exe differ diff --git a/Chapter 06/VB/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.exe b/Chapter 06/VB/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.exe new file mode 100644 index 0000000..a53f777 Binary files /dev/null and b/Chapter 06/VB/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.exe differ diff --git a/Chapter 06/VB/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.frmMain.resources b/Chapter 06/VB/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.frmMain.resources new file mode 100644 index 0000000..1069b53 Binary files /dev/null and b/Chapter 06/VB/AccessibleObjectDemo/obj/Debug/AccessibleObjectDemo.frmMain.resources differ diff --git a/Chapter 06/VB/CursorData/AssemblyInfo.vb b/Chapter 06/VB/CursorData/AssemblyInfo.vb new file mode 100644 index 0000000..67b2193 --- /dev/null +++ b/Chapter 06/VB/CursorData/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/CursorData/CursorData.sln b/Chapter 06/VB/CursorData/CursorData.sln new file mode 100644 index 0000000..f9169d5 --- /dev/null +++ b/Chapter 06/VB/CursorData/CursorData.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CursorData", "CursorData.vbproj", "{5ECF613F-EC5C-4BE3-B4C0-CBED51E097BC}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {5ECF613F-EC5C-4BE3-B4C0-CBED51E097BC}.Debug.ActiveCfg = Debug|.NET + {5ECF613F-EC5C-4BE3-B4C0-CBED51E097BC}.Debug.Build.0 = Debug|.NET + {5ECF613F-EC5C-4BE3-B4C0-CBED51E097BC}.Release.ActiveCfg = Release|.NET + {5ECF613F-EC5C-4BE3-B4C0-CBED51E097BC}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/CursorData/CursorData.suo b/Chapter 06/VB/CursorData/CursorData.suo new file mode 100644 index 0000000..8112ae3 Binary files /dev/null and b/Chapter 06/VB/CursorData/CursorData.suo differ diff --git a/Chapter 06/VB/CursorData/CursorData.vbproj b/Chapter 06/VB/CursorData/CursorData.vbproj new file mode 100644 index 0000000..12570c1 --- /dev/null +++ b/Chapter 06/VB/CursorData/CursorData.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/CursorData/CursorData.vbproj.user b/Chapter 06/VB/CursorData/CursorData.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 06/VB/CursorData/CursorData.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/CursorData/FrmMain.resx b/Chapter 06/VB/CursorData/FrmMain.resx new file mode 100644 index 0000000..dc81677 --- /dev/null +++ b/Chapter 06/VB/CursorData/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + frmMain + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 06/VB/CursorData/FrmMain.vb b/Chapter 06/VB/CursorData/FrmMain.vb new file mode 100644 index 0000000..ab2a199 --- /dev/null +++ b/Chapter 06/VB/CursorData/FrmMain.vb @@ -0,0 +1,118 @@ +Imports System.Text + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ToolTip As System.Windows.Forms.ToolTip + Friend WithEvents btnGetCursor As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components) + Me.btnGetCursor = New System.Windows.Forms.Button + Me.btnQuit = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'ToolTip + ' + Me.ToolTip.AutomaticDelay = 300 + Me.ToolTip.AutoPopDelay = 7000 + Me.ToolTip.InitialDelay = 300 + Me.ToolTip.ReshowDelay = 60 + ' + 'btnGetCursor + ' + Me.btnGetCursor.AccessibleDescription = "This button tests the Get Cursor feature of the application." + Me.btnGetCursor.AccessibleName = "Get Cursor Test Button" + Me.btnGetCursor.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnGetCursor.Location = New System.Drawing.Point(208, 8) + Me.btnGetCursor.Name = "btnGetCursor" + Me.btnGetCursor.TabIndex = 8 + Me.btnGetCursor.Text = "&Get Cursor" + Me.ToolTip.SetToolTip(Me.btnGetCursor, "This button tests the Get Cursor feature of the application.") + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Quit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 9 + Me.btnQuit.Text = "&Quit" + Me.ToolTip.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'frmMain + ' + Me.AcceptButton = Me.btnGetCursor + Me.AccessibleDescription = "This application shows how to obtain cursor information." + Me.AccessibleName = "Cursor Statistics Demonstration" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.btnGetCursor) + Me.Controls.Add(Me.btnQuit) + Me.Name = "frmMain" + Me.Text = "Cursor Statistics Demonstration" + Me.ToolTip.SetToolTip(Me, "This application shows how to obtain cursor information.") + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + ' Exit the application. + End + End Sub + + Private Sub btnGetCursor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetCursor.Click + Dim CursorData As StringBuilder ' Cursor information. + + ' Initialize the StringBuilder + CursorData = New StringBuilder + + ' Get the cursor information. + CursorData.Append("The current cursor size is:" + vbCrLf + vbCrLf + "Height: ") + CursorData.Append(SystemInformation.CursorSize.Height.ToString()) + CursorData.Append(vbCrLf + "Width: ") + CursorData.Append(SystemInformation.CursorSize.Width.ToString()) + + ' Display the information. + MessageBox.Show(CursorData.ToString(), _ + "Cursor Data", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + + End Sub +End Class diff --git a/Chapter 06/VB/CursorData/bin/CursorData.exe b/Chapter 06/VB/CursorData/bin/CursorData.exe new file mode 100644 index 0000000..1fd4b1d Binary files /dev/null and b/Chapter 06/VB/CursorData/bin/CursorData.exe differ diff --git a/Chapter 06/VB/CursorData/obj/Debug/CursorData.exe b/Chapter 06/VB/CursorData/obj/Debug/CursorData.exe new file mode 100644 index 0000000..1fd4b1d Binary files /dev/null and b/Chapter 06/VB/CursorData/obj/Debug/CursorData.exe differ diff --git a/Chapter 06/VB/CursorData/obj/Debug/CursorData.frmMain.resources b/Chapter 06/VB/CursorData/obj/Debug/CursorData.frmMain.resources new file mode 100644 index 0000000..832de26 Binary files /dev/null and b/Chapter 06/VB/CursorData/obj/Debug/CursorData.frmMain.resources differ diff --git a/Chapter 06/VB/MouseCheck/AssemblyInfo.vb b/Chapter 06/VB/MouseCheck/AssemblyInfo.vb new file mode 100644 index 0000000..dabc641 --- /dev/null +++ b/Chapter 06/VB/MouseCheck/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/MouseCheck/FrmMain.resx b/Chapter 06/VB/MouseCheck/FrmMain.resx new file mode 100644 index 0000000..0914acb --- /dev/null +++ b/Chapter 06/VB/MouseCheck/FrmMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + frmMain + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 06/VB/MouseCheck/FrmMain.vb b/Chapter 06/VB/MouseCheck/FrmMain.vb new file mode 100644 index 0000000..4a6a91f --- /dev/null +++ b/Chapter 06/VB/MouseCheck/FrmMain.vb @@ -0,0 +1,155 @@ +Imports System.Text + +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ToolTip As System.Windows.Forms.ToolTip + Friend WithEvents btnTest As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components) + Me.btnTest = New System.Windows.Forms.Button + Me.btnQuit = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'ToolTip + ' + Me.ToolTip.AutomaticDelay = 300 + Me.ToolTip.AutoPopDelay = 7000 + Me.ToolTip.InitialDelay = 300 + Me.ToolTip.ReshowDelay = 60 + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button starts the test function of the application." + Me.btnTest.AccessibleName = "Application Test" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 6 + Me.btnTest.Text = "&Test" + Me.ToolTip.SetToolTip(Me.btnTest, "This button starts the test function of the application.") + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Quit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 7 + Me.btnQuit.Text = "&Quit" + Me.ToolTip.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'frmMain + ' + Me.AcceptButton = Me.btnTest + Me.AccessibleDescription = "This application demonstrates techniques for obtaining mouse information." + Me.AccessibleName = "Mouse Data Demonstration" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.btnTest) + Me.Controls.Add(Me.btnQuit) + Me.Name = "frmMain" + Me.Text = "Mouse Data Demonstration" + Me.ToolTip.SetToolTip(Me, "This application demonstrates techniques for obtaining mouse information.") + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + ' Exit the application. + End + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + Dim MouseData As StringBuilder ' The mouse setup information. + + ' Initialize the StringBuilder. + MouseData = New StringBuilder + + ' Check for the presence of a mouse. + If (SystemInformation.MousePresent) Then + ' Begin building the MouseData string. + MouseData.Append("System includes a mouse with the " + _ + "following characteristics:" + vbCrLf) + + ' Get the clicking information. + MouseData.Append(vbCrLf + "Double Click Area (pixels): ") + MouseData.Append( _ + SystemInformation.DoubleClickSize.ToString()) + MouseData.Append(vbCrLf + "Double Click Time (ms): ") + MouseData.Append( _ + SystemInformation.DoubleClickTime.ToString()) + + ' Get the mouse specific information. + MouseData.Append(vbCrLf + vbCrLf + "Number of Mouse Buttons: ") + MouseData.Append( _ + SystemInformation.MouseButtons.ToString()) + MouseData.Append(vbCrLf + "Are the buttons swapped? ") + MouseData.Append( _ + SystemInformation.MouseButtonsSwapped.ToString()) + MouseData.Append(vbCrLf + vbCrLf + "Is a mouse wheel available? ") + MouseData.Append( _ + SystemInformation.MouseWheelPresent.ToString()) + + ' Display this information only for systems with + ' mouse wheel support. + If (SystemInformation.MouseWheelPresent) Then + MouseData.Append(vbCrLf + "Mouse wheel scroll lines: ") + MouseData.Append( _ + SystemInformation.MouseWheelScrollLines.ToString()) + MouseData.Append(vbCrLf + "Native mouse wheel support? ") + MouseData.Append( _ + SystemInformation.NativeMouseWheelSupport.ToString()) + End If + + ' Display the results. + MessageBox.Show(MouseData.ToString(), _ + "Mouse Access Information", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + + ' If no mouse is present, display a message and exit. + Else + MessageBox.Show("There is no mouse connected to this system.", _ + "No Mouse Access", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Exclamation) + End If + End Sub +End Class diff --git a/Chapter 06/VB/MouseCheck/MouseCheck.sln b/Chapter 06/VB/MouseCheck/MouseCheck.sln new file mode 100644 index 0000000..53db5f5 --- /dev/null +++ b/Chapter 06/VB/MouseCheck/MouseCheck.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MouseCheck", "MouseCheck.vbproj", "{CEB4516B-1832-4986-BD0B-B0FB7EF8AD6D}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CEB4516B-1832-4986-BD0B-B0FB7EF8AD6D}.Debug.ActiveCfg = Debug|.NET + {CEB4516B-1832-4986-BD0B-B0FB7EF8AD6D}.Debug.Build.0 = Debug|.NET + {CEB4516B-1832-4986-BD0B-B0FB7EF8AD6D}.Release.ActiveCfg = Release|.NET + {CEB4516B-1832-4986-BD0B-B0FB7EF8AD6D}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/MouseCheck/MouseCheck.suo b/Chapter 06/VB/MouseCheck/MouseCheck.suo new file mode 100644 index 0000000..c579209 Binary files /dev/null and b/Chapter 06/VB/MouseCheck/MouseCheck.suo differ diff --git a/Chapter 06/VB/MouseCheck/MouseCheck.vbproj b/Chapter 06/VB/MouseCheck/MouseCheck.vbproj new file mode 100644 index 0000000..2ae08ab --- /dev/null +++ b/Chapter 06/VB/MouseCheck/MouseCheck.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/MouseCheck/MouseCheck.vbproj.user b/Chapter 06/VB/MouseCheck/MouseCheck.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 06/VB/MouseCheck/MouseCheck.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/MouseCheck/bin/MouseCheck.exe b/Chapter 06/VB/MouseCheck/bin/MouseCheck.exe new file mode 100644 index 0000000..c82df15 Binary files /dev/null and b/Chapter 06/VB/MouseCheck/bin/MouseCheck.exe differ diff --git a/Chapter 06/VB/MouseCheck/obj/Debug/MouseCheck.exe b/Chapter 06/VB/MouseCheck/obj/Debug/MouseCheck.exe new file mode 100644 index 0000000..c82df15 Binary files /dev/null and b/Chapter 06/VB/MouseCheck/obj/Debug/MouseCheck.exe differ diff --git a/Chapter 06/VB/MouseCheck/obj/Debug/MouseCheck.frmMain.resources b/Chapter 06/VB/MouseCheck/obj/Debug/MouseCheck.frmMain.resources new file mode 100644 index 0000000..0b77cb8 Binary files /dev/null and b/Chapter 06/VB/MouseCheck/obj/Debug/MouseCheck.frmMain.resources differ diff --git a/Chapter 06/VB/PlaySound/AssemblyInfo.vb b/Chapter 06/VB/PlaySound/AssemblyInfo.vb new file mode 100644 index 0000000..08f24ca --- /dev/null +++ b/Chapter 06/VB/PlaySound/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/PlaySound/PlaySound.sln b/Chapter 06/VB/PlaySound/PlaySound.sln new file mode 100644 index 0000000..13073b9 --- /dev/null +++ b/Chapter 06/VB/PlaySound/PlaySound.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "PlaySound", "PlaySound.vbproj", "{40E30D5B-1307-4F3B-B88D-ED2263629442}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {40E30D5B-1307-4F3B-B88D-ED2263629442}.Debug.ActiveCfg = Debug|.NET + {40E30D5B-1307-4F3B-B88D-ED2263629442}.Debug.Build.0 = Debug|.NET + {40E30D5B-1307-4F3B-B88D-ED2263629442}.Release.ActiveCfg = Release|.NET + {40E30D5B-1307-4F3B-B88D-ED2263629442}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/PlaySound/PlaySound.suo b/Chapter 06/VB/PlaySound/PlaySound.suo new file mode 100644 index 0000000..666658b Binary files /dev/null and b/Chapter 06/VB/PlaySound/PlaySound.suo differ diff --git a/Chapter 06/VB/PlaySound/PlaySound.vb b/Chapter 06/VB/PlaySound/PlaySound.vb new file mode 100644 index 0000000..f4f75c5 --- /dev/null +++ b/Chapter 06/VB/PlaySound/PlaySound.vb @@ -0,0 +1,185 @@ +Imports System.ComponentModel +Imports System.Diagnostics +Imports System.Drawing +Imports System.Drawing.Design +Imports System.Runtime.InteropServices +Imports System.Windows.Forms +Imports System.Windows.Forms.Design + +Namespace PlaySound + Public Class PlaySound + Inherits Component +#Region "Private field values." + ' Determines if the system will make a sound. + Private _MakeSound As Boolean + ' Contains the name of the file to play. + Private _SoundFileName As String + ' Describes the sound to the person using ShowSounds. + Private _ShowSoundsDescription As String + ' Determines the hover delay for the tooltip + ' displaying the sound description. + Private _AutomaticDelay As Int32 + ' Determines the amount of time the tooltip + ' will appear on screen. + Private _AutoPopDelay As Int32 + + ' Sound Text Description ToolTip + Private TT As ToolTip + + ' This special object controls the disappearance of + ' the sound description tooltip. + Private NoShow As Timer +#End Region + + Public Sub New() + ' Initialize the property values. + _MakeSound = True + _SoundFileName = "" + _ShowSoundsDescription = "The System Plays a Sound" + _AutomaticDelay = 300 + _AutoPopDelay = 7000 + NoShow = New Timer + End Sub + +#Region "PlaySound Events" + _ + Public Event SoundDisplayed As EventHandler + + _ + Public Event SoundGenerated As EventHandler +#End Region + +#Region "PlaySound Properties" + ' Each of these properties gets and/or sets a Private + ' field within the component. + + _ + Public Property MakeSound() As Boolean + Get + Return _MakeSound + End Get + Set(ByVal Value As Boolean) + _MakeSound = Value + End Set + End Property + + ' This property requires a special editor to ensure it works + ' as intended. + _ + Public Property SoundFileName() As String + Get + Return _SoundFileName + End Get + Set(ByVal Value As String) + _SoundFileName = Value + End Set + End Property + + _ + Public Property ShowSoundsDescription() As String + Get + Return _ShowSoundsDescription + End Get + Set(ByVal Value As String) + If (Not Value = Nothing) Then + _ShowSoundsDescription = Value + End If + End Set + End Property + + _ + Public Property AutomaticDelay() As Int32 + Get + Return _AutomaticDelay + End Get + Set(ByVal Value As Int32) + If (Value >= 1) Then + _AutomaticDelay = Value + End If + End Set + End Property + + _ + Public Property AutoPopDelay() As Int32 + Get + Return _AutoPopDelay + End Get + Set(ByVal Value As Int32) + If (Value >= 3000) Then + _AutoPopDelay = Value + End If + End Set + End Property +#End Region + +#Region "PlaySound Methods" + _ + Public Sub GenerateSound(ByVal Parent As Control) + Dim EA As System.EventArgs ' Used When Raising an Event. + + ' Initialize the EventArgs. + EA = New EventArgs + + ' Initialize the ToolTip. + TT = New ToolTip + TT.AutomaticDelay = _AutomaticDelay + TT.AutoPopDelay = _AutoPopDelay + + ' Intitialze the Timer. + NoShow.Interval = _AutoPopDelay + AddHandler NoShow.Tick, AddressOf Me.NoShow_Tick + + ' If the ShowSounds option is selected, display text. + If (IsShowSoundsSelected()) Then + ' Display the information on screen. + TT.SetToolTip(Parent, _ShowSoundsDescription) + TT.Active = True + NoShow.Start() + + ' Fire the event. + RaiseEvent SoundDisplayed(Me, EA) + End If + + If (_MakeSound) Then + ' Play a sound only when the user requests it. + WinPlaySound(_SoundFileName, _ + 0, _ + SND_FILENAME Or SND_ASYNC) + + ' Fire the event. + RaiseEvent SoundGenerated(Me, EA) + End If + End Sub + + _ + Public Function IsShowSoundsSelected() As Boolean + Return SystemInformation.ShowSounds + End Function +#End Region + +#Region "Win32 API Code" + ' Define some constants for using the PlaySound() function. + Private Const SND_SYNC As Int32 = &H0 + Private Const SND_ASYNC As Int32 = &H1 + Private Const SND_FILENAME As Int32 = &H20000 + + ' Import the Windows PlaySound() function. + _ + Private Shared Function WinPlaySound(ByVal pszSound As String, _ + ByVal hmod As Int32, _ + ByVal fdwSound As Int32) As Boolean + End Function +#End Region + +#Region "EventHandlers" + Private Sub NoShow_Tick(ByVal sender As Object, ByVal e As System.EventArgs) + ' Stop displaying the sound description. + TT.Active = False + + ' Stop the timer. + NoShow.Stop() + End Sub +#End Region +end class +End Namespace diff --git a/Chapter 06/VB/PlaySound/PlaySound.vbproj b/Chapter 06/VB/PlaySound/PlaySound.vbproj new file mode 100644 index 0000000..2be4049 --- /dev/null +++ b/Chapter 06/VB/PlaySound/PlaySound.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/PlaySound/PlaySound.vbproj.user b/Chapter 06/VB/PlaySound/PlaySound.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 06/VB/PlaySound/PlaySound.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/PlaySound/bin/PlaySound.dll b/Chapter 06/VB/PlaySound/bin/PlaySound.dll new file mode 100644 index 0000000..00d54dc Binary files /dev/null and b/Chapter 06/VB/PlaySound/bin/PlaySound.dll differ diff --git a/Chapter 06/VB/PlaySound/obj/Debug/PlaySound.dll b/Chapter 06/VB/PlaySound/obj/Debug/PlaySound.dll new file mode 100644 index 0000000..00d54dc Binary files /dev/null and b/Chapter 06/VB/PlaySound/obj/Debug/PlaySound.dll differ diff --git a/Chapter 06/VB/ShowSound/AssemblyInfo.vb b/Chapter 06/VB/ShowSound/AssemblyInfo.vb new file mode 100644 index 0000000..c560075 --- /dev/null +++ b/Chapter 06/VB/ShowSound/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 06/VB/ShowSound/FrmMain.resx b/Chapter 06/VB/ShowSound/FrmMain.resx new file mode 100644 index 0000000..946ef72 --- /dev/null +++ b/Chapter 06/VB/ShowSound/FrmMain.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + 105, 17 + + + Assembly + + + False + + + frmMain + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 06/VB/ShowSound/FrmMain.vb b/Chapter 06/VB/ShowSound/FrmMain.vb new file mode 100644 index 0000000..a57a0b3 --- /dev/null +++ b/Chapter 06/VB/ShowSound/FrmMain.vb @@ -0,0 +1,189 @@ +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ToolTip As System.Windows.Forms.ToolTip + Friend WithEvents cbSoundDisplay As System.Windows.Forms.CheckBox + Friend WithEvents cbSoundGenerate As System.Windows.Forms.CheckBox + Friend WithEvents cbSound As System.Windows.Forms.CheckBox + Friend WithEvents btnTest As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents MySound As PlaySound.PlaySound.PlaySound + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components) + Me.cbSoundDisplay = New System.Windows.Forms.CheckBox + Me.cbSoundGenerate = New System.Windows.Forms.CheckBox + Me.cbSound = New System.Windows.Forms.CheckBox + Me.btnTest = New System.Windows.Forms.Button + Me.btnQuit = New System.Windows.Forms.Button + Me.MySound = New PlaySound.PlaySound.PlaySound + Me.SuspendLayout() + ' + 'ToolTip + ' + Me.ToolTip.AutomaticDelay = 300 + Me.ToolTip.AutoPopDelay = 7000 + Me.ToolTip.InitialDelay = 300 + Me.ToolTip.ReshowDelay = 60 + ' + 'cbSoundDisplay + ' + Me.cbSoundDisplay.AccessibleDescription = "Instruct the application to use the event handler for sound description." + Me.cbSoundDisplay.AccessibleName = "Select Sound Display Event" + Me.cbSoundDisplay.AccessibleRole = System.Windows.Forms.AccessibleRole.CheckButton + Me.cbSoundDisplay.Location = New System.Drawing.Point(8, 64) + Me.cbSoundDisplay.Name = "cbSoundDisplay" + Me.cbSoundDisplay.Size = New System.Drawing.Size(170, 24) + Me.cbSoundDisplay.TabIndex = 11 + Me.cbSoundDisplay.Text = "Sound&Display Event" + Me.ToolTip.SetToolTip(Me.cbSoundDisplay, "Instruct the application to use the event handler for sound description.") + ' + 'cbSoundGenerate + ' + Me.cbSoundGenerate.AccessibleDescription = "Instruct the application to use the event handler for sound generation." + Me.cbSoundGenerate.AccessibleName = "Select Sound Generate Event" + Me.cbSoundGenerate.AccessibleRole = System.Windows.Forms.AccessibleRole.CheckButton + Me.cbSoundGenerate.Location = New System.Drawing.Point(8, 40) + Me.cbSoundGenerate.Name = "cbSoundGenerate" + Me.cbSoundGenerate.Size = New System.Drawing.Size(170, 24) + Me.cbSoundGenerate.TabIndex = 10 + Me.cbSoundGenerate.Text = "Sound&Generate Event" + Me.ToolTip.SetToolTip(Me.cbSoundGenerate, "Instruct the application to use the event handler for sound generation.") + ' + 'cbSound + ' + Me.cbSound.AccessibleDescription = "Tells system to play a sound." + Me.cbSound.AccessibleName = "Play Sound Selection" + Me.cbSound.AccessibleRole = System.Windows.Forms.AccessibleRole.CheckButton + Me.cbSound.Checked = True + Me.cbSound.CheckState = System.Windows.Forms.CheckState.Checked + Me.cbSound.Location = New System.Drawing.Point(8, 16) + Me.cbSound.Name = "cbSound" + Me.cbSound.Size = New System.Drawing.Size(170, 24) + Me.cbSound.TabIndex = 9 + Me.cbSound.Text = "&Play the Sound" + Me.ToolTip.SetToolTip(Me.cbSound, "Tells system to play a sound.") + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button starts the test function of the application." + Me.btnTest.AccessibleName = "Application Test" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 7 + Me.btnTest.Text = "&Test" + Me.ToolTip.SetToolTip(Me.btnTest, "This button starts the test function of the application.") + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Quit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 8 + Me.btnQuit.Text = "&Quit" + Me.ToolTip.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'MySound + ' + Me.MySound.AutomaticDelay = 300 + Me.MySound.AutoPopDelay = 7000 + Me.MySound.MakeSound = True + Me.MySound.ShowSoundsDescription = "The system plays the sound of bells." + Me.MySound.SoundFileName = "BELLS.WAV" + ' + 'frmMain + ' + Me.AcceptButton = Me.btnTest + Me.AccessibleDescription = "This application provides support for the PlaySound component." + Me.AccessibleName = "ShowSounds Demonstration" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.cbSoundDisplay) + Me.Controls.Add(Me.cbSoundGenerate) + Me.Controls.Add(Me.cbSound) + Me.Controls.Add(Me.btnTest) + Me.Controls.Add(Me.btnQuit) + Me.Name = "frmMain" + Me.Text = "ShowSounds Demonstration" + Me.ToolTip.SetToolTip(Me, "This application provides support for the PlaySound component.") + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application. + End + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + ' Check to see if the user wants to play a sound. + If (cbSound.Checked) Then + MySound.MakeSound = True + Else + MySound.MakeSound = False + End If + + ' Check to see if the user wants the SoundDisplayed event. + If (cbSoundDisplay.Checked) Then + AddHandler MySound.SoundDisplayed, AddressOf MySound_SoundDisplayed + Else + RemoveHandler MySound.SoundDisplayed, AddressOf MySound_SoundDisplayed + End If + + ' Check to see if the user wans the SoundGenerated event. + If (cbSoundGenerate.Checked) Then + AddHandler MySound.SoundGenerated, AddressOf MySound_SoundGenerated + Else + RemoveHandler MySound.SoundGenerated, AddressOf MySound_SoundGenerated + End If + + ' Perform the sound related task. + MySound.GenerateSound(btnTest) + End Sub + + Private Sub MySound_SoundDisplayed(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Display a message box. + MessageBox.Show("Sound Displayed") + End Sub + + Private Sub MySound_SoundGenerated(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Display a message box. + MessageBox.Show("Sound Generated") + End Sub +End Class diff --git a/Chapter 06/VB/ShowSound/ShowSound.sln b/Chapter 06/VB/ShowSound/ShowSound.sln new file mode 100644 index 0000000..820989d --- /dev/null +++ b/Chapter 06/VB/ShowSound/ShowSound.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ShowSound", "ShowSound.vbproj", "{25CC5F18-CEC8-4786-AC15-A084365C2D73}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {25CC5F18-CEC8-4786-AC15-A084365C2D73}.Debug.ActiveCfg = Debug|.NET + {25CC5F18-CEC8-4786-AC15-A084365C2D73}.Debug.Build.0 = Debug|.NET + {25CC5F18-CEC8-4786-AC15-A084365C2D73}.Release.ActiveCfg = Release|.NET + {25CC5F18-CEC8-4786-AC15-A084365C2D73}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 06/VB/ShowSound/ShowSound.suo b/Chapter 06/VB/ShowSound/ShowSound.suo new file mode 100644 index 0000000..1135db6 Binary files /dev/null and b/Chapter 06/VB/ShowSound/ShowSound.suo differ diff --git a/Chapter 06/VB/ShowSound/ShowSound.vbproj b/Chapter 06/VB/ShowSound/ShowSound.vbproj new file mode 100644 index 0000000..4d84904 --- /dev/null +++ b/Chapter 06/VB/ShowSound/ShowSound.vbproj @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 06/VB/ShowSound/ShowSound.vbproj.user b/Chapter 06/VB/ShowSound/ShowSound.vbproj.user new file mode 100644 index 0000000..c77db94 --- /dev/null +++ b/Chapter 06/VB/ShowSound/ShowSound.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 06/VB/ShowSound/bin/BELLS.WAV b/Chapter 06/VB/ShowSound/bin/BELLS.WAV new file mode 100644 index 0000000..1be8f7f Binary files /dev/null and b/Chapter 06/VB/ShowSound/bin/BELLS.WAV differ diff --git a/Chapter 06/VB/ShowSound/bin/ShowSound.exe b/Chapter 06/VB/ShowSound/bin/ShowSound.exe new file mode 100644 index 0000000..667b3d8 Binary files /dev/null and b/Chapter 06/VB/ShowSound/bin/ShowSound.exe differ diff --git a/Chapter 06/VB/ShowSound/bin/playsound.dll b/Chapter 06/VB/ShowSound/bin/playsound.dll new file mode 100644 index 0000000..00d54dc Binary files /dev/null and b/Chapter 06/VB/ShowSound/bin/playsound.dll differ diff --git a/Chapter 06/VB/ShowSound/obj/Debug/ShowSound.exe b/Chapter 06/VB/ShowSound/obj/Debug/ShowSound.exe new file mode 100644 index 0000000..667b3d8 Binary files /dev/null and b/Chapter 06/VB/ShowSound/obj/Debug/ShowSound.exe differ diff --git a/Chapter 06/VB/ShowSound/obj/Debug/ShowSound.frmMain.resources b/Chapter 06/VB/ShowSound/obj/Debug/ShowSound.frmMain.resources new file mode 100644 index 0000000..4c04796 Binary files /dev/null and b/Chapter 06/VB/ShowSound/obj/Debug/ShowSound.frmMain.resources differ diff --git a/Chapter 07/C#/AccControl/AccControl.XML b/Chapter 07/C#/AccControl/AccControl.XML new file mode 100644 index 0000000..e7d72dc --- /dev/null +++ b/Chapter 07/C#/AccControl/AccControl.XML @@ -0,0 +1,103 @@ + + + + AccControl + + + + + This class provides the functionality for the "Add Time to the + Timer" dialog box. + + + + + The constructor for the form that allows the user to + select more time. + + The current timer value. + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + The new time value the user selected for the automatic + click value. + + + + + This class contains the control functionality for the TimerButton + control. + + + + + The constructor for the TimerButton control. + + + + + Turns the button timer on so that the button will + click automatically when time expires. + + Set to true to turn the timer on or + false to turn the timer off. + + + + This method resets the AutoClick value to a user click state. + + + + + Sets the timing interval for the timer + in seconds. + + + + + Enables the count down display in the button + caption. + + + + + Returns the amount of time left before the + automatic click takes place. + + + + + Returns true if the timer is running. + + + + + Returns true when the timer is started. + + + + + Returns true when the button automatically clicks itself + rather than receiving a click from the user. + + + + + This property turns the More Time context menu On and Off. + Setting this value to true turns the menu Off, which means + the user won't be able to change the timeout value. + + + + diff --git a/Chapter 07/C#/AccControl/AccControl.csproj b/Chapter 07/C#/AccControl/AccControl.csproj new file mode 100644 index 0000000..c192e9b --- /dev/null +++ b/Chapter 07/C#/AccControl/AccControl.csproj @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 07/C#/AccControl/AccControl.csproj.user b/Chapter 07/C#/AccControl/AccControl.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 07/C#/AccControl/AccControl.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 07/C#/AccControl/AccControl.sln b/Chapter 07/C#/AccControl/AccControl.sln new file mode 100644 index 0000000..2139771 --- /dev/null +++ b/Chapter 07/C#/AccControl/AccControl.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccControl", "AccControl.csproj", "{C35956A8-14C6-45BB-98FA-673999F5A21C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {C35956A8-14C6-45BB-98FA-673999F5A21C}.Debug.ActiveCfg = Debug|.NET + {C35956A8-14C6-45BB-98FA-673999F5A21C}.Debug.Build.0 = Debug|.NET + {C35956A8-14C6-45BB-98FA-673999F5A21C}.Release.ActiveCfg = Release|.NET + {C35956A8-14C6-45BB-98FA-673999F5A21C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 07/C#/AccControl/AccControl.suo b/Chapter 07/C#/AccControl/AccControl.suo new file mode 100644 index 0000000..fc67af7 Binary files /dev/null and b/Chapter 07/C#/AccControl/AccControl.suo differ diff --git a/Chapter 07/C#/AccControl/AssemblyInfo.cs b/Chapter 07/C#/AccControl/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 07/C#/AccControl/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 07/C#/AccControl/FrmMoreTime.cs b/Chapter 07/C#/AccControl/FrmMoreTime.cs new file mode 100644 index 0000000..cb33407 --- /dev/null +++ b/Chapter 07/C#/AccControl/FrmMoreTime.cs @@ -0,0 +1,182 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; + +namespace AccControl +{ + /// + /// This class provides the functionality for the "Add Time to the + /// Timer" dialog box. + /// + public class FrmMoreTime : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lblCurrentTime; + private System.Windows.Forms.NumericUpDown txtNewValue; + private System.Windows.Forms.ToolTip MoreTimeToolTip; + private System.ComponentModel.IContainer components; + + /// + /// The constructor for the form that allows the user to + /// select more time. + /// + /// The current timer value. + [Description("The constructor for the form that allows the user " + + "to select more time.")] + public FrmMoreTime(Int32 CurrentTime) + { + // Required for Windows Form Designer support + InitializeComponent(); + + // Initize the current time value. + lblCurrentTime.Text = "The Current Time is: " + + CurrentTime.ToString(); + + // Initialize the up/down control value. + txtNewValue.Value = CurrentTime; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnOK = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.lblCurrentTime = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtNewValue = new System.Windows.Forms.NumericUpDown(); + this.MoreTimeToolTip = new System.Windows.Forms.ToolTip(this.components); + ((System.ComponentModel.ISupportInitialize)(this.txtNewValue)).BeginInit(); + this.SuspendLayout(); + // + // btnOK + // + this.btnOK.AccessibleDescription = "This button accepts the changed time value."; + this.btnOK.AccessibleName = "Timer Value Change Accept"; + this.btnOK.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOK.Location = new System.Drawing.Point(208, 8); + this.btnOK.Name = "btnOK"; + this.btnOK.TabIndex = 1; + this.btnOK.Text = "&OK"; + this.MoreTimeToolTip.SetToolTip(this.btnOK, "This button accepts the changed time value."); + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // btnCancel + // + this.btnCancel.AccessibleDescription = "This button cancels any change to the timer value."; + this.btnCancel.AccessibleName = "Timer Value Change Cancel"; + this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(208, 40); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.TabIndex = 2; + this.btnCancel.Text = "&Cancel"; + this.MoreTimeToolTip.SetToolTip(this.btnCancel, "This button cancels any change to the timer value."); + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // lblCurrentTime + // + this.lblCurrentTime.AccessibleDescription = "This label tells how many seconds are left on the current timer."; + this.lblCurrentTime.AccessibleName = "Current Timer Value"; + this.lblCurrentTime.AccessibleRole = System.Windows.Forms.AccessibleRole.StaticText; + this.lblCurrentTime.Location = new System.Drawing.Point(8, 16); + this.lblCurrentTime.Name = "lblCurrentTime"; + this.lblCurrentTime.Size = new System.Drawing.Size(176, 40); + this.lblCurrentTime.TabIndex = 3; + this.lblCurrentTime.Text = "label1"; + this.MoreTimeToolTip.SetToolTip(this.lblCurrentTime, "This label tells how many seconds are left on the current timer."); + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 64); + this.label2.Name = "label2"; + this.label2.TabIndex = 0; + this.label2.Text = "&New Timer Value"; + // + // txtNewValue + // + this.txtNewValue.AccessibleDescription = "Use this control to change the value of the timer interval in seconds."; + this.txtNewValue.AccessibleName = "Timer Value Change"; + this.txtNewValue.AccessibleRole = System.Windows.Forms.AccessibleRole.SpinButton; + this.txtNewValue.Location = new System.Drawing.Point(8, 88); + this.txtNewValue.Name = "txtNewValue"; + this.txtNewValue.TabIndex = 0; + this.MoreTimeToolTip.SetToolTip(this.txtNewValue, "Use this control to change the value of the timer interval in seconds."); + // + // FrmMoreTime + // + this.AcceptButton = this.btnOK; + this.AccessibleDescription = "This dialog box enables the user to add more time to the timer interval."; + this.AccessibleName = "Add Time to the Timer"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.txtNewValue); + this.Controls.Add(this.label2); + this.Controls.Add(this.lblCurrentTime); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Name = "FrmMoreTime"; + this.Text = "Add Time to the Timer"; + this.MoreTimeToolTip.SetToolTip(this, "This dialog box enables the user to add more time to the timer interval."); + ((System.ComponentModel.ISupportInitialize)(this.txtNewValue)).EndInit(); + this.ResumeLayout(false); + + } + #endregion + + // Internal time track variable and associated public property. + private Int32 _NewTime; + + /// + /// The new time value the user selected for the automatic + /// click value. + /// + [Description("The new time value the user selected for the " + + "automatic click value.")] + public Int32 NewTime + { + get { return _NewTime; } + } + + private void btnOK_Click(object sender, System.EventArgs e) + { + // Save the new value. + _NewTime = Convert.ToInt32(txtNewValue.Value); + + // Exit the form. + Close(); + } + + private void btnCancel_Click(object sender, System.EventArgs e) + { + // Exit the form. + Close(); + } + } +} diff --git a/Chapter 07/C#/AccControl/FrmMoreTime.resx b/Chapter 07/C#/AccControl/FrmMoreTime.resx new file mode 100644 index 0000000..4d80a21 --- /dev/null +++ b/Chapter 07/C#/AccControl/FrmMoreTime.resx @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 17, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Private + + + FrmMoreTime + + \ No newline at end of file diff --git a/Chapter 07/C#/AccControl/TIME.ICO b/Chapter 07/C#/AccControl/TIME.ICO new file mode 100644 index 0000000..42bea44 Binary files /dev/null and b/Chapter 07/C#/AccControl/TIME.ICO differ diff --git a/Chapter 07/C#/AccControl/Time.bmp b/Chapter 07/C#/AccControl/Time.bmp new file mode 100644 index 0000000..92b568c Binary files /dev/null and b/Chapter 07/C#/AccControl/Time.bmp differ diff --git a/Chapter 07/C#/AccControl/TimeLarge.bmp b/Chapter 07/C#/AccControl/TimeLarge.bmp new file mode 100644 index 0000000..22128f6 Binary files /dev/null and b/Chapter 07/C#/AccControl/TimeLarge.bmp differ diff --git a/Chapter 07/C#/AccControl/TimerButton.XML b/Chapter 07/C#/AccControl/TimerButton.XML new file mode 100644 index 0000000..734971e --- /dev/null +++ b/Chapter 07/C#/AccControl/TimerButton.XML @@ -0,0 +1,83 @@ + + + + AccControl + + + + + Summary description for FrmMoreTime. + + + + + Required designer variable. + + + + + The constructor for the form that allows the user to + select more time. + + The current timer value. + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + The new time value the user selected for the automatic + click value. + + + + + Summary description for Class1. + + + + + The constructor for the TimerButton control. + + + + + Turns the button timer on so that the button will + click automatically when time expires. + + Set to true to turn the timer on or + false to turn the timer off. + + + + Sets the timing interval for the timer + in seconds. + + + + + Enables the count down display in the button + caption. + + + + + Returns the amount of time left before the + automatic click takes place. + + + + + Returns true if the timer is running. + + + + diff --git a/Chapter 07/C#/AccControl/TimerButton.cs b/Chapter 07/C#/AccControl/TimerButton.cs new file mode 100644 index 0000000..df93f55 --- /dev/null +++ b/Chapter 07/C#/AccControl/TimerButton.cs @@ -0,0 +1,315 @@ +using System; +using System.ComponentModel; +using System.Windows.Forms; + +namespace AccControl +{ + /// + /// This class contains the control functionality for the TimerButton + /// control. + /// + public class TimerButton : Button + { + #region Private Variables + // Keeps track of the automatic button click time and the countdown + // display time on the button. + private Timer CounterTimer; + // The context menu used to obtain more time. + private ContextMenu mnuTimeSelect; + // The More Time menu item. + private MenuItem mnuMoreTime; + // A tool tip that describes the countdown function. + private ToolTip TimeNote; + // Keeps track of the remaining time. + private Int32 TimeLeft; + // Determines if the button displays the count. + private Boolean _CountdownEnabled; + // Contains the TimerInterval property value. + private Int32 _TimerInterval; + // Contains the old timer caption. + private String _OldCaption; + // Determines if the timer is started. + private Boolean _TimerStarted; + // Determines if the user clicked the button or it automatically + // clicked. + private Boolean _AutoClick; + // Tracks the state of the context menu. + private Boolean _NoMoreTime; + #endregion + + #region Constructor + /// + /// The constructor for the TimerButton control. + /// + [Description("The constructor for the TimerButton control.")] + public TimerButton() + { + // Create the countdown display timer. Set it to + // display once a second. + CounterTimer = new Timer(); + CounterTimer.Tick += + new System.EventHandler(this.CounterTimer_Tick); + CounterTimer.Interval = 1000; + + // Create the menu item. + mnuMoreTime = new MenuItem(); + mnuMoreTime.DefaultItem = true; + mnuMoreTime.Index = 0; + mnuMoreTime.Text = "&More Time"; + mnuMoreTime.Click += + new System.EventHandler(this.mnuMoreTime_Click); + + // Create the context menu and add the menu item. + mnuTimeSelect = new ContextMenu(new MenuItem[] {mnuMoreTime}); + + // Create the tool tip. + TimeNote = new ToolTip(); + TimeNote.SetToolTip( + this, + "This is a timed button. Right click the button and choose " + + "More Time from the context menu to change the time " + + "interval."); + + // Add the features to the control. + this.ContextMenu = mnuTimeSelect; + this.Text = "TimerButton"; + + // Initialize the property values. + _CountdownEnabled = true; + _TimerInterval = 15; + _AutoClick = false; + _TimerStarted = false; + _NoMoreTime = false; + } + #endregion + + #region TimedButton Properties + /// + /// Sets the timing interval for the timer + /// in seconds. + /// + [Description("Sets the timing interval for the timer " + + "in seconds.")] + public Int32 TimerInterval + { + get { return _TimerInterval; } + set + { + if (value > 0) + _TimerInterval = value; + } + } + + + /// + /// Enables the count down display in the button + /// caption. + /// + [Description("Enables the count down display in the button " + + "caption.")] + public Boolean CountdownEnabled + { + get { return _CountdownEnabled; } + set { _CountdownEnabled = value; } + } + + /// + /// Returns the amount of time left before the + /// automatic click takes place. + /// + [Description("Returns the amount of time left before the " + + "automatic click takes place.")] + public Int32 TimerValue + { + get { return TimeLeft; } + } + + /// + /// Returns true if the timer is running. + /// + [Description("Returns true if the timer is running.")] + public Boolean TimerEnabled + { + get { return CounterTimer.Enabled; } + } + + /// + /// Returns true when the timer is started. + /// + [Description("Returns true when the timer is started.")] + public Boolean TimerStarted + { + get { return _TimerStarted; } + } + + /// + /// Returns true when the button automatically clicks itself + /// rather than receiving a click from the user. + /// + [Description("Returns true when the button automatically clicks " + + "itself rather than receiving a click from the user.")] + public Boolean AutoClick + { + get { return _AutoClick; } + } + + /// + /// This property turns the More Time context menu On and Off. + /// Setting this value to true turns the menu Off, which means + /// the user won't be able to change the timeout value. + /// + [Description("This property turns the More Time context menu On " + + "and Off. Setting this value to true turns the " + + "menu Off, which means the user won't be able to " + + "change the timeout value.")] + public Boolean NoMoreTimeMenu + { + get { return _NoMoreTime; } + set + { + // Provide special handling if the developer chooses to + // turn the menu option off. + if (value == true) + { + // If the control is in design mode, make sure the + // developer is aware of the effects of this choice. + if (this.DesignMode) + { + // Make sure the developer wants to make the change. + DialogResult Result = MessageBox.Show( + "Setting this value to true will prevent " + + "the user from changing the timeout value. Do " + + "you want to make this change?", + "Value Change Warning", + MessageBoxButtons.YesNo, + MessageBoxIcon.Warning); + + // If the deveveloper does want to make the change set + // the property to true and turn off support for the + // event handler. + if (Result == DialogResult.Yes) + { + _NoMoreTime = value; + this.ContextMenu = null; + } + } + else + { + // The control is not in design mode, so make the + // required changes. + _NoMoreTime = value; + this.ContextMenu = null; + } + } + // If the developer is returning the control to its default + // value, then make the change. + else + { + _NoMoreTime = value; + this.ContextMenu = mnuTimeSelect; + } + } + } + #endregion + + #region TimedButton Methods + /// + /// Turns the button timer on so that the button will + /// click automatically when time expires. + /// + /// Set to true to turn the timer on or + /// false to turn the timer off. + [Description("Turns the button timer on so that the button will" + + "click automatically when time expires.")] + public void TimerStart(Boolean Start) + { + if (Start) + { + // Reset the AutoClick property. + _AutoClick = false; + + // Save the old caption for later use. + _OldCaption = this.Text; + + // Set the time keeper and the timer. + TimeLeft = _TimerInterval; + CounterTimer.Start(); + _TimerStarted = true; + } + else + { + // Stop the timer. + CounterTimer.Stop(); + + // Restore the original caption. + this.Text = _OldCaption; + _TimerStarted = false; + } + } + + /// + /// This method resets the AutoClick value to a user click state. + /// + [Description("This method resets the AutoClick value to a " + + "user click state.")] + public void AutoClickReset() + { + // Reset the AutoClick value. + _AutoClick = false; + } + #endregion + + #region TimedButton Internal Event Handlers + private void CounterTimer_Tick(object sender, System.EventArgs e) + { + System.EventArgs EA; // Used When Raising an Event. + + // Initialize the EventArgs. + EA = new EventArgs(); + + // If the developer enables the count down function, then + // display the remaining time as the button caption. + if (_CountdownEnabled) + this.Text = + "&Time: " + TimeLeft.ToString(); + + // Click the button automatically when time expires. + if (TimeLeft == 0) + { + // Turn the timer off. + CounterTimer.Stop(); + + // Set the result value to reflect an automatic click. + _AutoClick = true; + + // Fire the event. + OnClick(EA); + } + else + // Decrement the counter. + TimeLeft--; + } + + private void mnuMoreTime_Click(object sender, System.EventArgs e) + { + // Stop the timer so the user has time to make a change. + if (_TimerStarted) + CounterTimer.Stop(); + + // Create an instance of the time change form. + FrmMoreTime ChangeData = new FrmMoreTime(TimeLeft); + + // Display the form and obtain a result. + DialogResult MyResult = ChangeData.ShowDialog(this); + + // If the user clicked OK, change the time value. + if (MyResult == DialogResult.OK) + TimeLeft = ChangeData.NewTime; + + // Restart the timer so the button keeps track of the time. + if (_TimerStarted) + CounterTimer.Start(); + } + #endregion + } +} diff --git a/Chapter 07/C#/AccControl/bin/Debug/AccControl.XML b/Chapter 07/C#/AccControl/bin/Debug/AccControl.XML new file mode 100644 index 0000000..e7d72dc --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/AccControl.XML @@ -0,0 +1,103 @@ + + + + AccControl + + + + + This class provides the functionality for the "Add Time to the + Timer" dialog box. + + + + + The constructor for the form that allows the user to + select more time. + + The current timer value. + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + The new time value the user selected for the automatic + click value. + + + + + This class contains the control functionality for the TimerButton + control. + + + + + The constructor for the TimerButton control. + + + + + Turns the button timer on so that the button will + click automatically when time expires. + + Set to true to turn the timer on or + false to turn the timer off. + + + + This method resets the AutoClick value to a user click state. + + + + + Sets the timing interval for the timer + in seconds. + + + + + Enables the count down display in the button + caption. + + + + + Returns the amount of time left before the + automatic click takes place. + + + + + Returns true if the timer is running. + + + + + Returns true when the timer is started. + + + + + Returns true when the button automatically clicks itself + rather than receiving a click from the user. + + + + + This property turns the More Time context menu On and Off. + Setting this value to true turns the menu Off, which means + the user won't be able to change the timeout value. + + + + diff --git a/Chapter 07/C#/AccControl/bin/Debug/AccControl.dll b/Chapter 07/C#/AccControl/bin/Debug/AccControl.dll new file mode 100644 index 0000000..3181fc2 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/AccControl.dll differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/AccControl.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/AccControl.HTM new file mode 100644 index 0000000..faa64c2 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/AccControl.HTM @@ -0,0 +1,15 @@ + + + + +AccControl + + + + + + + + + + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP0.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP0.HTM new file mode 100644 index 0000000..802952f --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP0.HTM @@ -0,0 +1,52 @@ + + + + +AccControl + + + + +
+ +Solution + +| + +Project + +
+
+ + +AccControl + +
+
+
+FrmMoreTime +
+
+TimerButton +
+
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP10.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP10.HTM new file mode 100644 index 0000000..19fde23 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP10.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.components + + + +
AccControl.FrmMoreTime.components System.ComponentModel.IContainer components
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.ComponentModel.IContainer  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP11.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP11.HTM new file mode 100644 index 0000000..c6e446a --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP11.HTM @@ -0,0 +1,54 @@ + + + + +AccControl.FrmMoreTime.FrmMoreTime + + + +
AccControl.FrmMoreTime.FrmMoreTime Function
+
+ +The constructor for the form that allows the user to +select more time. +

+ +

+ + +
+Public void FrmMoreTime (int)
+ + + + + + + + + + + + + + + + +
 TypeNameDescription 
  intCurrentTimeThe current timer value. 
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP12.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP12.HTM new file mode 100644 index 0000000..5ff98ec --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP12.HTM @@ -0,0 +1,53 @@ + + + + +AccControl.FrmMoreTime.Dispose + + + +
AccControl.FrmMoreTime.Dispose Function
+
+ +Clean up any resources being used. +

+ +

+ + +
+Protected void Dispose (bool)
+ + + + + + + + + + + + + + + + +
 TypeNameDescription 
  booldisposing  
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP13.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP13.HTM new file mode 100644 index 0000000..2479a2f --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP13.HTM @@ -0,0 +1,37 @@ + + + + +AccControl.FrmMoreTime.InitializeComponent + + + +
AccControl.FrmMoreTime.InitializeComponent Function
+
+ +Required method for Designer support - do not modify +the contents of this method with the code editor. +

+ +

+ + +
+Private void InitializeComponent ()
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP14.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP14.HTM new file mode 100644 index 0000000..026ad8e --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP14.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime._NewTime + + + +
AccControl.FrmMoreTime._NewTime int _NewTime
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  int  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP15.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP15.HTM new file mode 100644 index 0000000..d631634 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP15.HTM @@ -0,0 +1,52 @@ + + + + +AccControl.FrmMoreTime.NewTime + + + +
AccControl.FrmMoreTime.NewTime int NewTime
+
+ +The new time value the user selected for the automatic +click value. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  int  
+ + + + + + + + + + + + + + +
 AccessorsDescription 
  NewTime  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP16.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP16.HTM new file mode 100644 index 0000000..4aaa9a5 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP16.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.NewTime + + + +
AccControl.FrmMoreTime.NewTime Function
+
+ +
+ + +
+Public int NewTime
+ + + + + + + + + + + + + + +
 ReturnDescription 
  int  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP17.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP17.HTM new file mode 100644 index 0000000..586a2a6 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP17.HTM @@ -0,0 +1,57 @@ + + + + +AccControl.FrmMoreTime.btnOK_Click + + + +
AccControl.FrmMoreTime.btnOK_Click Function
+
+ +
+ + +
+Private void btnOK_Click (object, System.EventArgs)
+ + + + + + + + + + + + + + + + + + + + + + + +
 TypeNameDescription 
  objectsender  
  System.EventArgse  
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP18.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP18.HTM new file mode 100644 index 0000000..bdae56d --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP18.HTM @@ -0,0 +1,57 @@ + + + + +AccControl.FrmMoreTime.btnCancel_Click + + + +
AccControl.FrmMoreTime.btnCancel_Click Function
+
+ +
+ + +
+Private void btnCancel_Click (object, System.EventArgs)
+ + + + + + + + + + + + + + + + + + + + + + + +
 TypeNameDescription 
  objectsender  
  System.EventArgse  
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP19.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP19.HTM new file mode 100644 index 0000000..d91f6c5 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP19.HTM @@ -0,0 +1,208 @@ + + + + +AccControl.TimerButton + + + +
AccControl.TimerButton Class
+
+ +This class contains the control functionality for the TimerButton +control. +

+ +

+ + +
+Access: Public
+
+Base Classes: Button
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 MembersDescription 
  CounterTimer  
  mnuTimeSelect  
  mnuMoreTime  
  TimeNote  
  TimeLeft  
  _CountdownEnabled  
  _TimerInterval  
  _OldCaption  
  _TimerStarted  
  _AutoClick  
  _NoMoreTime  
  TimerButton +The constructor for the TimerButton control. +

+

 
  TimerInterval +Sets the timing interval for the timer +in seconds. +

+

 
  CountdownEnabled +Enables the count down display in the button +caption. +

+

 
  TimerValue +Returns the amount of time left before the +automatic click takes place. +

+

 
  TimerEnabled +Returns true if the timer is running. +

+

 
  TimerStarted +Returns true when the timer is started. +

+

 
  AutoClick +Returns true when the button automatically clicks itself +rather than receiving a click from the user. +

+

 
  NoMoreTimeMenu +This property turns the More Time context menu On and Off. +Setting this value to true turns the menu Off, which means +the user won't be able to change the timeout value. +

+

 
  TimerStart +Turns the button timer on so that the button will +click automatically when time expires. +

+

 
  AutoClickReset +This method resets the AutoClick value to a user click state. +

+

 
  CounterTimer_Tick  
  mnuMoreTime_Click  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP2.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP2.HTM new file mode 100644 index 0000000..3c81438 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP2.HTM @@ -0,0 +1,16 @@ + + + + + + + + +
AccControl Project
+
+ +
+ + + + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP20.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP20.HTM new file mode 100644 index 0000000..2bcba76 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP20.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.CounterTimer + + + +
AccControl.TimerButton.CounterTimer System.Windows.Forms.Timer CounterTimer
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.Timer  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP21.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP21.HTM new file mode 100644 index 0000000..bd743b9 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP21.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.mnuTimeSelect + + + +
AccControl.TimerButton.mnuTimeSelect System.Windows.Forms.ContextMenu mnuTimeSelect
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.ContextMenu  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP22.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP22.HTM new file mode 100644 index 0000000..d970fe6 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP22.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.mnuMoreTime + + + +
AccControl.TimerButton.mnuMoreTime System.Windows.Forms.MenuItem mnuMoreTime
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.MenuItem  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP23.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP23.HTM new file mode 100644 index 0000000..7df2bef --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP23.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.TimeNote + + + +
AccControl.TimerButton.TimeNote System.Windows.Forms.ToolTip TimeNote
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.ToolTip  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP24.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP24.HTM new file mode 100644 index 0000000..8c80b65 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP24.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.TimeLeft + + + +
AccControl.TimerButton.TimeLeft int TimeLeft
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  int  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP25.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP25.HTM new file mode 100644 index 0000000..269fbcd --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP25.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton._CountdownEnabled + + + +
AccControl.TimerButton._CountdownEnabled bool _CountdownEnabled
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP26.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP26.HTM new file mode 100644 index 0000000..bcfd9a1 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP26.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton._TimerInterval + + + +
AccControl.TimerButton._TimerInterval int _TimerInterval
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  int  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP27.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP27.HTM new file mode 100644 index 0000000..9bda168 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP27.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton._OldCaption + + + +
AccControl.TimerButton._OldCaption string _OldCaption
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  string  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP28.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP28.HTM new file mode 100644 index 0000000..4066977 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP28.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton._TimerStarted + + + +
AccControl.TimerButton._TimerStarted bool _TimerStarted
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP29.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP29.HTM new file mode 100644 index 0000000..894471c --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP29.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton._AutoClick + + + +
AccControl.TimerButton._AutoClick bool _AutoClick
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP3.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP3.HTM new file mode 100644 index 0000000..4b33360 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP3.HTM @@ -0,0 +1,132 @@ + + + + +AccControl.FrmMoreTime + + + +
AccControl.FrmMoreTime Class
+
+ +This class provides the functionality for the "Add Time to the +Timer" dialog box. +

+ +

+ + +
+Access: Public
+
+Base Classes: Form
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 MembersDescription 
  btnOK  
  btnCancel  
  label2  
  lblCurrentTime  
  txtNewValue  
  MoreTimeToolTip  
  components  
  FrmMoreTime +The constructor for the form that allows the user to +select more time. +

+

 
  Dispose +Clean up any resources being used. +

+

 
  InitializeComponent +Required method for Designer support - do not modify +the contents of this method with the code editor. +

+

 
  _NewTime  
  NewTime +The new time value the user selected for the automatic +click value. +

+

 
  btnOK_Click  
  btnCancel_Click  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP30.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP30.HTM new file mode 100644 index 0000000..9ee87e9 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP30.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton._NoMoreTime + + + +
AccControl.TimerButton._NoMoreTime bool _NoMoreTime
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP31.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP31.HTM new file mode 100644 index 0000000..981473a --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP31.HTM @@ -0,0 +1,36 @@ + + + + +AccControl.TimerButton.TimerButton + + + +
AccControl.TimerButton.TimerButton Function
+
+ +The constructor for the TimerButton control. +

+ +

+ + +
+Public void TimerButton ()
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP32.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP32.HTM new file mode 100644 index 0000000..453eeac --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP32.HTM @@ -0,0 +1,58 @@ + + + + +AccControl.TimerButton.TimerInterval + + + +
AccControl.TimerButton.TimerInterval int TimerInterval
+
+ +Sets the timing interval for the timer +in seconds. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  int  
+ + + + + + + + + + + + + + + + + + + + +
 AccessorsDescription 
  TimerInterval  
  TimerInterval  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP33.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP33.HTM new file mode 100644 index 0000000..5c6bcc8 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP33.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.TimerInterval + + + +
AccControl.TimerButton.TimerInterval Function
+
+ +
+ + +
+Public int TimerInterval
+ + + + + + + + + + + + + + +
 ReturnDescription 
  int  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP34.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP34.HTM new file mode 100644 index 0000000..2290099 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP34.HTM @@ -0,0 +1,58 @@ + + + + +AccControl.TimerButton.CountdownEnabled + + + +
AccControl.TimerButton.CountdownEnabled bool CountdownEnabled
+
+ +Enables the count down display in the button +caption. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + + + + + + + + + + + + + + + + + + + +
 AccessorsDescription 
  CountdownEnabled  
  CountdownEnabled  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP35.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP35.HTM new file mode 100644 index 0000000..d0a824b --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP35.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.CountdownEnabled + + + +
AccControl.TimerButton.CountdownEnabled Function
+
+ +
+ + +
+Public bool CountdownEnabled
+ + + + + + + + + + + + + + +
 ReturnDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP36.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP36.HTM new file mode 100644 index 0000000..646f0b2 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP36.HTM @@ -0,0 +1,52 @@ + + + + +AccControl.TimerButton.TimerValue + + + +
AccControl.TimerButton.TimerValue int TimerValue
+
+ +Returns the amount of time left before the +automatic click takes place. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  int  
+ + + + + + + + + + + + + + +
 AccessorsDescription 
  TimerValue  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP37.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP37.HTM new file mode 100644 index 0000000..0efc5ba --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP37.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.TimerValue + + + +
AccControl.TimerButton.TimerValue Function
+
+ +
+ + +
+Public int TimerValue
+ + + + + + + + + + + + + + +
 ReturnDescription 
  int  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP38.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP38.HTM new file mode 100644 index 0000000..49f441d --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP38.HTM @@ -0,0 +1,51 @@ + + + + +AccControl.TimerButton.TimerEnabled + + + +
AccControl.TimerButton.TimerEnabled bool TimerEnabled
+
+ +Returns true if the timer is running. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + + + + + + + + + + + + + +
 AccessorsDescription 
  TimerEnabled  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP39.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP39.HTM new file mode 100644 index 0000000..4c257bc --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP39.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.TimerEnabled + + + +
AccControl.TimerButton.TimerEnabled Function
+
+ +
+ + +
+Public bool TimerEnabled
+ + + + + + + + + + + + + + +
 ReturnDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP4.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP4.HTM new file mode 100644 index 0000000..8c19f49 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP4.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.btnOK + + + +
AccControl.FrmMoreTime.btnOK System.Windows.Forms.Button btnOK
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.Button  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP40.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP40.HTM new file mode 100644 index 0000000..08df74f --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP40.HTM @@ -0,0 +1,51 @@ + + + + +AccControl.TimerButton.TimerStarted + + + +
AccControl.TimerButton.TimerStarted bool TimerStarted
+
+ +Returns true when the timer is started. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + + + + + + + + + + + + + +
 AccessorsDescription 
  TimerStarted  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP41.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP41.HTM new file mode 100644 index 0000000..00fcdad --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP41.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.TimerStarted + + + +
AccControl.TimerButton.TimerStarted Function
+
+ +
+ + +
+Public bool TimerStarted
+ + + + + + + + + + + + + + +
 ReturnDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP42.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP42.HTM new file mode 100644 index 0000000..257454a --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP42.HTM @@ -0,0 +1,52 @@ + + + + +AccControl.TimerButton.AutoClick + + + +
AccControl.TimerButton.AutoClick bool AutoClick
+
+ +Returns true when the button automatically clicks itself +rather than receiving a click from the user. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + + + + + + + + + + + + + +
 AccessorsDescription 
  AutoClick  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP43.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP43.HTM new file mode 100644 index 0000000..f37b509 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP43.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.AutoClick + + + +
AccControl.TimerButton.AutoClick Function
+
+ +
+ + +
+Public bool AutoClick
+ + + + + + + + + + + + + + +
 ReturnDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP44.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP44.HTM new file mode 100644 index 0000000..76c9671 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP44.HTM @@ -0,0 +1,59 @@ + + + + +AccControl.TimerButton.NoMoreTimeMenu + + + +
AccControl.TimerButton.NoMoreTimeMenu bool NoMoreTimeMenu
+
+ +This property turns the More Time context menu On and Off. +Setting this value to true turns the menu Off, which means +the user won't be able to change the timeout value. +

+ +

+ + +
+Access: Public
+ + + + + + + + + + + + + + +
 TypeDescription 
  bool  
+ + + + + + + + + + + + + + + + + + + + +
 AccessorsDescription 
  NoMoreTimeMenu  
  NoMoreTimeMenu  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP45.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP45.HTM new file mode 100644 index 0000000..1be768d --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP45.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.TimerButton.NoMoreTimeMenu + + + +
AccControl.TimerButton.NoMoreTimeMenu Function
+
+ +
+ + +
+Public bool NoMoreTimeMenu
+ + + + + + + + + + + + + + +
 ReturnDescription 
  bool  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP46.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP46.HTM new file mode 100644 index 0000000..6b79b97 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP46.HTM @@ -0,0 +1,55 @@ + + + + +AccControl.TimerButton.TimerStart + + + +
AccControl.TimerButton.TimerStart Function
+
+ +Turns the button timer on so that the button will +click automatically when time expires. +

+ +

+ + +
+Public void TimerStart (bool)
+ + + + + + + + + + + + + + + + +
 TypeNameDescription 
  boolStartSet to true to turn the timer on or +false to turn the timer off. 
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP47.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP47.HTM new file mode 100644 index 0000000..b8ecb31 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP47.HTM @@ -0,0 +1,36 @@ + + + + +AccControl.TimerButton.AutoClickReset + + + +
AccControl.TimerButton.AutoClickReset Function
+
+ +This method resets the AutoClick value to a user click state. +

+ +

+ + +
+Public void AutoClickReset ()
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP48.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP48.HTM new file mode 100644 index 0000000..7a229e2 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP48.HTM @@ -0,0 +1,57 @@ + + + + +AccControl.TimerButton.CounterTimer_Tick + + + +
AccControl.TimerButton.CounterTimer_Tick Function
+
+ +
+ + +
+Private void CounterTimer_Tick (object, System.EventArgs)
+ + + + + + + + + + + + + + + + + + + + + + + +
 TypeNameDescription 
  objectsender  
  System.EventArgse  
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP49.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP49.HTM new file mode 100644 index 0000000..09f42e6 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP49.HTM @@ -0,0 +1,57 @@ + + + + +AccControl.TimerButton.mnuMoreTime_Click + + + +
AccControl.TimerButton.mnuMoreTime_Click Function
+
+ +
+ + +
+Private void mnuMoreTime_Click (object, System.EventArgs)
+ + + + + + + + + + + + + + + + + + + + + + + +
 TypeNameDescription 
  objectsender  
  System.EventArgse  
+ + + + + + + + + + + + + + +
 ReturnDescription 
  void  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP5.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP5.HTM new file mode 100644 index 0000000..e40c2c9 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP5.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.btnCancel + + + +
AccControl.FrmMoreTime.btnCancel System.Windows.Forms.Button btnCancel
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.Button  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP6.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP6.HTM new file mode 100644 index 0000000..d1a33fc --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP6.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.label2 + + + +
AccControl.FrmMoreTime.label2 System.Windows.Forms.Label label2
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.Label  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP7.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP7.HTM new file mode 100644 index 0000000..b9dc4db --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP7.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.lblCurrentTime + + + +
AccControl.FrmMoreTime.lblCurrentTime System.Windows.Forms.Label lblCurrentTime
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.Label  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP8.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP8.HTM new file mode 100644 index 0000000..8a0d2c8 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP8.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.txtNewValue + + + +
AccControl.FrmMoreTime.txtNewValue System.Windows.Forms.NumericUpDown txtNewValue
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.NumericUpDown  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP9.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP9.HTM new file mode 100644 index 0000000..595fac1 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/AccControl/CWP9.HTM @@ -0,0 +1,33 @@ + + + + +AccControl.FrmMoreTime.MoreTimeToolTip + + + +
AccControl.FrmMoreTime.MoreTimeToolTip System.Windows.Forms.ToolTip MoreTimeToolTip
+
+ +
+ + +
+Access: Private
+ + + + + + + + + + + + + + +
 TypeDescription 
  System.Windows.Forms.ToolTip  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/CodeCommentReportError.htm b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/CodeCommentReportError.htm new file mode 100644 index 0000000..1bc1631 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/CodeCommentReportError.htm @@ -0,0 +1,13 @@ + + + + +CodeCommentReportError.htm + + + +

Code Comment Web Report

+
+
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/Solution_AccControl.HTM b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/Solution_AccControl.HTM new file mode 100644 index 0000000..5686b1a --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/Solution_AccControl.HTM @@ -0,0 +1,30 @@ + + + + +AccControl + + + +

Code Comment Web Report

+
AccControl Solution
+
+ +
+ + + + + + + + + + + + + + +
 ProjectDescription 
  AccControl  
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/banner.htm b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/banner.htm new file mode 100644 index 0000000..b46443e --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/banner.htm @@ -0,0 +1,9 @@ + + + + + +

Code Comment Web Report

+
+ + diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/banner.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/banner.jpg new file mode 100644 index 0000000..d0c3ffd Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/banner.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/commentreport.css b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/commentreport.css new file mode 100644 index 0000000..df25445 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/commentreport.css @@ -0,0 +1,133 @@ +BODY { + BACKGROUND-COLOR : white; + BORDER-BOTTOM : 0px; + BORDER-LEFT : 0px; + BORDER-RIGHT : 0px; + BORDER-TOP : 0px; + MARGIN : 0px; + PADDING-BOTTOM : 0px; + PADDING-LEFT : 0px; + PADDING-RIGHT : 0px; + PADDING-TOP : 0px; +} + +.PageHeading { + FONT-SIZE: 120%; + FONT-FAMILY: Verdana, sans-serif; + FONT-WEIGHT: bold; + MARGIN-TOP: 30px; + MARGIN-LEFT: 21px; +} + +.Description { + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + MARGIN-LEFT : 50px; + MARGIN-TOP : 16px; +} + +.InfoTable { + BORDER-BOTTOM : medium none; + BORDER-LEFT : medium none; + BORDER-RIGHT : medium none; + BORDER-TOP : medium none; + MARGIN-TOP : 16px; + MARGIN-LEFT : 10px; + WIDTH : 100%; +} + +.TableDarkLabel +{ + COLOR : white; + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + FONT-WEIGHT : bold; + MARGIN-LEFT : 9px; + BACKGROUND : #336666; +} + +.TableLightLabel +{ + COLOR : white; + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 9pt; + FONT-WEIGHT : bold; + MARGIN-LEFT : 19px; + BACKGROUND : #cccc66; + ALIGN : left; +} + +.TableDarkDesc +{ + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + MARGIN-LEFT : 9px; + BACKGROUND : #ffffcc; + COLOR : #003366; +} + +.TableLightDesc +{ + COLOR : black; + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + MARGIN-LEFT : 19px; + BACKGROUND : #ffffcc; +} + +.RemarkHdr { + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + FONT-WEIGHT : bold; + MARGIN-LEFT : 30px; + MARGIN-TOP : 18px; +} + +.Remarks { + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + MARGIN-LEFT : 50px; + MARGIN-TOP : 12px; +} + +.RemarkHdrX +{ + FONT-WEIGHT: bold; +} + +.Namespace { + COLOR : #003366; + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + FONT-WEIGHT : bold; + MARGIN-LEFT : 8px; + MARGIN-TOP : 13px; +} + +.NamespaceChild { + COLOR : #003366; + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + MARGIN-LEFT : 8px; + MARGIN-TOP : 11px; + FONT-WEIGHT : normal; +} + +.linkbuttons { + COLOR : #003366; + FONT-FAMILY : Verdana, sans-serif; + FONT-SIZE : 70%; + MARGIN-TOP : 3 px; + POSITION:relative; top:0; + BACKGROUND-COLOR: #99CCCC; + BORDER-BOTTOM: 1 solid #808080; + + PADDING-BOTTOM: 4; + PADDING-TOP: 2; + WIDTH: 210; +} + +a { +color : #6600ff; + TEXT-DECORATION: underline; +} diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/darkcorner.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/darkcorner.jpg new file mode 100644 index 0000000..84a3952 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/darkcorner.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/gradleft.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/gradleft.jpg new file mode 100644 index 0000000..1c770d3 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/gradleft.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/gradtop.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/gradtop.jpg new file mode 100644 index 0000000..7ba4568 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/gradtop.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/graycorner.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/graycorner.jpg new file mode 100644 index 0000000..acc3a85 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/graycorner.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/minus.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/minus.jpg new file mode 100644 index 0000000..365b946 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/minus.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/plus.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/plus.jpg new file mode 100644 index 0000000..7a7cd74 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/plus.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/titletile.jpg b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/titletile.jpg new file mode 100644 index 0000000..e4fae45 Binary files /dev/null and b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/titletile.jpg differ diff --git a/Chapter 07/C#/AccControl/bin/Debug/CodeComments/vt.js b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/vt.js new file mode 100644 index 0000000..1793053 --- /dev/null +++ b/Chapter 07/C#/AccControl/bin/Debug/CodeComments/vt.js @@ -0,0 +1,203 @@ +function resizeMe() { + alert('loaded'); +} + +function InitElements() { + for(var a=0; a + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 07/C#/AccControlTest/AccControlTest.csproj.user b/Chapter 07/C#/AccControlTest/AccControlTest.csproj.user new file mode 100644 index 0000000..4df3b10 --- /dev/null +++ b/Chapter 07/C#/AccControlTest/AccControlTest.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 07/C#/AccControlTest/AccControlTest.sln b/Chapter 07/C#/AccControlTest/AccControlTest.sln new file mode 100644 index 0000000..1f22abe --- /dev/null +++ b/Chapter 07/C#/AccControlTest/AccControlTest.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccControlTest", "AccControlTest.csproj", "{578D21AA-7C12-4EB6-9BB9-2DB1867BDD53}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {578D21AA-7C12-4EB6-9BB9-2DB1867BDD53}.Debug.ActiveCfg = Debug|.NET + {578D21AA-7C12-4EB6-9BB9-2DB1867BDD53}.Debug.Build.0 = Debug|.NET + {578D21AA-7C12-4EB6-9BB9-2DB1867BDD53}.Release.ActiveCfg = Release|.NET + {578D21AA-7C12-4EB6-9BB9-2DB1867BDD53}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 07/C#/AccControlTest/AccControlTest.suo b/Chapter 07/C#/AccControlTest/AccControlTest.suo new file mode 100644 index 0000000..01d253b Binary files /dev/null and b/Chapter 07/C#/AccControlTest/AccControlTest.suo differ diff --git a/Chapter 07/C#/AccControlTest/App.ico b/Chapter 07/C#/AccControlTest/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 07/C#/AccControlTest/App.ico differ diff --git a/Chapter 07/C#/AccControlTest/AssemblyInfo.cs b/Chapter 07/C#/AccControlTest/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 07/C#/AccControlTest/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 07/C#/AccControlTest/FrmMain.cs b/Chapter 07/C#/AccControlTest/FrmMain.cs new file mode 100644 index 0000000..3ed5fff --- /dev/null +++ b/Chapter 07/C#/AccControlTest/FrmMain.cs @@ -0,0 +1,171 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace AccControlTest +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnStart; + private System.Windows.Forms.Button btnQuit; + private AccControl.TimerButton btnTimer; + private System.Windows.Forms.ToolTip ToolTip; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.btnStart = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.btnTimer = new AccControl.TimerButton(); + this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // btnStart + // + this.btnStart.AccessibleDescription = "This button starts the timer."; + this.btnStart.AccessibleName = "Timer Start"; + this.btnStart.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnStart.Location = new System.Drawing.Point(208, 8); + this.btnStart.Name = "btnStart"; + this.btnStart.TabIndex = 0; + this.btnStart.Text = "&Start Timer"; + this.ToolTip.SetToolTip(this.btnStart, "This button starts the timer."); + this.btnStart.Click += new System.EventHandler(this.btnStart_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Exit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 72); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 2; + this.btnQuit.Text = "&Quit"; + this.ToolTip.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // btnTimer + // + this.btnTimer.AccessibleDescription = "This button tests the TimerButton control."; + this.btnTimer.AccessibleName = "TimerButton Test"; + this.btnTimer.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTimer.CountdownEnabled = true; + this.btnTimer.Location = new System.Drawing.Point(208, 40); + this.btnTimer.Name = "btnTimer"; + this.btnTimer.NoMoreTimeMenu = false; + this.btnTimer.TabIndex = 1; + this.btnTimer.Text = "&Test"; + this.btnTimer.TimerInterval = 15; + this.ToolTip.SetToolTip(this.btnTimer, "This button tests the TimerButton control."); + this.btnTimer.Click += new System.EventHandler(this.btnTimer_Click); + // + // ToolTip + // + this.ToolTip.AutoPopDelay = 7000; + this.ToolTip.InitialDelay = 500; + this.ToolTip.ReshowDelay = 100; + // + // frmMain + // + this.AcceptButton = this.btnStart; + this.AccessibleDescription = "This application tests the functionality of the TimerButton control."; + this.AccessibleName = "Accessible Control Test"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.btnTimer); + this.Controls.Add(this.btnQuit); + this.Controls.Add(this.btnStart); + this.Name = "frmMain"; + this.Text = "Accessible Control Test"; + this.ToolTip.SetToolTip(this, "This application tests the functionality of the TimerButton control."); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnStart_Click(object sender, System.EventArgs e) + { + // Start the TimerButton countdown. + btnTimer.TimerStart(true); + } + + private void btnTimer_Click(object sender, System.EventArgs e) + { + // Turn the timer off. + if (btnTimer.TimerStarted) + btnTimer.TimerStart(false); + + // Display a message box. + if (btnTimer.AutoClick) + MessageBox.Show("The button automatically clicked", + "Click Event", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + else + MessageBox.Show("The user clicked the button.", + "Click Event", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + + // Reset the AutoClick property. + btnTimer.AutoClickReset(); + } + } +} diff --git a/Chapter 07/C#/AccControlTest/FrmMain.resx b/Chapter 07/C#/AccControlTest/FrmMain.resx new file mode 100644 index 0000000..f72b7e4 --- /dev/null +++ b/Chapter 07/C#/AccControlTest/FrmMain.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + 17, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + frmMain + + + True + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 07/C#/AccControlTest/bin/Debug/AccControl.xml b/Chapter 07/C#/AccControlTest/bin/Debug/AccControl.xml new file mode 100644 index 0000000..e7d72dc --- /dev/null +++ b/Chapter 07/C#/AccControlTest/bin/Debug/AccControl.xml @@ -0,0 +1,103 @@ + + + + AccControl + + + + + This class provides the functionality for the "Add Time to the + Timer" dialog box. + + + + + The constructor for the form that allows the user to + select more time. + + The current timer value. + + + + Clean up any resources being used. + + + + + Required method for Designer support - do not modify + the contents of this method with the code editor. + + + + + The new time value the user selected for the automatic + click value. + + + + + This class contains the control functionality for the TimerButton + control. + + + + + The constructor for the TimerButton control. + + + + + Turns the button timer on so that the button will + click automatically when time expires. + + Set to true to turn the timer on or + false to turn the timer off. + + + + This method resets the AutoClick value to a user click state. + + + + + Sets the timing interval for the timer + in seconds. + + + + + Enables the count down display in the button + caption. + + + + + Returns the amount of time left before the + automatic click takes place. + + + + + Returns true if the timer is running. + + + + + Returns true when the timer is started. + + + + + Returns true when the button automatically clicks itself + rather than receiving a click from the user. + + + + + This property turns the More Time context menu On and Off. + Setting this value to true turns the menu Off, which means + the user won't be able to change the timeout value. + + + + diff --git a/Chapter 07/C#/AccControlTest/bin/Debug/AccControlTest.exe b/Chapter 07/C#/AccControlTest/bin/Debug/AccControlTest.exe new file mode 100644 index 0000000..79e107c Binary files /dev/null and b/Chapter 07/C#/AccControlTest/bin/Debug/AccControlTest.exe differ diff --git a/Chapter 07/C#/AccControlTest/bin/Debug/acccontrol.dll b/Chapter 07/C#/AccControlTest/bin/Debug/acccontrol.dll new file mode 100644 index 0000000..3181fc2 Binary files /dev/null and b/Chapter 07/C#/AccControlTest/bin/Debug/acccontrol.dll differ diff --git a/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.exe b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.exe new file mode 100644 index 0000000..79e107c Binary files /dev/null and b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.exe differ diff --git a/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.frmMain.resources b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.frmMain.resources new file mode 100644 index 0000000..8bbff1e Binary files /dev/null and b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.frmMain.resources differ diff --git a/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.projdata b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.projdata new file mode 100644 index 0000000..4df0804 Binary files /dev/null and b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.projdata differ diff --git a/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.projdata1 b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.projdata1 new file mode 100644 index 0000000..42495cb Binary files /dev/null and b/Chapter 07/C#/AccControlTest/obj/Debug/AccControlTest.projdata1 differ diff --git a/Chapter 07/C#/ContextHelp/App.ico b/Chapter 07/C#/ContextHelp/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 07/C#/ContextHelp/App.ico differ diff --git a/Chapter 07/C#/ContextHelp/AssemblyInfo.cs b/Chapter 07/C#/ContextHelp/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 07/C#/ContextHelp/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 07/C#/ContextHelp/ContextHelp.csproj b/Chapter 07/C#/ContextHelp/ContextHelp.csproj new file mode 100644 index 0000000..55081e4 --- /dev/null +++ b/Chapter 07/C#/ContextHelp/ContextHelp.csproj @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 07/C#/ContextHelp/ContextHelp.csproj.user b/Chapter 07/C#/ContextHelp/ContextHelp.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 07/C#/ContextHelp/ContextHelp.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 07/C#/ContextHelp/ContextHelp.sln b/Chapter 07/C#/ContextHelp/ContextHelp.sln new file mode 100644 index 0000000..eff6467 --- /dev/null +++ b/Chapter 07/C#/ContextHelp/ContextHelp.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContextHelp", "ContextHelp.csproj", "{68707ABB-1155-423F-9092-0A5F33726D64}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {68707ABB-1155-423F-9092-0A5F33726D64}.Debug.ActiveCfg = Debug|.NET + {68707ABB-1155-423F-9092-0A5F33726D64}.Debug.Build.0 = Debug|.NET + {68707ABB-1155-423F-9092-0A5F33726D64}.Release.ActiveCfg = Release|.NET + {68707ABB-1155-423F-9092-0A5F33726D64}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 07/C#/ContextHelp/ContextHelp.suo b/Chapter 07/C#/ContextHelp/ContextHelp.suo new file mode 100644 index 0000000..bf6c8b7 Binary files /dev/null and b/Chapter 07/C#/ContextHelp/ContextHelp.suo differ diff --git a/Chapter 07/C#/ContextHelp/FrmMain.cs b/Chapter 07/C#/ContextHelp/FrmMain.cs new file mode 100644 index 0000000..6bb410f --- /dev/null +++ b/Chapter 07/C#/ContextHelp/FrmMain.cs @@ -0,0 +1,181 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace ContextHelp +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.HelpProvider ControlHelp; + private System.Windows.Forms.ToolTip ControlToolTip; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Button btnQuit; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtMessage; + private System.ComponentModel.IContainer components; + + public frmMain() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.ControlHelp = new System.Windows.Forms.HelpProvider(); + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.txtMessage = new System.Windows.Forms.TextBox(); + this.ControlToolTip = new System.Windows.Forms.ToolTip(this.components); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // ControlHelp + // + this.ControlHelp.HelpNamespace = "D:\\0125 - Source Code\\Chapter 07\\HelpFiles\\ContextHelp.chm"; + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button starts the test function of the application."; + this.btnTest.AccessibleName = "Application Test"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.ControlHelp.SetHelpKeyword(this.btnTest, "Test Button"); + this.ControlHelp.SetHelpNavigator(this.btnTest, System.Windows.Forms.HelpNavigator.Index); + this.ControlHelp.SetHelpString(this.btnTest, "This is the Test button. You use it to test the application. Modify the Test Mess" + + "age data field to change the message."); + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.ControlHelp.SetShowHelp(this.btnTest, true); + this.btnTest.TabIndex = 1; + this.btnTest.Text = "&Test"; + this.ControlToolTip.SetToolTip(this.btnTest, "This button starts the test function of the application."); + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Quit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.ControlHelp.SetHelpKeyword(this.btnQuit, "Quit Button"); + this.ControlHelp.SetHelpNavigator(this.btnQuit, System.Windows.Forms.HelpNavigator.Index); + this.ControlHelp.SetHelpString(this.btnQuit, "This is the Quit button. You use it to exit the application."); + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.ControlHelp.SetShowHelp(this.btnQuit, true); + this.btnQuit.TabIndex = 2; + this.btnQuit.Text = "&Quit"; + this.ControlToolTip.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // txtMessage + // + this.txtMessage.AccessibleDescription = "Contains the test message that you want to display."; + this.txtMessage.AccessibleName = "Test Message Entry"; + this.txtMessage.AccessibleRole = System.Windows.Forms.AccessibleRole.Text; + this.ControlHelp.SetHelpKeyword(this.txtMessage, "Test Message Field"); + this.ControlHelp.SetHelpNavigator(this.txtMessage, System.Windows.Forms.HelpNavigator.Index); + this.ControlHelp.SetHelpString(this.txtMessage, "This is the Test Message data field. It contains the test message displayed when " + + "you click the Test button."); + this.txtMessage.Location = new System.Drawing.Point(8, 32); + this.txtMessage.Name = "txtMessage"; + this.ControlHelp.SetShowHelp(this.txtMessage, true); + this.txtMessage.Size = new System.Drawing.Size(168, 20); + this.txtMessage.TabIndex = 0; + this.txtMessage.Text = "This is a test message."; + this.ControlToolTip.SetToolTip(this.txtMessage, "Contains the test message that you want to display."); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 8); + this.label1.Name = "label1"; + this.label1.TabIndex = 0; + this.label1.Text = "Test &Message"; + // + // frmMain + // + this.AcceptButton = this.btnTest; + this.AccessibleDescription = "This application demonstrates the use of context sensitive help."; + this.AccessibleName = "Context Sensitive Help Demonstration"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.btnQuit; + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.txtMessage); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.HelpButton = true; + this.ControlHelp.SetHelpKeyword(this, "Overview"); + this.ControlHelp.SetHelpString(this, "Overview"); + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "frmMain"; + this.ControlHelp.SetShowHelp(this, true); + this.Text = "Context Sensitive Help"; + this.ControlToolTip.SetToolTip(this, "This application demonstrates the use of context sensitive help."); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + private void btnTest_Click(object sender, System.EventArgs e) + { + // Display the message box. + MessageBox.Show(txtMessage.Text, + "Test Message", + MessageBoxButtons.OK, + MessageBoxIcon.Information); + } + } +} diff --git a/Chapter 07/C#/ContextHelp/FrmMain.resx b/Chapter 07/C#/ContextHelp/FrmMain.resx new file mode 100644 index 0000000..6b86cbf --- /dev/null +++ b/Chapter 07/C#/ContextHelp/FrmMain.resx @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + 17, 17 + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + Private + + + 137, 17 + + + Private + + + False + + + Private + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + frmMain + + + 80 + + + True + + + Private + + \ No newline at end of file diff --git a/Chapter 07/C#/ContextHelp/bin/Debug/ContextHelp.chm b/Chapter 07/C#/ContextHelp/bin/Debug/ContextHelp.chm new file mode 100644 index 0000000..c089314 Binary files /dev/null and b/Chapter 07/C#/ContextHelp/bin/Debug/ContextHelp.chm differ diff --git a/Chapter 07/C#/ContextHelp/bin/Debug/ContextHelp.exe b/Chapter 07/C#/ContextHelp/bin/Debug/ContextHelp.exe new file mode 100644 index 0000000..3856dc4 Binary files /dev/null and b/Chapter 07/C#/ContextHelp/bin/Debug/ContextHelp.exe differ diff --git a/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.exe b/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.exe new file mode 100644 index 0000000..3856dc4 Binary files /dev/null and b/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.exe differ diff --git a/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.frmMain.resources b/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.frmMain.resources new file mode 100644 index 0000000..e021463 Binary files /dev/null and b/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.frmMain.resources differ diff --git a/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.projdata b/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.projdata new file mode 100644 index 0000000..6ec66f4 Binary files /dev/null and b/Chapter 07/C#/ContextHelp/obj/Debug/ContextHelp.projdata differ diff --git a/Chapter 07/C#/HelpFiles/ContextHelp.chm b/Chapter 07/C#/HelpFiles/ContextHelp.chm new file mode 100644 index 0000000..c089314 Binary files /dev/null and b/Chapter 07/C#/HelpFiles/ContextHelp.chm differ diff --git a/Chapter 07/C#/HelpFiles/ContextHelp.hhp b/Chapter 07/C#/HelpFiles/ContextHelp.hhp new file mode 100644 index 0000000..8f4ebb8 --- /dev/null +++ b/Chapter 07/C#/HelpFiles/ContextHelp.hhp @@ -0,0 +1,23 @@ +[OPTIONS] +Binary Index=No +Compatibility=1.1 or later +Compiled file=ContextHelp.chm +Contents file=Table of Contents.hhc +Default topic=TestButton.htm +Display compile progress=Yes +Full-text search=Yes +Index file=Index.hhk +Language=0x409 English (United States) +Title=A Simple Context Sensitive Help File Example + + +[FILES] +TestButton.htm +Overview.htm +QuitButton.htm +TestMessage.htm + +[INFOTYPES] +Category:Test Button +CategoryDesc:Learn about the Test button. + diff --git a/Chapter 07/C#/HelpFiles/Index.hhk b/Chapter 07/C#/HelpFiles/Index.hhk new file mode 100644 index 0000000..0681a80 --- /dev/null +++ b/Chapter 07/C#/HelpFiles/Index.hhk @@ -0,0 +1,35 @@ + + + + + + +
    +
  • + + + + + + + + + + +
  • + + + + +
  • + + + + +
  • + + + + +
+ diff --git a/Chapter 07/C#/HelpFiles/Overview.htm b/Chapter 07/C#/HelpFiles/Overview.htm new file mode 100644 index 0000000..6379ff5 --- /dev/null +++ b/Chapter 07/C#/HelpFiles/Overview.htm @@ -0,0 +1,27 @@ + + + + Overview + + + +

Context Sensitive Help Overview

+

Description

+ This application demonstrates the techniques you need to know to add context + sensitive help. Make sure you begin by creating a help file such as the one + created for this application. Add this help file to a HelpProvider control. + Once you have the HelpProvider in place, add entries to the HelpKeyword, + HelpNavigator, and HelpString properties for each control or field on the form. +

Other Topics

+

This application includes the following controls and fields:

+ +

More Information

+ Talk to your manager or your managed about local usage questions. You can contact + John Mueller with questions regarding the + programming features of this application. + + diff --git a/Chapter 07/C#/HelpFiles/QuitButton.htm b/Chapter 07/C#/HelpFiles/QuitButton.htm new file mode 100644 index 0000000..4086e29 --- /dev/null +++ b/Chapter 07/C#/HelpFiles/QuitButton.htm @@ -0,0 +1,16 @@ + + + + +Using the Quit Button + + +

Quit Button Description

+The Quit button is the cancel button for this application. Click the Quit button +when you want to exit this application. You should click this button only when you're +finished using the application. Contact your network administrator if you have questions +about using this button. +

More Information

+None + + diff --git a/Chapter 07/C#/HelpFiles/Table of Contents.hhc b/Chapter 07/C#/HelpFiles/Table of Contents.hhc new file mode 100644 index 0000000..7f41044 --- /dev/null +++ b/Chapter 07/C#/HelpFiles/Table of Contents.hhc @@ -0,0 +1,34 @@ + + + + + + + + + + +
    +
  • + + +
      +
    • + + + +
    • + + + +
    • + + + +
    • + + + +
    +
+ diff --git a/Chapter 07/C#/HelpFiles/TestButton.htm b/Chapter 07/C#/HelpFiles/TestButton.htm new file mode 100644 index 0000000..eecc1aa --- /dev/null +++ b/Chapter 07/C#/HelpFiles/TestButton.htm @@ -0,0 +1,13 @@ + + + + +Using the Test Button + + +

Test Button Description

+The Test button is the default button for this application. Click the Test button to display the test dialog box for this application. The content of the test dialog box is controled by the Test Message data field. You should click this button only when you want to test the application. Contact your network administrator if you have questions about using this button. +

More Information

+See the Test Message data field entry for additional information. + + diff --git a/Chapter 07/C#/HelpFiles/TestMessage.htm b/Chapter 07/C#/HelpFiles/TestMessage.htm new file mode 100644 index 0000000..ef6ff63 --- /dev/null +++ b/Chapter 07/C#/HelpFiles/TestMessage.htm @@ -0,0 +1,17 @@ + + + + +Using the Test Message Data Field + + +

Test Message Data Field Description

+The Test Message data field contains the text that will appear in the message box +produced when the user clicks the Test button. Type text in the Test Message data +field to modify the output of the application. Type a new message whenever you feel +the need to modify the application output. Contact your network administrator if you +have questions about using this data field. +

More Information

+See the Test button entry for additional information. + + diff --git a/Chapter 07/VB/AccControl/AccControl.sln b/Chapter 07/VB/AccControl/AccControl.sln new file mode 100644 index 0000000..71a0f72 --- /dev/null +++ b/Chapter 07/VB/AccControl/AccControl.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AccControl", "AccControl.vbproj", "{6AC613D7-D7CF-4385-A83D-9768577D8EF3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {6AC613D7-D7CF-4385-A83D-9768577D8EF3}.Debug.ActiveCfg = Debug|.NET + {6AC613D7-D7CF-4385-A83D-9768577D8EF3}.Debug.Build.0 = Debug|.NET + {6AC613D7-D7CF-4385-A83D-9768577D8EF3}.Release.ActiveCfg = Release|.NET + {6AC613D7-D7CF-4385-A83D-9768577D8EF3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 07/VB/AccControl/AccControl.suo b/Chapter 07/VB/AccControl/AccControl.suo new file mode 100644 index 0000000..98a6d3b Binary files /dev/null and b/Chapter 07/VB/AccControl/AccControl.suo differ diff --git a/Chapter 07/VB/AccControl/AccControl.vbproj b/Chapter 07/VB/AccControl/AccControl.vbproj new file mode 100644 index 0000000..3259063 --- /dev/null +++ b/Chapter 07/VB/AccControl/AccControl.vbproj @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 07/VB/AccControl/AccControl.vbproj.user b/Chapter 07/VB/AccControl/AccControl.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 07/VB/AccControl/AccControl.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 07/VB/AccControl/AssemblyInfo.vb b/Chapter 07/VB/AccControl/AssemblyInfo.vb new file mode 100644 index 0000000..70c3b10 --- /dev/null +++ b/Chapter 07/VB/AccControl/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 07/VB/AccControl/FrmMoreTime.resx b/Chapter 07/VB/AccControl/FrmMoreTime.resx new file mode 100644 index 0000000..cf27f6e --- /dev/null +++ b/Chapter 07/VB/AccControl/FrmMoreTime.resx @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + FrmMoreTime + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 07/VB/AccControl/FrmMoreTime.vb b/Chapter 07/VB/AccControl/FrmMoreTime.vb new file mode 100644 index 0000000..614ebde --- /dev/null +++ b/Chapter 07/VB/AccControl/FrmMoreTime.vb @@ -0,0 +1,158 @@ +Imports System.ComponentModel + +Public Class FrmMoreTime + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + _ +Public Sub New(ByVal CurrentTime As Int32) + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + ' Initize the current time value. + lblCurrentTime.Text = "The Current Time is: " + CurrentTime.ToString() + + ' Initialize the up/down control value. + txtNewValue.Value = CurrentTime + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents MoreTimeToolTip As System.Windows.Forms.ToolTip + Friend WithEvents txtNewValue As System.Windows.Forms.NumericUpDown + Friend WithEvents label2 As System.Windows.Forms.Label + Friend WithEvents lblCurrentTime As System.Windows.Forms.Label + Friend WithEvents btnCancel As System.Windows.Forms.Button + Friend WithEvents btnOK As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.MoreTimeToolTip = New System.Windows.Forms.ToolTip(Me.components) + Me.txtNewValue = New System.Windows.Forms.NumericUpDown + Me.label2 = New System.Windows.Forms.Label + Me.lblCurrentTime = New System.Windows.Forms.Label + Me.btnCancel = New System.Windows.Forms.Button + Me.btnOK = New System.Windows.Forms.Button + CType(Me.txtNewValue, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'txtNewValue + ' + Me.txtNewValue.AccessibleDescription = "Use this control to change the value of the timer interval in seconds." + Me.txtNewValue.AccessibleName = "Timer Value Change" + Me.txtNewValue.AccessibleRole = System.Windows.Forms.AccessibleRole.SpinButton + Me.txtNewValue.Location = New System.Drawing.Point(8, 88) + Me.txtNewValue.Name = "txtNewValue" + Me.txtNewValue.TabIndex = 5 + Me.MoreTimeToolTip.SetToolTip(Me.txtNewValue, "Use this control to change the value of the timer interval in seconds.") + ' + 'label2 + ' + Me.label2.Location = New System.Drawing.Point(8, 64) + Me.label2.Name = "label2" + Me.label2.TabIndex = 4 + Me.label2.Text = "&New Timer Value" + ' + 'lblCurrentTime + ' + Me.lblCurrentTime.AccessibleDescription = "This label tells how many seconds are left on the current timer." + Me.lblCurrentTime.AccessibleName = "Current Timer Value" + Me.lblCurrentTime.AccessibleRole = System.Windows.Forms.AccessibleRole.StaticText + Me.lblCurrentTime.Location = New System.Drawing.Point(8, 16) + Me.lblCurrentTime.Name = "lblCurrentTime" + Me.lblCurrentTime.Size = New System.Drawing.Size(176, 40) + Me.lblCurrentTime.TabIndex = 8 + Me.lblCurrentTime.Text = "label1" + Me.MoreTimeToolTip.SetToolTip(Me.lblCurrentTime, "This label tells how many seconds are left on the current timer.") + ' + 'btnCancel + ' + Me.btnCancel.AccessibleDescription = "This button cancels any change to the timer value." + Me.btnCancel.AccessibleName = "Timer Value Change Cancel" + Me.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnCancel.Location = New System.Drawing.Point(208, 40) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.TabIndex = 7 + Me.btnCancel.Text = "&Cancel" + Me.MoreTimeToolTip.SetToolTip(Me.btnCancel, "This button cancels any change to the timer value.") + ' + 'btnOK + ' + Me.btnOK.AccessibleDescription = "This button accepts the changed time value." + Me.btnOK.AccessibleName = "Timer Value Change Accept" + Me.btnOK.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK + Me.btnOK.Location = New System.Drawing.Point(208, 8) + Me.btnOK.Name = "btnOK" + Me.btnOK.TabIndex = 6 + Me.btnOK.Text = "&OK" + Me.MoreTimeToolTip.SetToolTip(Me.btnOK, "This button accepts the changed time value.") + ' + 'FrmMoreTime + ' + Me.AcceptButton = Me.btnOK + Me.AccessibleDescription = "This dialog box enables the user to add more time to the timer interval." + Me.AccessibleName = "Add Time to the Timer" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnCancel + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.txtNewValue) + Me.Controls.Add(Me.label2) + Me.Controls.Add(Me.lblCurrentTime) + Me.Controls.Add(Me.btnCancel) + Me.Controls.Add(Me.btnOK) + Me.Name = "FrmMoreTime" + Me.Text = "Add Time to the Timer" + Me.MoreTimeToolTip.SetToolTip(Me, "This dialog box enables the user to add more time to the timer interval.") + CType(Me.txtNewValue, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + ' Internal time track variable and associated public property. + Private _NewTime As Int32 + + '/ + '/ The new time value the user selected for the automatic + '/ click value. + '/ + _ + Public ReadOnly Property NewTime() As Int32 + Get + Return _NewTime + End Get + End Property + + Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click + ' Save the new value. + _NewTime = Convert.ToInt32(txtNewValue.Value) + + ' Exit the form. + Close() + End Sub + + Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click + ' Exit the form. + Close() + End Sub +End Class diff --git a/Chapter 07/VB/AccControl/TimerButton.vb b/Chapter 07/VB/AccControl/TimerButton.vb new file mode 100644 index 0000000..9707438 --- /dev/null +++ b/Chapter 07/VB/AccControl/TimerButton.vb @@ -0,0 +1,260 @@ +Imports System.ComponentModel +Imports System.Windows.Forms + +Namespace AccControl + Public Class TimerButton + Inherits Button +#Region "Private Variables" + ' Keeps track of the automatic button click time and the countdown + ' display time on the button. + Private CounterTimer As Timer + ' The context menu used to obtain more time. + Private mnuTimeSelect As ContextMenu + ' The More Time menu item. + Private mnuMoreTime As MenuItem + ' A tool tip that describes the countdown function. + Private TimeNote As ToolTip + ' Keeps track of the remaining time. + Private TimeLeft As Int32 + ' Determines if the button displays the count. + Private _CountdownEnabled As Boolean + ' Contains the TimerInterval property value. + Private _TimerInterval As Int32 + ' Contains the old timer caption. + Private _OldCaption As String + ' Determines if the timer is started. + Private _TimerStarted As Boolean + ' Determines if the user clicked the button or it automatically + ' clicked. + Private _AutoClick As Boolean + ' Tracks the state of the context menu. + Private _NoMoreTime As Boolean +#End Region + +#Region "Constructor" + _ + Public Sub New() + ' Create the countdown display timer. Set it to + ' display once a second. + CounterTimer = New Timer + AddHandler CounterTimer.Tick, AddressOf Me.CounterTimer_Tick + CounterTimer.Interval = 1000 + + ' Create the menu item. + mnuMoreTime = New MenuItem + mnuMoreTime.DefaultItem = True + mnuMoreTime.Index = 0 + mnuMoreTime.Text = "&More Time" + AddHandler mnuMoreTime.Click, AddressOf Me.mnuMoreTime_Click + + ' Create the context menu and add the menu item. + mnuTimeSelect = New ContextMenu(New MenuItem() {mnuMoreTime}) + + ' Create the tool tip. + TimeNote = New ToolTip + TimeNote.SetToolTip( _ + Me, _ + "This is a timed button. Right click the button and choose " + _ + "More Time from the context menu to change the time " + _ + "interval.") + + ' Add the features to the control. + Me.ContextMenu = mnuTimeSelect + Me.Text = "TimerButton" + + ' Initialize the property values. + _CountdownEnabled = True + _TimerInterval = 15 + _AutoClick = False + _TimerStarted = False + _NoMoreTime = False + End Sub +#End Region + +#Region "TimedButton Properties" + _ + Public Property TimerInterval() As Int32 + Get + Return _TimerInterval + End Get + Set(ByVal Value As Int32) + If (Value > 0) Then + _TimerInterval = Value + End If + End Set + End Property + + + _ + Public Property CountdownEnabled() As Boolean + Get + Return _CountdownEnabled + End Get + Set(ByVal Value As Boolean) + _CountdownEnabled = Value + End Set + End Property + + _ + Public ReadOnly Property TimerValue() As Int32 + Get + Return TimeLeft + End Get + End Property + + _ + Public ReadOnly Property TimerEnabled() As Boolean + Get + Return CounterTimer.Enabled + End Get + End Property + + _ + Public ReadOnly Property TimerStarted() As Boolean + Get + Return _TimerStarted + End Get + End Property + + _ + Public ReadOnly Property AutoClick() As Boolean + Get + Return _AutoClick + End Get + End Property + + _ + Public Property NoMoreTimeMenu() As Boolean + Get + Return _NoMoreTime + End Get + Set(ByVal Value As Boolean) + ' Provide special handling if the developer chooses to + ' turn the menu option off. + If (Value = True) Then + ' If the control is in design mode, make sure the + ' developer is aware of the effects of this choice. + If (Me.DesignMode) Then + ' Make sure the developer wants to make the change. + Dim Result As DialogResult + Result = MessageBox.Show( _ + "Setting this value to true will prevent " + _ + "the user from changing the timeout value. Do " + _ + "you want to make this change?", _ + "Value Change Warning", _ + MessageBoxButtons.YesNo, _ + MessageBoxIcon.Warning) + + ' If the deveveloper does want to make the change set + ' the property to true and turn off support for the + ' event handler. + If (Result = DialogResult.Yes) Then + _NoMoreTime = Value + Me.ContextMenu = Nothing + End If + Else + ' The control is not in design mode, so make the + ' required changes. + _NoMoreTime = Value + Me.ContextMenu = Nothing + End If + ' If the developer is returning the control to its default + ' value, then make the change. + Else + _NoMoreTime = Value + Me.ContextMenu = mnuTimeSelect + End If + End Set + End Property +#End Region + +#Region "TimedButton Methods" + _ + Public Sub TimerStart(ByVal Start As Boolean) + If (Start) Then + ' Reset the AutoClick property. + _AutoClick = False + + ' Save the old caption for later use. + _OldCaption = Me.Text + + ' Set the time keeper and the timer. + TimeLeft = _TimerInterval + CounterTimer.Start() + _TimerStarted = True + Else + ' Stop the timer. + CounterTimer.Stop() + + ' Restore the original caption. + Me.Text = _OldCaption + _TimerStarted = False + End If + End Sub + + _ + Public Sub AutoClickReset() + ' Reset the AutoClick value. + _AutoClick = False + End Sub +#End Region + +#Region "TimedButton Internal Event Handlers" + Private Sub CounterTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) + Dim EA As System.EventArgs ' Used When Raising an Event. + + ' Initialize the EventArgs. + EA = New EventArgs + + ' If the developer enables the count down function, then + ' display the remaining time as the button caption. + If (_CountdownEnabled) Then + Me.Text = "&Time: " + TimeLeft.ToString() + End If + + ' Click the button automatically when time expires. + If (TimeLeft = 0) Then + ' Turn the timer off. + CounterTimer.Stop() + + ' Set the result value to reflect an automatic click. + _AutoClick = True + + ' Fire the event. + OnClick(EA) + Else + ' Decrement the counter. + TimeLeft = TimeLeft - 1 + End If + End Sub + + Private Sub mnuMoreTime_Click(ByVal sender As Object, ByVal e As System.EventArgs) + ' Stop the timer so the user has time to make a change. + If (_TimerStarted) Then + CounterTimer.Stop() + End If + + ' Create an instance of the time change form. + Dim ChangeData As FrmMoreTime + ChangeData = New FrmMoreTime(TimeLeft) + + ' Display the form and obtain a result. + Dim MyResult As DialogResult + MyResult = ChangeData.ShowDialog(Me) + + ' If the user clicked OK, change the time value. + If (MyResult = DialogResult.OK) Then + TimeLeft = ChangeData.NewTime + End If + + ' Restart the timer so the button keeps track of the time. + If (_TimerStarted) Then + CounterTimer.Start() + End If + End Sub +#End Region + End Class +End Namespace diff --git a/Chapter 07/VB/AccControl/bin/AccControl.dll b/Chapter 07/VB/AccControl/bin/AccControl.dll new file mode 100644 index 0000000..19975aa Binary files /dev/null and b/Chapter 07/VB/AccControl/bin/AccControl.dll differ diff --git a/Chapter 07/VB/AccControl/obj/Debug/AccControl.FrmMoreTime.resources b/Chapter 07/VB/AccControl/obj/Debug/AccControl.FrmMoreTime.resources new file mode 100644 index 0000000..2eeb854 Binary files /dev/null and b/Chapter 07/VB/AccControl/obj/Debug/AccControl.FrmMoreTime.resources differ diff --git a/Chapter 07/VB/AccControl/obj/Debug/AccControl.dll b/Chapter 07/VB/AccControl/obj/Debug/AccControl.dll new file mode 100644 index 0000000..19975aa Binary files /dev/null and b/Chapter 07/VB/AccControl/obj/Debug/AccControl.dll differ diff --git a/Chapter 07/VB/AccControlTest/AccControlTest.sln b/Chapter 07/VB/AccControlTest/AccControlTest.sln new file mode 100644 index 0000000..77b3198 --- /dev/null +++ b/Chapter 07/VB/AccControlTest/AccControlTest.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AccControlTest", "AccControlTest.vbproj", "{E0ADBB31-71B6-4395-99B2-820266B16A1A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E0ADBB31-71B6-4395-99B2-820266B16A1A}.Debug.ActiveCfg = Debug|.NET + {E0ADBB31-71B6-4395-99B2-820266B16A1A}.Debug.Build.0 = Debug|.NET + {E0ADBB31-71B6-4395-99B2-820266B16A1A}.Release.ActiveCfg = Release|.NET + {E0ADBB31-71B6-4395-99B2-820266B16A1A}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 07/VB/AccControlTest/AccControlTest.suo b/Chapter 07/VB/AccControlTest/AccControlTest.suo new file mode 100644 index 0000000..f5b9bbf Binary files /dev/null and b/Chapter 07/VB/AccControlTest/AccControlTest.suo differ diff --git a/Chapter 07/VB/AccControlTest/AccControlTest.vbproj b/Chapter 07/VB/AccControlTest/AccControlTest.vbproj new file mode 100644 index 0000000..804265d --- /dev/null +++ b/Chapter 07/VB/AccControlTest/AccControlTest.vbproj @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 07/VB/AccControlTest/AccControlTest.vbproj.user b/Chapter 07/VB/AccControlTest/AccControlTest.vbproj.user new file mode 100644 index 0000000..d77431b --- /dev/null +++ b/Chapter 07/VB/AccControlTest/AccControlTest.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 07/VB/AccControlTest/AssemblyInfo.vb b/Chapter 07/VB/AccControlTest/AssemblyInfo.vb new file mode 100644 index 0000000..30bdb18 --- /dev/null +++ b/Chapter 07/VB/AccControlTest/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 07/VB/AccControlTest/FrmMain.resx b/Chapter 07/VB/AccControlTest/FrmMain.resx new file mode 100644 index 0000000..fefa09d --- /dev/null +++ b/Chapter 07/VB/AccControlTest/FrmMain.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + frmMain + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 07/VB/AccControlTest/FrmMain.vb b/Chapter 07/VB/AccControlTest/FrmMain.vb new file mode 100644 index 0000000..6600213 --- /dev/null +++ b/Chapter 07/VB/AccControlTest/FrmMain.vb @@ -0,0 +1,139 @@ +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ToolTip As System.Windows.Forms.ToolTip + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents btnStart As System.Windows.Forms.Button + Friend WithEvents btnTimer As AccControl.AccControl.TimerButton + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.btnTimer = New AccControl.AccControl.TimerButton + Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components) + Me.btnQuit = New System.Windows.Forms.Button + Me.btnStart = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'btnTimer + ' + Me.btnTimer.AccessibleDescription = "This button tests the TimerButton control." + Me.btnTimer.AccessibleName = "TimerButton Test" + Me.btnTimer.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTimer.CountdownEnabled = True + Me.btnTimer.Location = New System.Drawing.Point(208, 40) + Me.btnTimer.Name = "btnTimer" + Me.btnTimer.NoMoreTimeMenu = False + Me.btnTimer.TabIndex = 1 + Me.btnTimer.Text = "&Test" + Me.btnTimer.TimerInterval = 15 + Me.ToolTip.SetToolTip(Me.btnTimer, "This button tests the TimerButton control.") + ' + 'ToolTip + ' + Me.ToolTip.AutoPopDelay = 7000 + Me.ToolTip.InitialDelay = 500 + Me.ToolTip.ReshowDelay = 100 + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Exit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 72) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 2 + Me.btnQuit.Text = "&Quit" + Me.ToolTip.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'btnStart + ' + Me.btnStart.AccessibleDescription = "This button starts the timer." + Me.btnStart.AccessibleName = "Timer Start" + Me.btnStart.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnStart.Location = New System.Drawing.Point(208, 8) + Me.btnStart.Name = "btnStart" + Me.btnStart.TabIndex = 0 + Me.btnStart.Text = "&Start Timer" + Me.ToolTip.SetToolTip(Me.btnStart, "This button starts the timer.") + ' + 'frmMain + ' + Me.AcceptButton = Me.btnStart + Me.AccessibleDescription = "This application tests the functionality of the TimerButton control." + Me.AccessibleName = "Accessible Control Test" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.btnQuit) + Me.Controls.Add(Me.btnStart) + Me.Controls.Add(Me.btnTimer) + Me.Name = "frmMain" + Me.Text = "Accessible Control Test" + Me.ToolTip.SetToolTip(Me, "This application tests the functionality of the TimerButton control.") + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + ' Exit the application. + End + End Sub + + Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click + btnTimer.TimerStart(True) + End Sub + + Private Sub btnTimer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimer.Click + ' Turn the timer off. + If (btnTimer.TimerStarted) Then + btnTimer.TimerStart(False) + + ' Display a message box. + If (btnTimer.AutoClick) Then + MessageBox.Show("The button automatically clicked", _ + "Click Event", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + Else + MessageBox.Show("The user clicked the button.", _ + "Click Event", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End If + End If + + ' Reset the AutoClick property. + btnTimer.AutoClickReset() + End Sub +End Class diff --git a/Chapter 07/VB/AccControlTest/bin/AccControlTest.exe b/Chapter 07/VB/AccControlTest/bin/AccControlTest.exe new file mode 100644 index 0000000..0d3c64a Binary files /dev/null and b/Chapter 07/VB/AccControlTest/bin/AccControlTest.exe differ diff --git a/Chapter 07/VB/AccControlTest/bin/acccontrol.dll b/Chapter 07/VB/AccControlTest/bin/acccontrol.dll new file mode 100644 index 0000000..19975aa Binary files /dev/null and b/Chapter 07/VB/AccControlTest/bin/acccontrol.dll differ diff --git a/Chapter 07/VB/AccControlTest/obj/Debug/AccControlTest.exe b/Chapter 07/VB/AccControlTest/obj/Debug/AccControlTest.exe new file mode 100644 index 0000000..0d3c64a Binary files /dev/null and b/Chapter 07/VB/AccControlTest/obj/Debug/AccControlTest.exe differ diff --git a/Chapter 07/VB/AccControlTest/obj/Debug/AccControlTest.frmMain.resources b/Chapter 07/VB/AccControlTest/obj/Debug/AccControlTest.frmMain.resources new file mode 100644 index 0000000..db94694 Binary files /dev/null and b/Chapter 07/VB/AccControlTest/obj/Debug/AccControlTest.frmMain.resources differ diff --git a/Chapter 07/VB/ContextHelp/AssemblyInfo.vb b/Chapter 07/VB/ContextHelp/AssemblyInfo.vb new file mode 100644 index 0000000..a96db10 --- /dev/null +++ b/Chapter 07/VB/ContextHelp/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 07/VB/ContextHelp/ContextHelp.sln b/Chapter 07/VB/ContextHelp/ContextHelp.sln new file mode 100644 index 0000000..5d498f2 --- /dev/null +++ b/Chapter 07/VB/ContextHelp/ContextHelp.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ContextHelp", "ContextHelp.vbproj", "{6462D04C-D173-4568-9445-C4F77CF4760C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {6462D04C-D173-4568-9445-C4F77CF4760C}.Debug.ActiveCfg = Debug|.NET + {6462D04C-D173-4568-9445-C4F77CF4760C}.Debug.Build.0 = Debug|.NET + {6462D04C-D173-4568-9445-C4F77CF4760C}.Release.ActiveCfg = Release|.NET + {6462D04C-D173-4568-9445-C4F77CF4760C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 07/VB/ContextHelp/ContextHelp.suo b/Chapter 07/VB/ContextHelp/ContextHelp.suo new file mode 100644 index 0000000..f960fc7 Binary files /dev/null and b/Chapter 07/VB/ContextHelp/ContextHelp.suo differ diff --git a/Chapter 07/VB/ContextHelp/ContextHelp.vbproj b/Chapter 07/VB/ContextHelp/ContextHelp.vbproj new file mode 100644 index 0000000..cf00451 --- /dev/null +++ b/Chapter 07/VB/ContextHelp/ContextHelp.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 07/VB/ContextHelp/ContextHelp.vbproj.user b/Chapter 07/VB/ContextHelp/ContextHelp.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 07/VB/ContextHelp/ContextHelp.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 07/VB/ContextHelp/FrmMain.resx b/Chapter 07/VB/ContextHelp/FrmMain.resx new file mode 100644 index 0000000..11013aa --- /dev/null +++ b/Chapter 07/VB/ContextHelp/FrmMain.resx @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + 127, 17 + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + frmMain + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 07/VB/ContextHelp/FrmMain.vb b/Chapter 07/VB/ContextHelp/FrmMain.vb new file mode 100644 index 0000000..9b77b9f --- /dev/null +++ b/Chapter 07/VB/ContextHelp/FrmMain.vb @@ -0,0 +1,149 @@ +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ControlHelp As System.Windows.Forms.HelpProvider + Friend WithEvents ControlToolTip As System.Windows.Forms.ToolTip + Friend WithEvents txtMessage As System.Windows.Forms.TextBox + Friend WithEvents label1 As System.Windows.Forms.Label + Friend WithEvents btnTest As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.ControlHelp = New System.Windows.Forms.HelpProvider + Me.ControlToolTip = New System.Windows.Forms.ToolTip(Me.components) + Me.txtMessage = New System.Windows.Forms.TextBox + Me.label1 = New System.Windows.Forms.Label + Me.btnTest = New System.Windows.Forms.Button + Me.btnQuit = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'ControlHelp + ' + Me.ControlHelp.HelpNamespace = "D:\0125 - Source Code\Chapter 07\HelpFiles\ContextHelp.chm" + ' + 'txtMessage + ' + Me.txtMessage.AccessibleDescription = "Contains the test message that you want to display." + Me.txtMessage.AccessibleName = "Test Message Entry" + Me.txtMessage.AccessibleRole = System.Windows.Forms.AccessibleRole.Text + Me.ControlHelp.SetHelpKeyword(Me.txtMessage, "Test Message Field") + Me.ControlHelp.SetHelpNavigator(Me.txtMessage, System.Windows.Forms.HelpNavigator.Index) + Me.ControlHelp.SetHelpString(Me.txtMessage, "This is the Test Message data field. It contains the test message displayed when " & _ + "you click the Test button.") + Me.txtMessage.Location = New System.Drawing.Point(8, 32) + Me.txtMessage.Name = "txtMessage" + Me.ControlHelp.SetShowHelp(Me.txtMessage, True) + Me.txtMessage.Size = New System.Drawing.Size(168, 20) + Me.txtMessage.TabIndex = 4 + Me.txtMessage.Text = "This is a test message." + Me.ControlToolTip.SetToolTip(Me.txtMessage, "Contains the test message that you want to display.") + ' + 'label1 + ' + Me.label1.Location = New System.Drawing.Point(8, 8) + Me.label1.Name = "label1" + Me.label1.TabIndex = 3 + Me.label1.Text = "Test &Message" + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button starts the test function of the application." + Me.btnTest.AccessibleName = "Application Test" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.ControlHelp.SetHelpKeyword(Me.btnTest, "Test Button") + Me.ControlHelp.SetHelpNavigator(Me.btnTest, System.Windows.Forms.HelpNavigator.Index) + Me.ControlHelp.SetHelpString(Me.btnTest, "This is the Test button. You use it to test the application. Modify the Test Mess" & _ + "age data field to change the message.") + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.ControlHelp.SetShowHelp(Me.btnTest, True) + Me.btnTest.TabIndex = 5 + Me.btnTest.Text = "&Test" + Me.ControlToolTip.SetToolTip(Me.btnTest, "This button starts the test function of the application.") + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Quit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.ControlHelp.SetHelpKeyword(Me.btnQuit, "Quit Button") + Me.ControlHelp.SetHelpNavigator(Me.btnQuit, System.Windows.Forms.HelpNavigator.Index) + Me.ControlHelp.SetHelpString(Me.btnQuit, "This is the Quit button. You use it to exit the application.") + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.ControlHelp.SetShowHelp(Me.btnQuit, True) + Me.btnQuit.TabIndex = 6 + Me.btnQuit.Text = "&Quit" + Me.ControlToolTip.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'frmMain + ' + Me.AcceptButton = Me.btnTest + Me.AccessibleDescription = "This application demonstrates the use of context sensitive help." + Me.AccessibleName = "Context Sensitive Help Demonstration" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.txtMessage) + Me.Controls.Add(Me.label1) + Me.Controls.Add(Me.btnTest) + Me.Controls.Add(Me.btnQuit) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.HelpButton = True + Me.ControlHelp.SetHelpKeyword(Me, "Overview") + Me.ControlHelp.SetHelpString(Me, "Overview") + Me.KeyPreview = True + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "frmMain" + Me.ControlHelp.SetShowHelp(Me, True) + Me.Text = "Form1" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + ' Exit the application. + End + End Sub + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + ' Display the message box. + MessageBox.Show(txtMessage.Text, _ + "Test Message", _ + MessageBoxButtons.OK, _ + MessageBoxIcon.Information) + End Sub +End Class diff --git a/Chapter 07/VB/ContextHelp/bin/ContextHelp.chm b/Chapter 07/VB/ContextHelp/bin/ContextHelp.chm new file mode 100644 index 0000000..c089314 Binary files /dev/null and b/Chapter 07/VB/ContextHelp/bin/ContextHelp.chm differ diff --git a/Chapter 07/VB/ContextHelp/bin/ContextHelp.exe b/Chapter 07/VB/ContextHelp/bin/ContextHelp.exe new file mode 100644 index 0000000..fdbc901 Binary files /dev/null and b/Chapter 07/VB/ContextHelp/bin/ContextHelp.exe differ diff --git a/Chapter 07/VB/ContextHelp/obj/Debug/ContextHelp.exe b/Chapter 07/VB/ContextHelp/obj/Debug/ContextHelp.exe new file mode 100644 index 0000000..fdbc901 Binary files /dev/null and b/Chapter 07/VB/ContextHelp/obj/Debug/ContextHelp.exe differ diff --git a/Chapter 07/VB/ContextHelp/obj/Debug/ContextHelp.frmMain.resources b/Chapter 07/VB/ContextHelp/obj/Debug/ContextHelp.frmMain.resources new file mode 100644 index 0000000..0410da8 Binary files /dev/null and b/Chapter 07/VB/ContextHelp/obj/Debug/ContextHelp.frmMain.resources differ diff --git a/Chapter 07/VB/HelpFiles/ContextHelp.chm b/Chapter 07/VB/HelpFiles/ContextHelp.chm new file mode 100644 index 0000000..c089314 Binary files /dev/null and b/Chapter 07/VB/HelpFiles/ContextHelp.chm differ diff --git a/Chapter 07/VB/HelpFiles/ContextHelp.hhp b/Chapter 07/VB/HelpFiles/ContextHelp.hhp new file mode 100644 index 0000000..8f4ebb8 --- /dev/null +++ b/Chapter 07/VB/HelpFiles/ContextHelp.hhp @@ -0,0 +1,23 @@ +[OPTIONS] +Binary Index=No +Compatibility=1.1 or later +Compiled file=ContextHelp.chm +Contents file=Table of Contents.hhc +Default topic=TestButton.htm +Display compile progress=Yes +Full-text search=Yes +Index file=Index.hhk +Language=0x409 English (United States) +Title=A Simple Context Sensitive Help File Example + + +[FILES] +TestButton.htm +Overview.htm +QuitButton.htm +TestMessage.htm + +[INFOTYPES] +Category:Test Button +CategoryDesc:Learn about the Test button. + diff --git a/Chapter 07/VB/HelpFiles/Index.hhk b/Chapter 07/VB/HelpFiles/Index.hhk new file mode 100644 index 0000000..0681a80 --- /dev/null +++ b/Chapter 07/VB/HelpFiles/Index.hhk @@ -0,0 +1,35 @@ + + + + + + +
    +
  • + + + + + + + + + + +
  • + + + + +
  • + + + + +
  • + + + + +
+ diff --git a/Chapter 07/VB/HelpFiles/Overview.htm b/Chapter 07/VB/HelpFiles/Overview.htm new file mode 100644 index 0000000..6379ff5 --- /dev/null +++ b/Chapter 07/VB/HelpFiles/Overview.htm @@ -0,0 +1,27 @@ + + + + Overview + + + +

Context Sensitive Help Overview

+

Description

+ This application demonstrates the techniques you need to know to add context + sensitive help. Make sure you begin by creating a help file such as the one + created for this application. Add this help file to a HelpProvider control. + Once you have the HelpProvider in place, add entries to the HelpKeyword, + HelpNavigator, and HelpString properties for each control or field on the form. +

Other Topics

+

This application includes the following controls and fields:

+ +

More Information

+ Talk to your manager or your managed about local usage questions. You can contact + John Mueller with questions regarding the + programming features of this application. + + diff --git a/Chapter 07/VB/HelpFiles/QuitButton.htm b/Chapter 07/VB/HelpFiles/QuitButton.htm new file mode 100644 index 0000000..4086e29 --- /dev/null +++ b/Chapter 07/VB/HelpFiles/QuitButton.htm @@ -0,0 +1,16 @@ + + + + +Using the Quit Button + + +

Quit Button Description

+The Quit button is the cancel button for this application. Click the Quit button +when you want to exit this application. You should click this button only when you're +finished using the application. Contact your network administrator if you have questions +about using this button. +

More Information

+None + + diff --git a/Chapter 07/VB/HelpFiles/Table of Contents.hhc b/Chapter 07/VB/HelpFiles/Table of Contents.hhc new file mode 100644 index 0000000..7f41044 --- /dev/null +++ b/Chapter 07/VB/HelpFiles/Table of Contents.hhc @@ -0,0 +1,34 @@ + + + + + + + + + + +
    +
  • + + +
      +
    • + + + +
    • + + + +
    • + + + +
    • + + + +
    +
+ diff --git a/Chapter 07/VB/HelpFiles/TestButton.htm b/Chapter 07/VB/HelpFiles/TestButton.htm new file mode 100644 index 0000000..eecc1aa --- /dev/null +++ b/Chapter 07/VB/HelpFiles/TestButton.htm @@ -0,0 +1,13 @@ + + + + +Using the Test Button + + +

Test Button Description

+The Test button is the default button for this application. Click the Test button to display the test dialog box for this application. The content of the test dialog box is controled by the Test Message data field. You should click this button only when you want to test the application. Contact your network administrator if you have questions about using this button. +

More Information

+See the Test Message data field entry for additional information. + + diff --git a/Chapter 07/VB/HelpFiles/TestMessage.htm b/Chapter 07/VB/HelpFiles/TestMessage.htm new file mode 100644 index 0000000..ef6ff63 --- /dev/null +++ b/Chapter 07/VB/HelpFiles/TestMessage.htm @@ -0,0 +1,17 @@ + + + + +Using the Test Message Data Field + + +

Test Message Data Field Description

+The Test Message data field contains the text that will appear in the message box +produced when the user clicks the Test button. Type text in the Test Message data +field to modify the output of the application. Type a new message whenever you feel +the need to modify the application output. Contact your network administrator if you +have questions about using this data field. +

More Information

+See the Test button entry for additional information. + + diff --git a/Chapter 08/C#/MSAgent/App.ico b/Chapter 08/C#/MSAgent/App.ico new file mode 100644 index 0000000..3a5525f Binary files /dev/null and b/Chapter 08/C#/MSAgent/App.ico differ diff --git a/Chapter 08/C#/MSAgent/AssemblyInfo.cs b/Chapter 08/C#/MSAgent/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Chapter 08/C#/MSAgent/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 08/C#/MSAgent/FrmMain.cs b/Chapter 08/C#/MSAgent/FrmMain.cs new file mode 100644 index 0000000..d2798b4 --- /dev/null +++ b/Chapter 08/C#/MSAgent/FrmMain.cs @@ -0,0 +1,215 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace MSAgent +{ + /// + /// Summary description for Form1. + /// + public class frmMain : System.Windows.Forms.Form + { + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.Button btnQuit; + private AxAgentObjects.AxAgent TestAgent; + private System.Windows.Forms.ToolTip ApplicationTT; + private System.ComponentModel.IContainer components; + + public frmMain() + { + IEnumerator AniList; // List of animations. + String Voice; // The current voice. + String WinFolder; // Windows Folder + + // Required for Windows Form Designer support + InitializeComponent(); + + // Obtain the Windows folder location. + WinFolder = + Environment.SystemDirectory.Substring( + 0, + Environment.SystemDirectory.IndexOf("System32")); + + // Try loading a character. + TestAgent.Characters.Load( + "Merlin", + @WinFolder + @"MSAgent\Chars\Merlin.acs"); + + // Make the character the current speaker. + CurrentSpeaker = TestAgent.Characters["Merlin"]; + + // Get the animation list for this character. + AniList = TestAgent.Characters["Merlin"].AnimationNames.GetEnumerator(); + + // Load the animation list into the CurrentSpeaker command + // list. + while (AniList.MoveNext()) + { + Voice = (String)AniList.Current; + Voice = Voice.Replace("_", "underscore"); + CurrentSpeaker.Commands.Add((String)AniList.Current, + AniList.Current, + Voice, + true, + false); + } + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain)); + this.btnTest = new System.Windows.Forms.Button(); + this.btnQuit = new System.Windows.Forms.Button(); + this.TestAgent = new AxAgentObjects.AxAgent(); + this.ApplicationTT = new System.Windows.Forms.ToolTip(this.components); + ((System.ComponentModel.ISupportInitialize)(this.TestAgent)).BeginInit(); + this.SuspendLayout(); + // + // btnTest + // + this.btnTest.AccessibleDescription = "This button starts the test function of the application."; + this.btnTest.AccessibleName = "Application Test"; + this.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTest.Location = new System.Drawing.Point(208, 8); + this.btnTest.Name = "btnTest"; + this.btnTest.TabIndex = 3; + this.btnTest.Text = "&Test"; + this.ApplicationTT.SetToolTip(this.btnTest, "This button starts the test function of the application."); + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // btnQuit + // + this.btnQuit.AccessibleDescription = "This button exits the application."; + this.btnQuit.AccessibleName = "Application Quit"; + this.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnQuit.Location = new System.Drawing.Point(208, 40); + this.btnQuit.Name = "btnQuit"; + this.btnQuit.TabIndex = 4; + this.btnQuit.Text = "&Quit"; + this.ApplicationTT.SetToolTip(this.btnQuit, "This button exits the application."); + this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click); + // + // TestAgent + // + this.TestAgent.AccessibleDescription = "This is the Microsoft Agent control for this application."; + this.TestAgent.AccessibleName = "Test Microsoft Agent"; + this.TestAgent.Enabled = true; + this.TestAgent.Location = new System.Drawing.Point(248, 224); + this.TestAgent.Name = "TestAgent"; + this.TestAgent.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("TestAgent.OcxState"))); + this.TestAgent.Size = new System.Drawing.Size(32, 32); + this.TestAgent.TabIndex = 5; + this.ApplicationTT.SetToolTip(this.TestAgent, "This is the Microsoft Agent control for this application."); + // + // ApplicationTT + // + this.ApplicationTT.AutomaticDelay = 300; + this.ApplicationTT.AutoPopDelay = 7000; + this.ApplicationTT.InitialDelay = 300; + this.ApplicationTT.ReshowDelay = 60; + // + // frmMain + // + this.AccessibleDescription = "This application demonstrates the techniques needed to use Microsoft Agent."; + this.AccessibleName = "Microsoft Agent Example"; + this.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(292, 266); + this.Controls.Add(this.TestAgent); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.btnQuit); + this.Name = "frmMain"; + this.Text = "Microsoft Agent Example"; + this.ApplicationTT.SetToolTip(this, "This application demonstrates the techniques needed to use Microsoft Agent."); + ((System.ComponentModel.ISupportInitialize)(this.TestAgent)).EndInit(); + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new frmMain()); + } + + private void btnQuit_Click(object sender, System.EventArgs e) + { + // Exit the application. + Close(); + } + + // Create a speaker object for MS Agent. + AgentObjects.IAgentCtlCharacter CurrentSpeaker; + + private void btnTest_Click(object sender, System.EventArgs e) + { + // Display the speaker. + CurrentSpeaker.Show(0); + + // Move to the center of the display. + CurrentSpeaker.MoveTo( + Convert.ToInt16(SystemInformation.WorkingArea.Width/2), + Convert.ToInt16(SystemInformation.WorkingArea.Height/2), + 100); + + // Greet the user. + CurrentSpeaker.Play("Announce"); + CurrentSpeaker.Play("RestPose"); + CurrentSpeaker.Speak("\\map=\"What you hear is not what you " + + "see!\"=\"Hello World\"\\", ""); + CurrentSpeaker.Play("Greet"); + + // Tell the character to pull rabbit from hat. + CurrentSpeaker.Play("RestPose"); + CurrentSpeaker.Speak("Want to see me pull a rabbit from my hat?", + ""); + CurrentSpeaker.Play("DoMagic1"); + CurrentSpeaker.Play("DoMagic2"); + + // The the character to express surprise that the user doesn't + // want to see the magic trick. + CurrentSpeaker.Play("Surprised"); + CurrentSpeaker.Play("Confused"); + CurrentSpeaker.Play("RestPose"); + CurrentSpeaker.Speak("That trick never works!", ""); + CurrentSpeaker.Play("Sad"); + + // Goodbye. + CurrentSpeaker.Play("RestPose"); + CurrentSpeaker.Speak("Goodbye", ""); + CurrentSpeaker.Play("Wave"); + + // Hide the character. + CurrentSpeaker.Hide(0); + } + } +} diff --git a/Chapter 08/C#/MSAgent/FrmMain.resx b/Chapter 08/C#/MSAgent/FrmMain.resx new file mode 100644 index 0000000..66da6e3 --- /dev/null +++ b/Chapter 08/C#/MSAgent/FrmMain.resx @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Private + + + Private + + + False + + + Private + + + Private + + + Private + + + False + + + Private + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuNTAw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAIQAA + AAIBAAAAAQAAAAAAAAAAAAAAAAwAAAACAgAATwMAAE8DAAAL + + + + Private + + + 17, 17 + + + Private + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + frmMain + + + Private + + \ No newline at end of file diff --git a/Chapter 08/C#/MSAgent/MSAgent.csproj b/Chapter 08/C#/MSAgent/MSAgent.csproj new file mode 100644 index 0000000..7f8b8b0 --- /dev/null +++ b/Chapter 08/C#/MSAgent/MSAgent.csproj @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 08/C#/MSAgent/MSAgent.csproj.user b/Chapter 08/C#/MSAgent/MSAgent.csproj.user new file mode 100644 index 0000000..dca7b31 --- /dev/null +++ b/Chapter 08/C#/MSAgent/MSAgent.csproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 08/C#/MSAgent/MSAgent.sln b/Chapter 08/C#/MSAgent/MSAgent.sln new file mode 100644 index 0000000..d55190c --- /dev/null +++ b/Chapter 08/C#/MSAgent/MSAgent.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSAgent", "MSAgent.csproj", "{22BB5545-EA11-4847-986D-D265176A6190}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {22BB5545-EA11-4847-986D-D265176A6190}.Debug.ActiveCfg = Debug|.NET + {22BB5545-EA11-4847-986D-D265176A6190}.Debug.Build.0 = Debug|.NET + {22BB5545-EA11-4847-986D-D265176A6190}.Release.ActiveCfg = Release|.NET + {22BB5545-EA11-4847-986D-D265176A6190}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 08/C#/MSAgent/MSAgent.suo b/Chapter 08/C#/MSAgent/MSAgent.suo new file mode 100644 index 0000000..d766c48 Binary files /dev/null and b/Chapter 08/C#/MSAgent/MSAgent.suo differ diff --git a/Chapter 08/C#/MSAgent/bin/Debug/AxInterop.AgentObjects.dll b/Chapter 08/C#/MSAgent/bin/Debug/AxInterop.AgentObjects.dll new file mode 100644 index 0000000..7f19345 Binary files /dev/null and b/Chapter 08/C#/MSAgent/bin/Debug/AxInterop.AgentObjects.dll differ diff --git a/Chapter 08/C#/MSAgent/bin/Debug/Interop.AgentObjects.dll b/Chapter 08/C#/MSAgent/bin/Debug/Interop.AgentObjects.dll new file mode 100644 index 0000000..a303602 Binary files /dev/null and b/Chapter 08/C#/MSAgent/bin/Debug/Interop.AgentObjects.dll differ diff --git a/Chapter 08/C#/MSAgent/bin/Debug/MSAgent.exe b/Chapter 08/C#/MSAgent/bin/Debug/MSAgent.exe new file mode 100644 index 0000000..a45b1b1 Binary files /dev/null and b/Chapter 08/C#/MSAgent/bin/Debug/MSAgent.exe differ diff --git a/Chapter 08/C#/MSAgent/obj/AxInterop.AgentObjects.dll b/Chapter 08/C#/MSAgent/obj/AxInterop.AgentObjects.dll new file mode 100644 index 0000000..7f19345 Binary files /dev/null and b/Chapter 08/C#/MSAgent/obj/AxInterop.AgentObjects.dll differ diff --git a/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.exe b/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.exe new file mode 100644 index 0000000..a45b1b1 Binary files /dev/null and b/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.exe differ diff --git a/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.frmMain.resources b/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.frmMain.resources new file mode 100644 index 0000000..d876850 Binary files /dev/null and b/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.frmMain.resources differ diff --git a/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.projdata b/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.projdata new file mode 100644 index 0000000..bb3e5c8 Binary files /dev/null and b/Chapter 08/C#/MSAgent/obj/Debug/MSAgent.projdata differ diff --git a/Chapter 08/C#/MSAgent/obj/Interop.AgentObjects.dll b/Chapter 08/C#/MSAgent/obj/Interop.AgentObjects.dll new file mode 100644 index 0000000..a303602 Binary files /dev/null and b/Chapter 08/C#/MSAgent/obj/Interop.AgentObjects.dll differ diff --git a/Chapter 08/C#/MSAgent/obj/Interop.SpeechLib.dll b/Chapter 08/C#/MSAgent/obj/Interop.SpeechLib.dll new file mode 100644 index 0000000..8324f90 Binary files /dev/null and b/Chapter 08/C#/MSAgent/obj/Interop.SpeechLib.dll differ diff --git a/Chapter 08/VB/MSAgent/AssemblyInfo.vb b/Chapter 08/VB/MSAgent/AssemblyInfo.vb new file mode 100644 index 0000000..d7fbd51 --- /dev/null +++ b/Chapter 08/VB/MSAgent/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports 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. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' 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: + + diff --git a/Chapter 08/VB/MSAgent/FrmMain.resx b/Chapter 08/VB/MSAgent/FrmMain.resx new file mode 100644 index 0000000..49c79ed --- /dev/null +++ b/Chapter 08/VB/MSAgent/FrmMain.resx @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuNTAw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAIQAA + AAIBAAAAAQAAAAAAAAAAAAAAAAwAAAACAgAATwMAAE8DAAAL + + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + frmMain + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Chapter 08/VB/MSAgent/FrmMain.vb b/Chapter 08/VB/MSAgent/FrmMain.vb new file mode 100644 index 0000000..3b9be0b --- /dev/null +++ b/Chapter 08/VB/MSAgent/FrmMain.vb @@ -0,0 +1,189 @@ +Public Class frmMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + Dim AniList As IEnumerator ' List of animations. + Dim Voice As String ' The current voice. + Dim WinFolder As String ' Windows Folder + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + ' Obtain the Windows folder location. + WinFolder = _ + Environment.SystemDirectory.Substring( _ + 0, _ + Environment.SystemDirectory.IndexOf("System32")) + + ' Try loading a character. + TestAgent.Characters.Load( _ + "Merlin", _ + WinFolder + "MSAgent\Chars\Merlin.acs") + + ' Make the character the current speaker. + CurrentSpeaker = TestAgent.Characters("Merlin") + + ' Get the animation list for this character. + AniList = TestAgent.Characters("Merlin").AnimationNames.GetEnumerator() + + ' Load the animation list into the CurrentSpeaker command + ' list. + While (AniList.MoveNext()) + Voice = AniList.Current + Voice = Voice.Replace("_", "underscore") + CurrentSpeaker.Commands.Add(AniList.Current, _ + AniList.Current, _ + Voice, _ + True, _ + False) + End While + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents ApplicationTT As System.Windows.Forms.ToolTip + Friend WithEvents btnTest As System.Windows.Forms.Button + Friend WithEvents btnQuit As System.Windows.Forms.Button + Friend WithEvents TestAgent As AxAgentObjects.AxAgent + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain)) + Me.ApplicationTT = New System.Windows.Forms.ToolTip(Me.components) + Me.btnTest = New System.Windows.Forms.Button + Me.btnQuit = New System.Windows.Forms.Button + Me.TestAgent = New AxAgentObjects.AxAgent + CType(Me.TestAgent, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'ApplicationTT + ' + Me.ApplicationTT.AutomaticDelay = 300 + Me.ApplicationTT.AutoPopDelay = 7000 + Me.ApplicationTT.InitialDelay = 300 + Me.ApplicationTT.ReshowDelay = 60 + ' + 'btnTest + ' + Me.btnTest.AccessibleDescription = "This button starts the test function of the application." + Me.btnTest.AccessibleName = "Application Test" + Me.btnTest.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnTest.Location = New System.Drawing.Point(208, 8) + Me.btnTest.Name = "btnTest" + Me.btnTest.TabIndex = 5 + Me.btnTest.Text = "&Test" + Me.ApplicationTT.SetToolTip(Me.btnTest, "This button starts the test function of the application.") + ' + 'btnQuit + ' + Me.btnQuit.AccessibleDescription = "This button exits the application." + Me.btnQuit.AccessibleName = "Application Quit" + Me.btnQuit.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton + Me.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnQuit.Location = New System.Drawing.Point(208, 40) + Me.btnQuit.Name = "btnQuit" + Me.btnQuit.TabIndex = 6 + Me.btnQuit.Text = "&Quit" + Me.ApplicationTT.SetToolTip(Me.btnQuit, "This button exits the application.") + ' + 'TestAgent + ' + Me.TestAgent.AccessibleDescription = "This is the Microsoft Agent control for this application." + Me.TestAgent.AccessibleName = "Test Microsoft Agent" + Me.TestAgent.Enabled = True + Me.TestAgent.Location = New System.Drawing.Point(256, 224) + Me.TestAgent.Name = "TestAgent" + Me.TestAgent.OcxState = CType(resources.GetObject("TestAgent.OcxState"), System.Windows.Forms.AxHost.State) + Me.TestAgent.Size = New System.Drawing.Size(32, 32) + Me.TestAgent.TabIndex = 8 + Me.ApplicationTT.SetToolTip(Me.TestAgent, "This is the Microsoft Agent control for this application.") + ' + 'frmMain + ' + Me.AcceptButton = Me.btnTest + Me.AccessibleDescription = "This application demonstrates the techniques needed to use Microsoft Agent." + Me.AccessibleName = "Microsoft Agent Example" + Me.AccessibleRole = System.Windows.Forms.AccessibleRole.Dialog + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.CancelButton = Me.btnQuit + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.TestAgent) + Me.Controls.Add(Me.btnTest) + Me.Controls.Add(Me.btnQuit) + Me.Name = "frmMain" + Me.Text = "Microsoft Agent Example" + Me.ApplicationTT.SetToolTip(Me, "This application demonstrates the techniques needed to use Microsoft Agent.") + CType(Me.TestAgent, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click + 'Exit the application. + End + End Sub + + ' Create a speaker object for MS Agent. + Private CurrentSpeaker As AgentObjects.IAgentCtlCharacter + + Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click + ' Display the speaker. + CurrentSpeaker.Show(0) + + ' Move to the center of the display. + CurrentSpeaker.MoveTo( _ + Convert.ToInt16(SystemInformation.WorkingArea.Width / 2), _ + Convert.ToInt16(SystemInformation.WorkingArea.Height / 2), _ + 100) + + ' Greet the user. + CurrentSpeaker.Play("Announce") + CurrentSpeaker.Play("RestPose") + CurrentSpeaker.Speak("\map=" + Chr(34) + _ + "What you hear is not what you see!" + Chr(34) + _ + "=" + Chr(34) + "Hello World" + Chr(34) + "\", "") + CurrentSpeaker.Play("Greet") + + ' Tell the character to pull rabbit from hat. + CurrentSpeaker.Play("RestPose") + CurrentSpeaker.Speak("Want to see me pull a rabbit from my hat?", _ + "") + CurrentSpeaker.Play("DoMagic1") + CurrentSpeaker.Play("DoMagic2") + + ' The the character to express surprise that the user doesn't + ' want to see the magic trick. + CurrentSpeaker.Play("Surprised") + CurrentSpeaker.Play("Confused") + CurrentSpeaker.Play("RestPose") + CurrentSpeaker.Speak("That trick never works!", "") + CurrentSpeaker.Play("Sad") + + ' Goodbye. + CurrentSpeaker.Play("RestPose") + CurrentSpeaker.Speak("Goodbye", "") + CurrentSpeaker.Play("Wave") + + ' Hide the character. + CurrentSpeaker.Hide(0) + End Sub +End Class diff --git a/Chapter 08/VB/MSAgent/MSAgent.sln b/Chapter 08/VB/MSAgent/MSAgent.sln new file mode 100644 index 0000000..bc4cdab --- /dev/null +++ b/Chapter 08/VB/MSAgent/MSAgent.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MSAgent", "MSAgent.vbproj", "{E8C6F8C0-A339-47AA-BC86-CDEBFE84CF22}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E8C6F8C0-A339-47AA-BC86-CDEBFE84CF22}.Debug.ActiveCfg = Debug|.NET + {E8C6F8C0-A339-47AA-BC86-CDEBFE84CF22}.Debug.Build.0 = Debug|.NET + {E8C6F8C0-A339-47AA-BC86-CDEBFE84CF22}.Release.ActiveCfg = Release|.NET + {E8C6F8C0-A339-47AA-BC86-CDEBFE84CF22}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 08/VB/MSAgent/MSAgent.suo b/Chapter 08/VB/MSAgent/MSAgent.suo new file mode 100644 index 0000000..28b57ba Binary files /dev/null and b/Chapter 08/VB/MSAgent/MSAgent.suo differ diff --git a/Chapter 08/VB/MSAgent/MSAgent.vbproj b/Chapter 08/VB/MSAgent/MSAgent.vbproj new file mode 100644 index 0000000..c9427a7 --- /dev/null +++ b/Chapter 08/VB/MSAgent/MSAgent.vbproj @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 08/VB/MSAgent/MSAgent.vbproj.user b/Chapter 08/VB/MSAgent/MSAgent.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Chapter 08/VB/MSAgent/MSAgent.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Chapter 08/VB/MSAgent/bin/AxInterop.AgentObjects.dll b/Chapter 08/VB/MSAgent/bin/AxInterop.AgentObjects.dll new file mode 100644 index 0000000..fd17305 Binary files /dev/null and b/Chapter 08/VB/MSAgent/bin/AxInterop.AgentObjects.dll differ diff --git a/Chapter 08/VB/MSAgent/bin/Interop.AgentObjects.dll b/Chapter 08/VB/MSAgent/bin/Interop.AgentObjects.dll new file mode 100644 index 0000000..059073f Binary files /dev/null and b/Chapter 08/VB/MSAgent/bin/Interop.AgentObjects.dll differ diff --git a/Chapter 08/VB/MSAgent/bin/MSAgent.exe b/Chapter 08/VB/MSAgent/bin/MSAgent.exe new file mode 100644 index 0000000..f18b5c0 Binary files /dev/null and b/Chapter 08/VB/MSAgent/bin/MSAgent.exe differ diff --git a/Chapter 08/VB/MSAgent/obj/AxInterop.AgentObjects.dll b/Chapter 08/VB/MSAgent/obj/AxInterop.AgentObjects.dll new file mode 100644 index 0000000..fd17305 Binary files /dev/null and b/Chapter 08/VB/MSAgent/obj/AxInterop.AgentObjects.dll differ diff --git a/Chapter 08/VB/MSAgent/obj/Debug/MSAgent.exe b/Chapter 08/VB/MSAgent/obj/Debug/MSAgent.exe new file mode 100644 index 0000000..f18b5c0 Binary files /dev/null and b/Chapter 08/VB/MSAgent/obj/Debug/MSAgent.exe differ diff --git a/Chapter 08/VB/MSAgent/obj/Debug/MSAgent.frmMain.resources b/Chapter 08/VB/MSAgent/obj/Debug/MSAgent.frmMain.resources new file mode 100644 index 0000000..efc25ac Binary files /dev/null and b/Chapter 08/VB/MSAgent/obj/Debug/MSAgent.frmMain.resources differ diff --git a/Chapter 08/VB/MSAgent/obj/Interop.AgentObjects.dll b/Chapter 08/VB/MSAgent/obj/Interop.AgentObjects.dll new file mode 100644 index 0000000..059073f Binary files /dev/null and b/Chapter 08/VB/MSAgent/obj/Interop.AgentObjects.dll differ diff --git a/Chapter 09/Forms/Help.htm b/Chapter 09/Forms/Help.htm new file mode 100644 index 0000000..a3d33d0 --- /dev/null +++ b/Chapter 09/Forms/Help.htm @@ -0,0 +1,38 @@ + + + + Data Entry Form Help + + + + +
+

Data Entry Form Help

+

The data entry form example shows some essentials about accessible Web page + design. Of course, we'll explore the details of good accessible Web page design + in more detail as the book progresses. The essential point is that this page is + a beginning--it shows principles that you need to learn.

+

Name Entry:

+

Type the name of the person that you wish to enter into the database using this + form. Make sure you enter their full name, such as John Aaron Smith. Using the + full name, when available, ensures the database can locate the person with + greater ease.

+

Address Entry:

+

Type the street address information of the person. Make sure you include their + full address. Don't abbreviate terms such as street and road. Include an + apartment or suite number if necessary.

+

City Entry:

+

Type the name of the city in which the person lives. Use initial captial + letters for each element of the city name and don't abbreviate terms. For + example, type Saint Louis instead of St Louis.

+

State Entry:

+

Type the two-letter of the state in which the person lives.  For example, + the two-letter identifier for Wisconsin is WI.

+

ZIP Code Entry:

+

The type five or nine digit ZIP Code entry. For example, type 12345-5789 for a + nine digit ZIP code.

+

Press Alt+R to Return to the Data Entry Form.

+
+ + diff --git a/Chapter 09/Forms/Sample.htm b/Chapter 09/Forms/Sample.htm new file mode 100644 index 0000000..b1c7e9d --- /dev/null +++ b/Chapter 09/Forms/Sample.htm @@ -0,0 +1,35 @@ + + + + Simple Data Enty Form + + + + +
+

Data Entry Form

+
+
+
+
+
+
 
+
Press Alt+H or click the Help link to view + help information for this page.
+
 
+
+
+ + diff --git a/Chapter 09/Forms/Sample.sln b/Chapter 09/Forms/Sample.sln new file mode 100644 index 0000000..a9e8ca2 --- /dev/null +++ b/Chapter 09/Forms/Sample.sln @@ -0,0 +1,15 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + Help.htm = Help.htm + Sample.htm = Sample.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 09/Forms/Sample.suo b/Chapter 09/Forms/Sample.suo new file mode 100644 index 0000000..17d660a Binary files /dev/null and b/Chapter 09/Forms/Sample.suo differ diff --git a/Chapter 09/Tables/TableDemo.htm b/Chapter 09/Tables/TableDemo.htm new file mode 100644 index 0000000..f256b01 --- /dev/null +++ b/Chapter 09/Tables/TableDemo.htm @@ -0,0 +1,76 @@ + + + + Accessible Table Demonstration + + + + +

Table Demonstration

+

Table Type 1

+

+ + + + + + + + + + + + + + + + + + + + + +
+ Column 1 Heading + Colunn 2 Heading + Column 3 Heading
This is some data.This is some more data.This is yet more data!
Column 1 Row 2Column 2 Row 2Column 3 Row 2
Column 1 Row 3Column 2 Row 3Column 3 Row 3
+

+

Table Type 2

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Column 1 Heading + Colunn 2 Heading + Column 3 Heading
+ Row Heading 1Column 1 Row 1Column 2 Row 1Column 3 Row 1
+ Row Heading 2Column 1 Row 2Column 2 Row 2Column 3 Row 2
+ Row Heading 3Column 1 Row 2Column 2 Row 3Column 3 Row 3
+

+ + diff --git a/Chapter 09/Tables/TableDemo.sln b/Chapter 09/Tables/TableDemo.sln new file mode 100644 index 0000000..a433e28 --- /dev/null +++ b/Chapter 09/Tables/TableDemo.sln @@ -0,0 +1,14 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + TableDemo.htm = TableDemo.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 09/Tables/TableDemo.suo b/Chapter 09/Tables/TableDemo.suo new file mode 100644 index 0000000..4158534 Binary files /dev/null and b/Chapter 09/Tables/TableDemo.suo differ diff --git a/Chapter 10/SimplePage/Simple.aspx b/Chapter 10/SimplePage/Simple.aspx new file mode 100644 index 0000000..5d9b5f3 --- /dev/null +++ b/Chapter 10/SimplePage/Simple.aspx @@ -0,0 +1,77 @@ +<%@ Page Inherits="Microsoft.Saturn.Framework.Mobile.UI.MobilePage, Microsoft.Saturn.Framework.Mobile, Version=0.5.464.0, Culture=neutral, PublicKeyToken=6f763c9966660626" Language="C#" ClassName="SimpleTest" Debug="True" Culture="en-US" %> +<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> + + +

+ Welcome to the
+ First Mobile Example +

+

+ + + + + +Label + + + + + +Command + + + + + +Second Page + + + + + + + + + + + +Command + + + + + +Next Page +

+
+ + Output + +Click Me + Next Page + + + Some Output + Click to Test + First Page + \ No newline at end of file diff --git a/Chapter 10/SimplePage/web.config b/Chapter 10/SimplePage/web.config new file mode 100644 index 0000000..63beb3a --- /dev/null +++ b/Chapter 10/SimplePage/web.config @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 11/ALT and LONGDESC/ALT and LONGDESC.sln b/Chapter 11/ALT and LONGDESC/ALT and LONGDESC.sln new file mode 100644 index 0000000..4dafe1c --- /dev/null +++ b/Chapter 11/ALT and LONGDESC/ALT and LONGDESC.sln @@ -0,0 +1,15 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + JohnDesc.htm = JohnDesc.htm + Sample.htm = Sample.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 11/ALT and LONGDESC/ALT and LONGDESC.suo b/Chapter 11/ALT and LONGDESC/ALT and LONGDESC.suo new file mode 100644 index 0000000..59b3b67 Binary files /dev/null and b/Chapter 11/ALT and LONGDESC/ALT and LONGDESC.suo differ diff --git a/Chapter 11/ALT and LONGDESC/JohnDesc.htm b/Chapter 11/ALT and LONGDESC/JohnDesc.htm new file mode 100644 index 0000000..ffbddf9 --- /dev/null +++ b/Chapter 11/ALT and LONGDESC/JohnDesc.htm @@ -0,0 +1,18 @@ + + + +A Description of John + + + + +

A Description of John

+

+The picture shows John facing forward. The background of the picture +is marbled gray. John is wearing gold rimmed glasses and has brown hair +with red highlights. His hair is shoulder length. John’s shirt is a +brownish red and dark green plaid, with thin lines of light gray.

+ +Return to the previous page. + + diff --git a/Chapter 11/ALT and LONGDESC/JohnPic.jpg b/Chapter 11/ALT and LONGDESC/JohnPic.jpg new file mode 100644 index 0000000..27a3568 Binary files /dev/null and b/Chapter 11/ALT and LONGDESC/JohnPic.jpg differ diff --git a/Chapter 11/ALT and LONGDESC/Sample.htm b/Chapter 11/ALT and LONGDESC/Sample.htm new file mode 100644 index 0000000..d9117c6 --- /dev/null +++ b/Chapter 11/ALT and LONGDESC/Sample.htm @@ -0,0 +1,30 @@ + + + +Sample of <ALT> and <LONGDESC> Tags + + + + +

Using the <ALT> and <LONGDESC> Tags

+ +

Simple graphics only require use of the <ALT> tag.

+A green diamond shape that contains the word New in red. + +

Complex graphics require both the <ALT> + and the <LONGDESC> tags

+A picture of John +[D] + + + diff --git a/Chapter 11/ALT and LONGDESC/new.gif b/Chapter 11/ALT and LONGDESC/new.gif new file mode 100644 index 0000000..a6719a9 Binary files /dev/null and b/Chapter 11/ALT and LONGDESC/new.gif differ diff --git a/Chapter 11/Accessible Tags/Accessible Tags.sln b/Chapter 11/Accessible Tags/Accessible Tags.sln new file mode 100644 index 0000000..d128fc2 --- /dev/null +++ b/Chapter 11/Accessible Tags/Accessible Tags.sln @@ -0,0 +1,14 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + TagSampler.htm = TagSampler.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 11/Accessible Tags/Accessible Tags.suo b/Chapter 11/Accessible Tags/Accessible Tags.suo new file mode 100644 index 0000000..1f3cbeb Binary files /dev/null and b/Chapter 11/Accessible Tags/Accessible Tags.suo differ diff --git a/Chapter 11/Accessible Tags/TagSampler.htm b/Chapter 11/Accessible Tags/TagSampler.htm new file mode 100644 index 0000000..31853d0 --- /dev/null +++ b/Chapter 11/Accessible Tags/TagSampler.htm @@ -0,0 +1,80 @@ + + + +Accessible Tag Demonstration + + + + +
+ +
+
+ +
+This text was deleted.
+This text was inserted. +

+
+
+ My Address +
+
+
+
+
+
+
+

+
+ +
+

+
+ + + + + + + + + + + + +
A Demonstration of a Table
Heading 1Heading 2Heading 3
Data 1Data 2Data 3
+
+

+
+
+ John Mueller + is the contact person for this page. +
+
+ + diff --git a/Chapter 11/CSS Example/CSS Example.sln b/Chapter 11/CSS Example/CSS Example.sln new file mode 100644 index 0000000..a253fde --- /dev/null +++ b/Chapter 11/CSS Example/CSS Example.sln @@ -0,0 +1,15 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + MyStyle.css = MyStyle.css + Test.htm = Test.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 11/CSS Example/CSS Example.suo b/Chapter 11/CSS Example/CSS Example.suo new file mode 100644 index 0000000..de4fa66 Binary files /dev/null and b/Chapter 11/CSS Example/CSS Example.suo differ diff --git a/Chapter 11/CSS Example/MyStyle.css b/Chapter 11/CSS Example/MyStyle.css new file mode 100644 index 0000000..3c59035 --- /dev/null +++ b/Chapter 11/CSS Example/MyStyle.css @@ -0,0 +1,37 @@ +BODY { + font-size: 100%; + color: black; + background-color: white +} + +H1 { + font-size: 200%; + color: black; + background-color: white +} + +H2 { + font-size: 150%; + color: black; + background-color: white +} + +.highlight { + font-size: 100%; + color: red; + background-color: white +} + +.highlight-i { + font-size: 100%; + color: red; + font-style: italic; + background-color: white +} + +.underline { + font-size: 100%; + color: black; + text-decoration: underline; + background-color: white +} diff --git a/Chapter 11/CSS Example/Test.htm b/Chapter 11/CSS Example/Test.htm new file mode 100644 index 0000000..41d04e0 --- /dev/null +++ b/Chapter 11/CSS Example/Test.htm @@ -0,0 +1,56 @@ + + + + + Test Web Page + + + + + + +

Welcome to the Test Web Page +

+ +

+ This is some introductory text.
+ This text is in RED and + the word "RED" is in italics. +

+

+ This text is underlined. +

+

Here is a Second Level Header +

+

+ + +

+

+ + +

+

Here is Another Header +

+

+ Click the link to get to the + DataCon Home Page. +

+ + diff --git a/Chapter 11/Image Map/About.htm b/Chapter 11/Image Map/About.htm new file mode 100644 index 0000000..a143fb7 --- /dev/null +++ b/Chapter 11/Image Map/About.htm @@ -0,0 +1,28 @@ + + + +Image Map About Us Page + + + + +

About Us Page

+Select one of the common areas on the site. + + Select this option to go home. + Select this option to obtain help. + Select this option to learn more about us. + + + diff --git a/Chapter 11/Image Map/Help.htm b/Chapter 11/Image Map/Help.htm new file mode 100644 index 0000000..086cc44 --- /dev/null +++ b/Chapter 11/Image Map/Help.htm @@ -0,0 +1,28 @@ + + + +Image Map Help Page + + + + +

Help Page

+Select one of the common areas on the site. + + Select this option to go home. + Select this option to obtain help. + Select this option to learn more about us. + + + diff --git a/Chapter 11/Image Map/Home.htm b/Chapter 11/Image Map/Home.htm new file mode 100644 index 0000000..35c68d2 --- /dev/null +++ b/Chapter 11/Image Map/Home.htm @@ -0,0 +1,28 @@ + + + +Image Map Home Page + + + + +

Home Page

+Select one of the common areas on the site. + + Select this option to go home. + Select this option to obtain help. + Select this option to learn more about us. + + + diff --git a/Chapter 11/Image Map/Image Map.sln b/Chapter 11/Image Map/Image Map.sln new file mode 100644 index 0000000..6e61158 --- /dev/null +++ b/Chapter 11/Image Map/Image Map.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + About.htm = About.htm + Help.htm = Help.htm + Home.htm = Home.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 11/Image Map/Image Map.suo b/Chapter 11/Image Map/Image Map.suo new file mode 100644 index 0000000..5570b44 Binary files /dev/null and b/Chapter 11/Image Map/Image Map.suo differ diff --git a/Chapter 11/Image Map/NavBar.gif b/Chapter 11/Image Map/NavBar.gif new file mode 100644 index 0000000..00f5653 Binary files /dev/null and b/Chapter 11/Image Map/NavBar.gif differ diff --git a/Chapter 12/MSAgent/MASS.htm b/Chapter 12/MSAgent/MASS.htm new file mode 100644 index 0000000..2de9e3b --- /dev/null +++ b/Chapter 12/MSAgent/MASS.htm @@ -0,0 +1,116 @@ + + +MASS Script Inside + + + + + + + +Uses Microsoft Agent Technology diff --git a/Chapter 12/SAPIDemo (Server)/AssemblyInfo.cs b/Chapter 12/SAPIDemo (Server)/AssemblyInfo.cs new file mode 100644 index 0000000..b26491c --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/AssemblyInfo.cs @@ -0,0 +1,62 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the "project output directory". The location of the project output +// directory is dependent on whether you are working with a local or web project. +// For local projects, the project output directory is defined as +// \obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// For web projects, the project output directory is defined as +// %HOMEPATH%\VSWebCache\\\obj\. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Chapter 12/SAPIDemo (Server)/Global.asax b/Chapter 12/SAPIDemo (Server)/Global.asax new file mode 100644 index 0000000..f4e9840 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="SAPIDemo.Global" %> diff --git a/Chapter 12/SAPIDemo (Server)/Global.asax.cs b/Chapter 12/SAPIDemo (Server)/Global.asax.cs new file mode 100644 index 0000000..46ef644 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/Global.asax.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Web; +using System.Web.SessionState; + +namespace SAPIDemo +{ + /// + /// Summary description for Global. + /// + public class Global : System.Web.HttpApplication + { + public Global() + { + InitializeComponent(); + } + + protected void Application_Start(Object sender, EventArgs e) + { + + } + + protected void Session_Start(Object sender, EventArgs e) + { + + } + + protected void Application_BeginRequest(Object sender, EventArgs e) + { + + } + + protected void Application_EndRequest(Object sender, EventArgs e) + { + + } + + protected void Application_AuthenticateRequest(Object sender, EventArgs e) + { + + } + + protected void Application_Error(Object sender, EventArgs e) + { + + } + + protected void Session_End(Object sender, EventArgs e) + { + + } + + protected void Application_End(Object sender, EventArgs e) + { + + } + + #region Web Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + } + #endregion + } +} + diff --git a/Chapter 12/SAPIDemo (Server)/Global.asax.resx b/Chapter 12/SAPIDemo (Server)/Global.asax.resx new file mode 100644 index 0000000..7e32396 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/Global.asax.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Chapter 12/SAPIDemo (Server)/MyStyle.css b/Chapter 12/SAPIDemo (Server)/MyStyle.css new file mode 100644 index 0000000..3c59035 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/MyStyle.css @@ -0,0 +1,37 @@ +BODY { + font-size: 100%; + color: black; + background-color: white +} + +H1 { + font-size: 200%; + color: black; + background-color: white +} + +H2 { + font-size: 150%; + color: black; + background-color: white +} + +.highlight { + font-size: 100%; + color: red; + background-color: white +} + +.highlight-i { + font-size: 100%; + color: red; + font-style: italic; + background-color: white +} + +.underline { + font-size: 100%; + color: black; + text-decoration: underline; + background-color: white +} diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx b/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx new file mode 100644 index 0000000..106b8f9 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx @@ -0,0 +1,84 @@ +<%@ Register TagPrefix="speech1" Namespace="Microsoft.Web.UI.SpeechControls.ApplicationControls" Assembly="Microsoft.Web.UI.SpeechControls.ApplicationControls, Version=1.0.3200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> +<%@ Page language="c#" Codebehind="SAPIDemo.aspx.cs" AutoEventWireup="false" Inherits="SAPIDemo.WebForm1" %> +<%@ Register TagPrefix="speech" Namespace="Microsoft.Web.UI.SpeechControls" Assembly="Microsoft.Web.UI.SpeechControls, Version=1.0.3200.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> + + + + Simple SAPI Demonstration + + + + + + + + +
+ + + + + Welcome to the SAPI Demonstration page! + Do you want to display the rest of the controls? (Yes or No) + + + Type Red, Green, or Blue. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx.cs b/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx.cs new file mode 100644 index 0000000..805a8f5 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Web; +using System.Web.SessionState; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; + +namespace SAPIDemo +{ + /// + /// Summary description for WebForm1. + /// + public class WebForm1 : System.Web.UI.Page + { + protected System.Web.UI.WebControls.Label Label1; + protected System.Web.UI.WebControls.TextBox txtColor; + protected Microsoft.Web.UI.SpeechControls.QA Goodbye; + protected System.Web.UI.WebControls.Label lblColor; + protected Microsoft.Web.UI.SpeechControls.QA DisplayControls; + protected System.Web.UI.WebControls.TextBox txtDisplayControl; + protected System.Web.UI.WebControls.Label Label2; + protected Microsoft.Web.UI.SpeechControls.SemanticMap Semantics; + protected Microsoft.Web.UI.SpeechControls.QA GetAColor; + protected Microsoft.Web.UI.SpeechControls.QA Greeting; + + private void Page_Load(object sender, System.EventArgs e) + { + // Put user code to initialize the page here + } + + #region Web Form Designer generated code + override protected void OnInit(EventArgs e) + { + // + // CODEGEN: This call is required by the ASP.NET Web Form Designer. + // + InitializeComponent(); + base.OnInit(e); + } + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtDisplayControl.TextChanged += new System.EventHandler(this.txtDisplayControl_TextChanged); + this.txtColor.TextChanged += new System.EventHandler(this.txtColor_TextChanged); + this.Load += new System.EventHandler(this.Page_Load); + + } + #endregion + + private void txtDisplayControl_TextChanged(object sender, System.EventArgs e) + { + if (txtDisplayControl.Text == "Yes") + { + // Display the other controls if the user says yes. + txtColor.Visible = true; + lblColor.Visible = true; + GetAColor.Enabled = true; + } + else + // Tell the reader goodbye. + Goodbye.Enabled = true; + } + + private void txtColor_TextChanged(object sender, System.EventArgs e) + { + // Tell the reader goodbye. + Goodbye.Enabled = true; + } + } +} diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx.resx b/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx.resx new file mode 100644 index 0000000..7e32396 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.aspx.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.csproj b/Chapter 12/SAPIDemo (Server)/SAPIDemo.csproj new file mode 100644 index 0000000..d59486e --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.csproj @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.csproj.webinfo b/Chapter 12/SAPIDemo (Server)/SAPIDemo.csproj.webinfo new file mode 100644 index 0000000..fa2e218 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.csproj.webinfo @@ -0,0 +1,4 @@ + + + + diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.grxml b/Chapter 12/SAPIDemo (Server)/SAPIDemo.grxml new file mode 100644 index 0000000..1aa35ec --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.grxml @@ -0,0 +1,54 @@ + + + + + Yes + $._value="Yes" + + + No + $._value="No" + + + + + + + Red + $._value="Red" + + + Green + $._value="Green" + + + Blue + $._value="Blue" + + + + + + $.GetColor=$$ + + + + + + + $.DisplayControls=$$ + + + $.GetColor=$$ + + + + + $.GetColor=$$ + + + $.DisplayControls=$$ + + + + diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.pf b/Chapter 12/SAPIDemo (Server)/SAPIDemo.pf new file mode 100644 index 0000000..60761f3 Binary files /dev/null and b/Chapter 12/SAPIDemo (Server)/SAPIDemo.pf differ diff --git a/Chapter 12/SAPIDemo (Server)/SAPIDemo.vsdisco b/Chapter 12/SAPIDemo (Server)/SAPIDemo.vsdisco new file mode 100644 index 0000000..10b0ed1 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/SAPIDemo.vsdisco @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Chapter 12/SAPIDemo (Server)/Web.config b/Chapter 12/SAPIDemo (Server)/Web.config new file mode 100644 index 0000000..24cdddd --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/Web.config @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Chapter 12/SAPIDemo (Server)/_vti_pvt/access.cnf b/Chapter 12/SAPIDemo (Server)/_vti_pvt/access.cnf new file mode 100644 index 0000000..af90713 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/_vti_pvt/access.cnf @@ -0,0 +1,4 @@ +vti_encoding:SR|utf8-nl +RealmName:main +InheritPermissions:true +PasswordDir:d:\\inetpub\\wwwroot\\_vti_pvt diff --git a/Chapter 12/SAPIDemo (Server)/_vti_pvt/deptodoc.btr b/Chapter 12/SAPIDemo (Server)/_vti_pvt/deptodoc.btr new file mode 100644 index 0000000..323d429 Binary files /dev/null and b/Chapter 12/SAPIDemo (Server)/_vti_pvt/deptodoc.btr differ diff --git a/Chapter 12/SAPIDemo (Server)/_vti_pvt/doctodep.btr b/Chapter 12/SAPIDemo (Server)/_vti_pvt/doctodep.btr new file mode 100644 index 0000000..4b85379 Binary files /dev/null and b/Chapter 12/SAPIDemo (Server)/_vti_pvt/doctodep.btr differ diff --git a/Chapter 12/SAPIDemo (Server)/_vti_pvt/service.cnf b/Chapter 12/SAPIDemo (Server)/_vti_pvt/service.cnf new file mode 100644 index 0000000..74936e5 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/_vti_pvt/service.cnf @@ -0,0 +1,20 @@ +vti_encoding:SR|utf8-nl +vti_casesensitiveurls:IX|0 +vti_httpdversion:SX|Microsoft-IIS/5.1 +vti_textextensions:SX|.txt.asm.c.cc.cod.cpp.cs.cxx.dbs.def.dsp.dsw.etp.ext.fky.grxml.h.hpp.hxx.i.idl.inc.inl.kci.lgn.lst.mak.map.mk.odh.odl.pf.prc.promptdb.prproj.rc.rc2.rct.rgs.rul.s.sql.srf.tab.tlh.tli.trg.txt.udf.udt.user.usr.vb.vcproj.viw.vsmproj.vspscc.vsscc.vssscc. +vti_featurelist:VX|vti_ACIPAddresses vti_ACCreateNewUsers vti_ACChangePassword vti_ACNoUserGroup vti_ACCreateNewGroups vti_ACModifyGroups vti_ServiceMarkUrlDirExec vti_ServerEmailTransport +vti_dependenciesood:IR|0 +vti_webservertype:SR|msiis +vti_publishmetainfokeys:VR|vti_assignedto vti_approvallevel vti_categories vti_description +vti_categories:VR|Travel Expense\\ Report Business Competition Goals/Objectives Ideas Miscellaneous Waiting VIP In\\ Process Planning Schedule +vti_htmlextensions:SX|.htm.html.stm.html.htm.shtml.shtm.htt.htx.asp.alx.asa. +vti_approvallevels:VR|Content\\ Review Legal\\ Review Code\\ Review Manager\\ Review +vti_timecreated:TR|16 Jan 2003 14:38:10 -0000 +vti_extenderversion:SR|4.0.2.6513 +vti_longfilenames:IX|1 +vti_welcomenames:VX|Default.htm Default.asp index.htm iisstart.asp Default.aspx +vti_insecureserverurl:SR|http://localhost +vti_secureserverurl:SR|https://localhost +vti_disableautoimgsizeexts:SX|.asp +vti_oldestcompatibleversion:SR|2.0.0.0 +vti_restartmanual:IX|0 diff --git a/Chapter 12/SAPIDemo (Server)/_vti_pvt/service.lck b/Chapter 12/SAPIDemo (Server)/_vti_pvt/service.lck new file mode 100644 index 0000000..e69de29 diff --git a/Chapter 12/SAPIDemo (Server)/_vti_pvt/services.cnf b/Chapter 12/SAPIDemo (Server)/_vti_pvt/services.cnf new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/Chapter 12/SAPIDemo (Server)/_vti_pvt/services.cnf @@ -0,0 +1 @@ +/ diff --git a/Chapter 12/SAPIDemo (Server)/bin/SAPIDemo.dll b/Chapter 12/SAPIDemo (Server)/bin/SAPIDemo.dll new file mode 100644 index 0000000..4b7efa5 Binary files /dev/null and b/Chapter 12/SAPIDemo (Server)/bin/SAPIDemo.dll differ diff --git a/Chapter 12/SAPIDemo/SAPIDemo.sln b/Chapter 12/SAPIDemo/SAPIDemo.sln new file mode 100644 index 0000000..8b1676c --- /dev/null +++ b/Chapter 12/SAPIDemo/SAPIDemo.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SAPIDemo", "http://localhost/SAPIDemo/SAPIDemo.csproj", "{3D26E9D1-0A9C-43C5-A35E-ACE7A19E3622}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3D26E9D1-0A9C-43C5-A35E-ACE7A19E3622}.Debug.ActiveCfg = Debug|.NET + {3D26E9D1-0A9C-43C5-A35E-ACE7A19E3622}.Debug.Build.0 = Debug|.NET + {3D26E9D1-0A9C-43C5-A35E-ACE7A19E3622}.Release.ActiveCfg = Release|.NET + {3D26E9D1-0A9C-43C5-A35E-ACE7A19E3622}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 12/SAPIDemo/SAPIDemo.suo b/Chapter 12/SAPIDemo/SAPIDemo.suo new file mode 100644 index 0000000..fff5b36 Binary files /dev/null and b/Chapter 12/SAPIDemo/SAPIDemo.suo differ diff --git a/Chapter 12/VSMacros/Samples/Samples.vsmacros b/Chapter 12/VSMacros/Samples/Samples.vsmacros new file mode 100644 index 0000000..e4b40e7 Binary files /dev/null and b/Chapter 12/VSMacros/Samples/Samples.vsmacros differ diff --git a/Chapter 12/VXML/Hello.vxml b/Chapter 12/VXML/Hello.vxml new file mode 100644 index 0000000..c8428fa --- /dev/null +++ b/Chapter 12/VXML/Hello.vxml @@ -0,0 +1,10 @@ + + +
+ + + Hello World + + +
+
diff --git a/Chapter 13/AccessFriendly/AccessFriendly.sln b/Chapter 13/AccessFriendly/AccessFriendly.sln new file mode 100644 index 0000000..ff169d1 --- /dev/null +++ b/Chapter 13/AccessFriendly/AccessFriendly.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + Item:1 = DoMath.asp + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 13/AccessFriendly/AccessFriendly.suo b/Chapter 13/AccessFriendly/AccessFriendly.suo new file mode 100644 index 0000000..097e996 Binary files /dev/null and b/Chapter 13/AccessFriendly/AccessFriendly.suo differ diff --git a/Chapter 13/AccessFriendly/DoMath.asp b/Chapter 13/AccessFriendly/DoMath.asp new file mode 100644 index 0000000..9d2df05 --- /dev/null +++ b/Chapter 13/AccessFriendly/DoMath.asp @@ -0,0 +1,100 @@ +<%@ Language = "JavaScript" %> +<% Response.Buffer = true %> + + + + + Accessible Friendly Script Demonstration + + + + + +
+

Math Demonstration

+
+ 0) + { + Response.Write("value=") + Response.Write(Request.QueryString("Input1")(1)) + } + else + Response.Write("value=0")%> + tabindex=1 + name=Input1> + +
+
+ 0) + { + Response.Write("value=") + Response.Write(Request.QueryString("Input2")(1)) + } + else + Response.Write("value=0")%> + tabindex=2 + name=Input2> + +
+
+ 0) && + (Request.QueryString("Input2").Count > 0)) + { + var Value1 = parseInt(Request.QueryString("Input1")(1)); + var Value2 = parseInt(Request.QueryString("Input2")(1)); + var Sum = Value1 + Value2; + Response.Write("value=") + Response.Write(Sum) + } + else + Response.Write("value=0")%> + tabindex=3 + readonly > + +
+
+ +
+
+ +
+
+ + diff --git a/Chapter 13/BrowserCheck/BrowserCheck.sln b/Chapter 13/BrowserCheck/BrowserCheck.sln new file mode 100644 index 0000000..50cc05d --- /dev/null +++ b/Chapter 13/BrowserCheck/BrowserCheck.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + Item:1 = DoCheck.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 13/BrowserCheck/BrowserCheck.suo b/Chapter 13/BrowserCheck/BrowserCheck.suo new file mode 100644 index 0000000..f033c52 Binary files /dev/null and b/Chapter 13/BrowserCheck/BrowserCheck.suo differ diff --git a/Chapter 13/BrowserCheck/DoCheck.htm b/Chapter 13/BrowserCheck/DoCheck.htm new file mode 100644 index 0000000..825eeb3 --- /dev/null +++ b/Chapter 13/BrowserCheck/DoCheck.htm @@ -0,0 +1,40 @@ + + + + Determining the Browser Name and Version + + + + + +

Browser Name and Version

+
+ + +
+
+ + +
+
+ + +
+ + + diff --git a/Chapter 13/MouseOver/DoSelect.htm b/Chapter 13/MouseOver/DoSelect.htm new file mode 100644 index 0000000..e0a3245 --- /dev/null +++ b/Chapter 13/MouseOver/DoSelect.htm @@ -0,0 +1,59 @@ + + + + MouseOver Demonstration + + + + + +

Control Selection Example

+
+ + +
+
+ + +
+ + diff --git a/Chapter 13/MouseOver/MouseOver.sln b/Chapter 13/MouseOver/MouseOver.sln new file mode 100644 index 0000000..d7bf86c --- /dev/null +++ b/Chapter 13/MouseOver/MouseOver.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Global + GlobalSection(SolutionConfiguration) = preSolution + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + EndGlobalSection + GlobalSection(SolutionItems) = postSolution + Item:1 = DoSelect.htm + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Chapter 13/MouseOver/MouseOver.suo b/Chapter 13/MouseOver/MouseOver.suo new file mode 100644 index 0000000..d1f2e39 Binary files /dev/null and b/Chapter 13/MouseOver/MouseOver.suo differ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..f09d28a --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Freeware License, some rights reserved + +Copyright (c) 2003 John Mueller + +Permission is hereby granted, free of charge, to anyone obtaining a copy +of this software and associated documentation files (the "Software"), +to work with the Software within the limits of freeware distribution and fair use. +This includes the rights to use, copy, and modify the Software for personal use. +Users are also allowed and encouraged to submit corrections and modifications +to the Software for the benefit of other users. + +It is not allowed to reuse, modify, or redistribute the Software for +commercial use in any way, or for a user’s educational materials such as books +or blog articles without prior permission from the copyright holder. + +The above copyright notice and this permission notice need to be included +in all copies or substantial portions of the software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..c08808e --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +#Apress Source Code + +This repository accompanies [*Accessibility for Everybody*](http://www.apress.com/9781590590867) by John Mueller (Apress, 2003). + +![Cover image](9781590590867.jpg) + +Download the files as a zip using the green button, or clone the repository to your machine using Git. + +##Releases + +Release v1.0 corresponds to the code in the published book, without corrections or updates. + +##Contributions + +See the file Contributing.md for more information on how you can contribute to this repository. diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..f6005ad --- /dev/null +++ b/contributing.md @@ -0,0 +1,14 @@ +# Contributing to Apress Source Code + +Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers. + +## How to Contribute + +1. Make sure you have a GitHub account. +2. Fork the repository for the relevant book. +3. Create a new branch on which to make your change, e.g. +`git checkout -b my_code_contribution` +4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted. +5. Submit a pull request. + +Thank you for your contribution! \ No newline at end of file