# HG changeset patch # User sl # Date 1400074949 -7200 # Node ID f5e6a5b8a56af1822f46387f0d3e5f824014a5d5 # Parent 5f7e2c772e63c47248cebac4646d2fdca81e723b Adding TreeView to display our devices. diff -r 5f7e2c772e63 -r f5e6a5b8a56a FrmMain.cs --- a/FrmMain.cs Wed May 14 07:57:55 2014 +0200 +++ b/FrmMain.cs Wed May 14 15:42:29 2014 +0200 @@ -8,6 +8,8 @@ using System.Threading; using System.Timers; using System.Windows.Forms; +using System.Collections.Generic; +using System.Drawing; namespace GenericHid { @@ -205,419 +207,429 @@ private RadioButton radFeature; private RadioButton radInputOutputControl; private RadioButton radInputOutputInterrupt; + private TreeView treeViewDevices; private Button cmdSendOutputReportInterrupt; [System.Diagnostics.DebuggerStepThrough()] private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.ToolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.FraBytesReceived = new System.Windows.Forms.GroupBox(); - this.TxtBytesReceived = new System.Windows.Forms.TextBox(); - this.FraBytesToSend = new System.Windows.Forms.GroupBox(); - this.ChkAutoincrement = new System.Windows.Forms.CheckBox(); - this.CboByte1 = new System.Windows.Forms.ComboBox(); - this.CboByte0 = new System.Windows.Forms.ComboBox(); - this.LstResults = new System.Windows.Forms.ListBox(); - this.fraInputReportBufferSize = new System.Windows.Forms.GroupBox(); - this.cmdInputReportBufferSize = new System.Windows.Forms.Button(); - this.txtInputReportBufferSize = new System.Windows.Forms.TextBox(); - this.fraDeviceIdentifiers = new System.Windows.Forms.GroupBox(); - this.txtProductID = new System.Windows.Forms.TextBox(); - this.lblProductID = new System.Windows.Forms.Label(); - this.txtVendorID = new System.Windows.Forms.TextBox(); - this.lblVendorID = new System.Windows.Forms.Label(); - this.cmdFindDevice = new System.Windows.Forms.Button(); - this.cmdSendOutputReportInterrupt = new System.Windows.Forms.Button(); - this.cmdGetInputReportInterrupt = new System.Windows.Forms.Button(); - this.fraInterruptTransfers = new System.Windows.Forms.GroupBox(); - this.cmdPeriodicTransfers = new System.Windows.Forms.Button(); - this.cmdSendOutputReportControl = new System.Windows.Forms.Button(); - this.cmdGetInputReportControl = new System.Windows.Forms.Button(); - this.fraControlTransfers = new System.Windows.Forms.GroupBox(); - this.cmdGetFeatureReport = new System.Windows.Forms.Button(); - this.cmdSendFeatureReport = new System.Windows.Forms.Button(); - this.fraSendAndGetContinuous = new System.Windows.Forms.GroupBox(); - this.radInputOutputInterrupt = new System.Windows.Forms.RadioButton(); - this.radInputOutputControl = new System.Windows.Forms.RadioButton(); - this.radFeature = new System.Windows.Forms.RadioButton(); - this.FraBytesReceived.SuspendLayout(); - this.FraBytesToSend.SuspendLayout(); - this.fraInputReportBufferSize.SuspendLayout(); - this.fraDeviceIdentifiers.SuspendLayout(); - this.fraInterruptTransfers.SuspendLayout(); - this.fraControlTransfers.SuspendLayout(); - this.fraSendAndGetContinuous.SuspendLayout(); - this.SuspendLayout(); - // - // fraBytesReceived - // - this.FraBytesReceived.BackColor = System.Drawing.SystemColors.Control; - this.FraBytesReceived.Controls.Add(this.TxtBytesReceived); - this.FraBytesReceived.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FraBytesReceived.ForeColor = System.Drawing.SystemColors.ControlText; - this.FraBytesReceived.Location = new System.Drawing.Point(16, 272); - this.FraBytesReceived.Name = "FraBytesReceived"; - this.FraBytesReceived.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.FraBytesReceived.Size = new System.Drawing.Size(112, 136); - this.FraBytesReceived.TabIndex = 4; - this.FraBytesReceived.TabStop = false; - this.FraBytesReceived.Text = "Bytes Received"; - // - // txtBytesReceived - // - this.TxtBytesReceived.AcceptsReturn = true; - this.TxtBytesReceived.BackColor = System.Drawing.SystemColors.Window; - this.TxtBytesReceived.Cursor = System.Windows.Forms.Cursors.IBeam; - this.TxtBytesReceived.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TxtBytesReceived.ForeColor = System.Drawing.SystemColors.WindowText; - this.TxtBytesReceived.Location = new System.Drawing.Point(18, 24); - this.TxtBytesReceived.MaxLength = 0; - this.TxtBytesReceived.Multiline = true; - this.TxtBytesReceived.Name = "TxtBytesReceived"; - this.TxtBytesReceived.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.TxtBytesReceived.Size = new System.Drawing.Size(72, 96); - this.TxtBytesReceived.TabIndex = 5; - // - // fraBytesToSend - // - this.FraBytesToSend.BackColor = System.Drawing.SystemColors.Control; - this.FraBytesToSend.Controls.Add(this.ChkAutoincrement); - this.FraBytesToSend.Controls.Add(this.CboByte1); - this.FraBytesToSend.Controls.Add(this.CboByte0); - this.FraBytesToSend.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FraBytesToSend.ForeColor = System.Drawing.SystemColors.ControlText; - this.FraBytesToSend.Location = new System.Drawing.Point(16, 128); - this.FraBytesToSend.Name = "FraBytesToSend"; - this.FraBytesToSend.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.FraBytesToSend.Size = new System.Drawing.Size(160, 136); - this.FraBytesToSend.TabIndex = 1; - this.FraBytesToSend.TabStop = false; - this.FraBytesToSend.Text = "Bytes to Send"; - // - // chkAutoincrement - // - this.ChkAutoincrement.BackColor = System.Drawing.SystemColors.Control; - this.ChkAutoincrement.Cursor = System.Windows.Forms.Cursors.Default; - this.ChkAutoincrement.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.ChkAutoincrement.ForeColor = System.Drawing.SystemColors.ControlText; - this.ChkAutoincrement.Location = new System.Drawing.Point(8, 96); - this.ChkAutoincrement.Name = "ChkAutoincrement"; - this.ChkAutoincrement.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.ChkAutoincrement.Size = new System.Drawing.Size(201, 35); - this.ChkAutoincrement.TabIndex = 6; - this.ChkAutoincrement.Text = "Autoincrement values"; - this.ChkAutoincrement.UseVisualStyleBackColor = false; - // - // cboByte1 - // - this.CboByte1.BackColor = System.Drawing.SystemColors.Window; - this.CboByte1.Cursor = System.Windows.Forms.Cursors.Default; - this.CboByte1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CboByte1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.CboByte1.ForeColor = System.Drawing.SystemColors.WindowText; - this.CboByte1.Location = new System.Drawing.Point(8, 64); - this.CboByte1.Name = "CboByte1"; - this.CboByte1.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.CboByte1.Size = new System.Drawing.Size(101, 22); - this.CboByte1.TabIndex = 3; - // - // cboByte0 - // - this.CboByte0.BackColor = System.Drawing.SystemColors.Window; - this.CboByte0.Cursor = System.Windows.Forms.Cursors.Default; - this.CboByte0.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.CboByte0.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.CboByte0.ForeColor = System.Drawing.SystemColors.WindowText; - this.CboByte0.Location = new System.Drawing.Point(8, 24); - this.CboByte0.Name = "CboByte0"; - this.CboByte0.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.CboByte0.Size = new System.Drawing.Size(101, 22); - this.CboByte0.TabIndex = 2; - // - // lstResults - // - this.LstResults.BackColor = System.Drawing.SystemColors.Window; - this.LstResults.Cursor = System.Windows.Forms.Cursors.Default; - this.LstResults.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LstResults.ForeColor = System.Drawing.SystemColors.WindowText; - this.LstResults.HorizontalScrollbar = true; - this.LstResults.ItemHeight = 14; - this.LstResults.Location = new System.Drawing.Point(12, 424); - this.LstResults.Name = "LstResults"; - this.LstResults.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.LstResults.Size = new System.Drawing.Size(760, 326); - this.LstResults.TabIndex = 0; - // - // fraInputReportBufferSize - // - this.fraInputReportBufferSize.Controls.Add(this.cmdInputReportBufferSize); - this.fraInputReportBufferSize.Controls.Add(this.txtInputReportBufferSize); - this.fraInputReportBufferSize.Location = new System.Drawing.Point(248, 16); - this.fraInputReportBufferSize.Name = "fraInputReportBufferSize"; - this.fraInputReportBufferSize.Size = new System.Drawing.Size(208, 96); - this.fraInputReportBufferSize.TabIndex = 9; - this.fraInputReportBufferSize.TabStop = false; - this.fraInputReportBufferSize.Text = "Input Report Buffer Size"; - // - // cmdInputReportBufferSize - // - this.cmdInputReportBufferSize.Location = new System.Drawing.Point(96, 32); - this.cmdInputReportBufferSize.Name = "cmdInputReportBufferSize"; - this.cmdInputReportBufferSize.Size = new System.Drawing.Size(96, 56); - this.cmdInputReportBufferSize.TabIndex = 1; - this.cmdInputReportBufferSize.Text = "Change Buffer Size"; - this.cmdInputReportBufferSize.Click += new System.EventHandler(this.cmdInputReportBufferSize_Click); - // - // txtInputReportBufferSize - // - this.txtInputReportBufferSize.Location = new System.Drawing.Point(16, 40); - this.txtInputReportBufferSize.Name = "txtInputReportBufferSize"; - this.txtInputReportBufferSize.Size = new System.Drawing.Size(56, 20); - this.txtInputReportBufferSize.TabIndex = 0; - // - // fraDeviceIdentifiers - // - this.fraDeviceIdentifiers.Controls.Add(this.txtProductID); - this.fraDeviceIdentifiers.Controls.Add(this.lblProductID); - this.fraDeviceIdentifiers.Controls.Add(this.txtVendorID); - this.fraDeviceIdentifiers.Controls.Add(this.lblVendorID); - this.fraDeviceIdentifiers.Location = new System.Drawing.Point(16, 16); - this.fraDeviceIdentifiers.Name = "fraDeviceIdentifiers"; - this.fraDeviceIdentifiers.Size = new System.Drawing.Size(208, 96); - this.fraDeviceIdentifiers.TabIndex = 10; - this.fraDeviceIdentifiers.TabStop = false; - this.fraDeviceIdentifiers.Text = "Device Identifiers"; - // - // txtProductID - // - this.txtProductID.Location = new System.Drawing.Point(120, 56); - this.txtProductID.Name = "txtProductID"; - this.txtProductID.Size = new System.Drawing.Size(72, 20); - this.txtProductID.TabIndex = 3; - this.txtProductID.Text = "1299"; - this.txtProductID.TextChanged += new System.EventHandler(this.txtProductID_TextChanged); - // - // lblProductID - // - this.lblProductID.Location = new System.Drawing.Point(16, 56); - this.lblProductID.Name = "lblProductID"; - this.lblProductID.Size = new System.Drawing.Size(112, 23); - this.lblProductID.TabIndex = 2; - this.lblProductID.Text = "Product ID (hex):"; - // - // txtVendorID - // - this.txtVendorID.Location = new System.Drawing.Point(120, 24); - this.txtVendorID.Name = "txtVendorID"; - this.txtVendorID.Size = new System.Drawing.Size(72, 20); - this.txtVendorID.TabIndex = 1; - this.txtVendorID.Text = "0925"; - this.txtVendorID.TextChanged += new System.EventHandler(this.txtVendorID_TextChanged); - // - // lblVendorID - // - this.lblVendorID.Location = new System.Drawing.Point(16, 24); - this.lblVendorID.Name = "lblVendorID"; - this.lblVendorID.Size = new System.Drawing.Size(112, 23); - this.lblVendorID.TabIndex = 0; - this.lblVendorID.Text = "Vendor ID (hex):"; - // - // cmdFindDevice - // - this.cmdFindDevice.Location = new System.Drawing.Point(483, 37); - this.cmdFindDevice.Name = "cmdFindDevice"; - this.cmdFindDevice.Size = new System.Drawing.Size(136, 55); - this.cmdFindDevice.TabIndex = 11; - this.cmdFindDevice.Text = "Find My Device"; - this.cmdFindDevice.Click += new System.EventHandler(this.cmdFindDevice_Click); - // - // cmdSendOutputReportInterrupt - // - this.cmdSendOutputReportInterrupt.Location = new System.Drawing.Point(10, 27); - this.cmdSendOutputReportInterrupt.Name = "cmdSendOutputReportInterrupt"; - this.cmdSendOutputReportInterrupt.Size = new System.Drawing.Size(118, 50); - this.cmdSendOutputReportInterrupt.TabIndex = 12; - this.cmdSendOutputReportInterrupt.Text = "Send Output Report"; - this.cmdSendOutputReportInterrupt.UseVisualStyleBackColor = true; - this.cmdSendOutputReportInterrupt.Click += new System.EventHandler(this.cmdSendOutputReportInterrupt_Click); - // - // cmdGetInputReportInterrupt - // - this.cmdGetInputReportInterrupt.Location = new System.Drawing.Point(10, 83); - this.cmdGetInputReportInterrupt.Name = "cmdGetInputReportInterrupt"; - this.cmdGetInputReportInterrupt.Size = new System.Drawing.Size(118, 50); - this.cmdGetInputReportInterrupt.TabIndex = 13; - this.cmdGetInputReportInterrupt.Text = "Get Input Report"; - this.cmdGetInputReportInterrupt.UseVisualStyleBackColor = true; - this.cmdGetInputReportInterrupt.Click += new System.EventHandler(this.cmdGetInputReportInterrupt_Click); - // - // fraInterruptTransfers - // - this.fraInterruptTransfers.BackColor = System.Drawing.SystemColors.Control; - this.fraInterruptTransfers.Controls.Add(this.cmdSendOutputReportInterrupt); - this.fraInterruptTransfers.Controls.Add(this.cmdGetInputReportInterrupt); - this.fraInterruptTransfers.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.fraInterruptTransfers.ForeColor = System.Drawing.SystemColors.ControlText; - this.fraInterruptTransfers.Location = new System.Drawing.Point(194, 128); - this.fraInterruptTransfers.Name = "fraInterruptTransfers"; - this.fraInterruptTransfers.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.fraInterruptTransfers.Size = new System.Drawing.Size(145, 152); - this.fraInterruptTransfers.TabIndex = 14; - this.fraInterruptTransfers.TabStop = false; - this.fraInterruptTransfers.Text = "Interrupt Transfers"; - // - // cmdPeriodicTransfers - // - this.cmdPeriodicTransfers.Location = new System.Drawing.Point(153, 36); - this.cmdPeriodicTransfers.Name = "cmdPeriodicTransfers"; - this.cmdPeriodicTransfers.Size = new System.Drawing.Size(118, 51); - this.cmdPeriodicTransfers.TabIndex = 16; - this.cmdPeriodicTransfers.Text = "Start"; - this.cmdPeriodicTransfers.UseVisualStyleBackColor = true; - this.cmdPeriodicTransfers.Click += new System.EventHandler(this.cmdPeriodicTransfers_Click); - // - // cmdSendOutputReportControl - // - this.cmdSendOutputReportControl.Location = new System.Drawing.Point(10, 27); - this.cmdSendOutputReportControl.Name = "cmdSendOutputReportControl"; - this.cmdSendOutputReportControl.Size = new System.Drawing.Size(118, 50); - this.cmdSendOutputReportControl.TabIndex = 12; - this.cmdSendOutputReportControl.Text = "Send Output Report"; - this.cmdSendOutputReportControl.UseVisualStyleBackColor = true; - this.cmdSendOutputReportControl.Click += new System.EventHandler(this.cmdSendOutputReportControl_Click); - // - // cmdGetInputReportControl - // - this.cmdGetInputReportControl.Location = new System.Drawing.Point(10, 83); - this.cmdGetInputReportControl.Name = "cmdGetInputReportControl"; - this.cmdGetInputReportControl.Size = new System.Drawing.Size(118, 50); - this.cmdGetInputReportControl.TabIndex = 13; - this.cmdGetInputReportControl.Text = "Get Input Report"; - this.cmdGetInputReportControl.UseVisualStyleBackColor = true; - this.cmdGetInputReportControl.Click += new System.EventHandler(this.cmdGetInputReportControl_Click); - // - // fraControlTransfers - // - this.fraControlTransfers.BackColor = System.Drawing.SystemColors.Control; - this.fraControlTransfers.Controls.Add(this.cmdGetFeatureReport); - this.fraControlTransfers.Controls.Add(this.cmdSendFeatureReport); - this.fraControlTransfers.Controls.Add(this.cmdSendOutputReportControl); - this.fraControlTransfers.Controls.Add(this.cmdGetInputReportControl); - this.fraControlTransfers.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.fraControlTransfers.ForeColor = System.Drawing.SystemColors.ControlText; - this.fraControlTransfers.Location = new System.Drawing.Point(359, 128); - this.fraControlTransfers.Name = "fraControlTransfers"; - this.fraControlTransfers.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.fraControlTransfers.Size = new System.Drawing.Size(277, 152); - this.fraControlTransfers.TabIndex = 15; - this.fraControlTransfers.TabStop = false; - this.fraControlTransfers.Text = "Control Transfers"; - // - // cmdGetFeatureReport - // - this.cmdGetFeatureReport.Location = new System.Drawing.Point(141, 83); - this.cmdGetFeatureReport.Name = "cmdGetFeatureReport"; - this.cmdGetFeatureReport.Size = new System.Drawing.Size(118, 50); - this.cmdGetFeatureReport.TabIndex = 15; - this.cmdGetFeatureReport.Text = "Get Feature Report"; - this.cmdGetFeatureReport.UseVisualStyleBackColor = true; - this.cmdGetFeatureReport.Click += new System.EventHandler(this.cmdGetFeatureReport_Click); - // - // cmdSendFeatureReport - // - this.cmdSendFeatureReport.Location = new System.Drawing.Point(141, 27); - this.cmdSendFeatureReport.Name = "cmdSendFeatureReport"; - this.cmdSendFeatureReport.Size = new System.Drawing.Size(118, 50); - this.cmdSendFeatureReport.TabIndex = 14; - this.cmdSendFeatureReport.Text = "Send Feature Report"; - this.cmdSendFeatureReport.UseVisualStyleBackColor = true; - this.cmdSendFeatureReport.Click += new System.EventHandler(this.cmdSendFeatureReport_Click); - // - // fraSendAndGetContinuous - // - this.fraSendAndGetContinuous.BackColor = System.Drawing.SystemColors.Control; - this.fraSendAndGetContinuous.Controls.Add(this.radFeature); - this.fraSendAndGetContinuous.Controls.Add(this.radInputOutputControl); - this.fraSendAndGetContinuous.Controls.Add(this.radInputOutputInterrupt); - this.fraSendAndGetContinuous.Controls.Add(this.cmdPeriodicTransfers); - this.fraSendAndGetContinuous.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.fraSendAndGetContinuous.ForeColor = System.Drawing.SystemColors.ControlText; - this.fraSendAndGetContinuous.Location = new System.Drawing.Point(194, 296); - this.fraSendAndGetContinuous.Name = "fraSendAndGetContinuous"; - this.fraSendAndGetContinuous.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.fraSendAndGetContinuous.Size = new System.Drawing.Size(295, 112); - this.fraSendAndGetContinuous.TabIndex = 17; - this.fraSendAndGetContinuous.TabStop = false; - this.fraSendAndGetContinuous.Text = "Send and Get Continuous"; - // - // radInputOutputInterrupt - // - this.radInputOutputInterrupt.AutoSize = true; - this.radInputOutputInterrupt.Location = new System.Drawing.Point(17, 28); - this.radInputOutputInterrupt.Name = "radInputOutputInterrupt"; - this.radInputOutputInterrupt.Size = new System.Drawing.Size(126, 18); - this.radInputOutputInterrupt.TabIndex = 17; - this.radInputOutputInterrupt.TabStop = true; - this.radInputOutputInterrupt.Text = "Input Output Interrupt"; - this.radInputOutputInterrupt.UseVisualStyleBackColor = true; - this.radInputOutputInterrupt.CheckedChanged += new System.EventHandler(this.radInputOutputInterrupt_CheckedChanged); - // - // radInputOutputControl - // - this.radInputOutputControl.AutoSize = true; - this.radInputOutputControl.Location = new System.Drawing.Point(17, 52); - this.radInputOutputControl.Name = "radInputOutputControl"; - this.radInputOutputControl.Size = new System.Drawing.Size(120, 18); - this.radInputOutputControl.TabIndex = 18; - this.radInputOutputControl.TabStop = true; - this.radInputOutputControl.Text = "Input Output Control"; - this.radInputOutputControl.UseVisualStyleBackColor = true; - this.radInputOutputControl.CheckedChanged += new System.EventHandler(this.radInputOutputControl_CheckedChanged); - // - // radFeature - // - this.radFeature.AutoSize = true; - this.radFeature.Location = new System.Drawing.Point(17, 76); - this.radFeature.Name = "radFeature"; - this.radFeature.Size = new System.Drawing.Size(62, 18); - this.radFeature.TabIndex = 19; - this.radFeature.TabStop = true; - this.radFeature.Text = "Feature"; - this.radFeature.UseVisualStyleBackColor = true; - this.radFeature.CheckedChanged += new System.EventHandler(this.radFeature_CheckedChanged); - // - // FrmMain - // - this.ClientSize = new System.Drawing.Size(784, 756); - this.Controls.Add(this.fraSendAndGetContinuous); - this.Controls.Add(this.fraControlTransfers); - this.Controls.Add(this.fraInterruptTransfers); - this.Controls.Add(this.cmdFindDevice); - this.Controls.Add(this.fraDeviceIdentifiers); - this.Controls.Add(this.fraInputReportBufferSize); - this.Controls.Add(this.FraBytesReceived); - this.Controls.Add(this.FraBytesToSend); - this.Controls.Add(this.LstResults); - this.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Location = new System.Drawing.Point(21, 28); - this.Name = "FrmMain"; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "Generic HID Tester"; - this.Closed += new System.EventHandler(this.frmMain_Closed); - this.Load += new System.EventHandler(this.frmMain_Load); - this.FraBytesReceived.ResumeLayout(false); - this.FraBytesReceived.PerformLayout(); - this.FraBytesToSend.ResumeLayout(false); - this.fraInputReportBufferSize.ResumeLayout(false); - this.fraInputReportBufferSize.PerformLayout(); - this.fraDeviceIdentifiers.ResumeLayout(false); - this.fraDeviceIdentifiers.PerformLayout(); - this.fraInterruptTransfers.ResumeLayout(false); - this.fraControlTransfers.ResumeLayout(false); - this.fraSendAndGetContinuous.ResumeLayout(false); - this.fraSendAndGetContinuous.PerformLayout(); - this.ResumeLayout(false); + this.components = new System.ComponentModel.Container(); + this.ToolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.FraBytesReceived = new System.Windows.Forms.GroupBox(); + this.TxtBytesReceived = new System.Windows.Forms.TextBox(); + this.FraBytesToSend = new System.Windows.Forms.GroupBox(); + this.ChkAutoincrement = new System.Windows.Forms.CheckBox(); + this.CboByte1 = new System.Windows.Forms.ComboBox(); + this.CboByte0 = new System.Windows.Forms.ComboBox(); + this.LstResults = new System.Windows.Forms.ListBox(); + this.fraInputReportBufferSize = new System.Windows.Forms.GroupBox(); + this.cmdInputReportBufferSize = new System.Windows.Forms.Button(); + this.txtInputReportBufferSize = new System.Windows.Forms.TextBox(); + this.fraDeviceIdentifiers = new System.Windows.Forms.GroupBox(); + this.txtProductID = new System.Windows.Forms.TextBox(); + this.lblProductID = new System.Windows.Forms.Label(); + this.txtVendorID = new System.Windows.Forms.TextBox(); + this.lblVendorID = new System.Windows.Forms.Label(); + this.cmdFindDevice = new System.Windows.Forms.Button(); + this.cmdSendOutputReportInterrupt = new System.Windows.Forms.Button(); + this.cmdGetInputReportInterrupt = new System.Windows.Forms.Button(); + this.fraInterruptTransfers = new System.Windows.Forms.GroupBox(); + this.cmdPeriodicTransfers = new System.Windows.Forms.Button(); + this.cmdSendOutputReportControl = new System.Windows.Forms.Button(); + this.cmdGetInputReportControl = new System.Windows.Forms.Button(); + this.fraControlTransfers = new System.Windows.Forms.GroupBox(); + this.cmdGetFeatureReport = new System.Windows.Forms.Button(); + this.cmdSendFeatureReport = new System.Windows.Forms.Button(); + this.fraSendAndGetContinuous = new System.Windows.Forms.GroupBox(); + this.radFeature = new System.Windows.Forms.RadioButton(); + this.radInputOutputControl = new System.Windows.Forms.RadioButton(); + this.radInputOutputInterrupt = new System.Windows.Forms.RadioButton(); + this.treeViewDevices = new System.Windows.Forms.TreeView(); + this.FraBytesReceived.SuspendLayout(); + this.FraBytesToSend.SuspendLayout(); + this.fraInputReportBufferSize.SuspendLayout(); + this.fraDeviceIdentifiers.SuspendLayout(); + this.fraInterruptTransfers.SuspendLayout(); + this.fraControlTransfers.SuspendLayout(); + this.fraSendAndGetContinuous.SuspendLayout(); + this.SuspendLayout(); + // + // FraBytesReceived + // + this.FraBytesReceived.BackColor = System.Drawing.SystemColors.Control; + this.FraBytesReceived.Controls.Add(this.TxtBytesReceived); + this.FraBytesReceived.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FraBytesReceived.ForeColor = System.Drawing.SystemColors.ControlText; + this.FraBytesReceived.Location = new System.Drawing.Point(495, 353); + this.FraBytesReceived.Name = "FraBytesReceived"; + this.FraBytesReceived.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.FraBytesReceived.Size = new System.Drawing.Size(112, 136); + this.FraBytesReceived.TabIndex = 4; + this.FraBytesReceived.TabStop = false; + this.FraBytesReceived.Text = "Bytes Received"; + // + // TxtBytesReceived + // + this.TxtBytesReceived.AcceptsReturn = true; + this.TxtBytesReceived.BackColor = System.Drawing.SystemColors.Window; + this.TxtBytesReceived.Cursor = System.Windows.Forms.Cursors.IBeam; + this.TxtBytesReceived.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.TxtBytesReceived.ForeColor = System.Drawing.SystemColors.WindowText; + this.TxtBytesReceived.Location = new System.Drawing.Point(18, 24); + this.TxtBytesReceived.MaxLength = 0; + this.TxtBytesReceived.Multiline = true; + this.TxtBytesReceived.Name = "TxtBytesReceived"; + this.TxtBytesReceived.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.TxtBytesReceived.Size = new System.Drawing.Size(72, 96); + this.TxtBytesReceived.TabIndex = 5; + // + // FraBytesToSend + // + this.FraBytesToSend.BackColor = System.Drawing.SystemColors.Control; + this.FraBytesToSend.Controls.Add(this.ChkAutoincrement); + this.FraBytesToSend.Controls.Add(this.CboByte1); + this.FraBytesToSend.Controls.Add(this.CboByte0); + this.FraBytesToSend.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FraBytesToSend.ForeColor = System.Drawing.SystemColors.ControlText; + this.FraBytesToSend.Location = new System.Drawing.Point(612, 235); + this.FraBytesToSend.Name = "FraBytesToSend"; + this.FraBytesToSend.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.FraBytesToSend.Size = new System.Drawing.Size(160, 136); + this.FraBytesToSend.TabIndex = 1; + this.FraBytesToSend.TabStop = false; + this.FraBytesToSend.Text = "Bytes to Send"; + // + // ChkAutoincrement + // + this.ChkAutoincrement.BackColor = System.Drawing.SystemColors.Control; + this.ChkAutoincrement.Cursor = System.Windows.Forms.Cursors.Default; + this.ChkAutoincrement.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ChkAutoincrement.ForeColor = System.Drawing.SystemColors.ControlText; + this.ChkAutoincrement.Location = new System.Drawing.Point(8, 96); + this.ChkAutoincrement.Name = "ChkAutoincrement"; + this.ChkAutoincrement.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.ChkAutoincrement.Size = new System.Drawing.Size(201, 35); + this.ChkAutoincrement.TabIndex = 6; + this.ChkAutoincrement.Text = "Autoincrement values"; + this.ChkAutoincrement.UseVisualStyleBackColor = false; + // + // CboByte1 + // + this.CboByte1.BackColor = System.Drawing.SystemColors.Window; + this.CboByte1.Cursor = System.Windows.Forms.Cursors.Default; + this.CboByte1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CboByte1.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.CboByte1.ForeColor = System.Drawing.SystemColors.WindowText; + this.CboByte1.Location = new System.Drawing.Point(8, 64); + this.CboByte1.Name = "CboByte1"; + this.CboByte1.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.CboByte1.Size = new System.Drawing.Size(101, 22); + this.CboByte1.TabIndex = 3; + // + // CboByte0 + // + this.CboByte0.BackColor = System.Drawing.SystemColors.Window; + this.CboByte0.Cursor = System.Windows.Forms.Cursors.Default; + this.CboByte0.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CboByte0.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.CboByte0.ForeColor = System.Drawing.SystemColors.WindowText; + this.CboByte0.Location = new System.Drawing.Point(8, 24); + this.CboByte0.Name = "CboByte0"; + this.CboByte0.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.CboByte0.Size = new System.Drawing.Size(101, 22); + this.CboByte0.TabIndex = 2; + // + // LstResults + // + this.LstResults.BackColor = System.Drawing.SystemColors.Window; + this.LstResults.Cursor = System.Windows.Forms.Cursors.Default; + this.LstResults.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LstResults.ForeColor = System.Drawing.SystemColors.WindowText; + this.LstResults.HorizontalScrollbar = true; + this.LstResults.ItemHeight = 14; + this.LstResults.Location = new System.Drawing.Point(12, 494); + this.LstResults.Name = "LstResults"; + this.LstResults.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.LstResults.Size = new System.Drawing.Size(760, 256); + this.LstResults.TabIndex = 0; + // + // fraInputReportBufferSize + // + this.fraInputReportBufferSize.Controls.Add(this.cmdInputReportBufferSize); + this.fraInputReportBufferSize.Controls.Add(this.txtInputReportBufferSize); + this.fraInputReportBufferSize.Location = new System.Drawing.Point(623, 44); + this.fraInputReportBufferSize.Name = "fraInputReportBufferSize"; + this.fraInputReportBufferSize.Size = new System.Drawing.Size(149, 79); + this.fraInputReportBufferSize.TabIndex = 9; + this.fraInputReportBufferSize.TabStop = false; + this.fraInputReportBufferSize.Text = "Input Report Buffer Size"; + // + // cmdInputReportBufferSize + // + this.cmdInputReportBufferSize.Location = new System.Drawing.Point(6, 47); + this.cmdInputReportBufferSize.Name = "cmdInputReportBufferSize"; + this.cmdInputReportBufferSize.Size = new System.Drawing.Size(136, 26); + this.cmdInputReportBufferSize.TabIndex = 1; + this.cmdInputReportBufferSize.Text = "Change Buffer Size"; + this.cmdInputReportBufferSize.Click += new System.EventHandler(this.cmdInputReportBufferSize_Click); + // + // txtInputReportBufferSize + // + this.txtInputReportBufferSize.Location = new System.Drawing.Point(6, 21); + this.txtInputReportBufferSize.Name = "txtInputReportBufferSize"; + this.txtInputReportBufferSize.Size = new System.Drawing.Size(56, 20); + this.txtInputReportBufferSize.TabIndex = 0; + // + // fraDeviceIdentifiers + // + this.fraDeviceIdentifiers.Controls.Add(this.txtProductID); + this.fraDeviceIdentifiers.Controls.Add(this.lblProductID); + this.fraDeviceIdentifiers.Controls.Add(this.txtVendorID); + this.fraDeviceIdentifiers.Controls.Add(this.lblVendorID); + this.fraDeviceIdentifiers.Location = new System.Drawing.Point(409, 12); + this.fraDeviceIdentifiers.Name = "fraDeviceIdentifiers"; + this.fraDeviceIdentifiers.Size = new System.Drawing.Size(208, 96); + this.fraDeviceIdentifiers.TabIndex = 10; + this.fraDeviceIdentifiers.TabStop = false; + this.fraDeviceIdentifiers.Text = "Device Identifiers"; + // + // txtProductID + // + this.txtProductID.Location = new System.Drawing.Point(120, 56); + this.txtProductID.Name = "txtProductID"; + this.txtProductID.Size = new System.Drawing.Size(72, 20); + this.txtProductID.TabIndex = 3; + this.txtProductID.Text = "1299"; + this.txtProductID.TextChanged += new System.EventHandler(this.txtProductID_TextChanged); + // + // lblProductID + // + this.lblProductID.Location = new System.Drawing.Point(16, 56); + this.lblProductID.Name = "lblProductID"; + this.lblProductID.Size = new System.Drawing.Size(112, 23); + this.lblProductID.TabIndex = 2; + this.lblProductID.Text = "Product ID (hex):"; + // + // txtVendorID + // + this.txtVendorID.Location = new System.Drawing.Point(120, 24); + this.txtVendorID.Name = "txtVendorID"; + this.txtVendorID.Size = new System.Drawing.Size(72, 20); + this.txtVendorID.TabIndex = 1; + this.txtVendorID.Text = "0925"; + this.txtVendorID.TextChanged += new System.EventHandler(this.txtVendorID_TextChanged); + // + // lblVendorID + // + this.lblVendorID.Location = new System.Drawing.Point(16, 24); + this.lblVendorID.Name = "lblVendorID"; + this.lblVendorID.Size = new System.Drawing.Size(112, 23); + this.lblVendorID.TabIndex = 0; + this.lblVendorID.Text = "Vendor ID (hex):"; + // + // cmdFindDevice + // + this.cmdFindDevice.Location = new System.Drawing.Point(636, 12); + this.cmdFindDevice.Name = "cmdFindDevice"; + this.cmdFindDevice.Size = new System.Drawing.Size(136, 26); + this.cmdFindDevice.TabIndex = 11; + this.cmdFindDevice.Text = "Find My Device"; + this.cmdFindDevice.Click += new System.EventHandler(this.cmdFindDevice_Click); + // + // cmdSendOutputReportInterrupt + // + this.cmdSendOutputReportInterrupt.Location = new System.Drawing.Point(21, 27); + this.cmdSendOutputReportInterrupt.Name = "cmdSendOutputReportInterrupt"; + this.cmdSendOutputReportInterrupt.Size = new System.Drawing.Size(118, 26); + this.cmdSendOutputReportInterrupt.TabIndex = 12; + this.cmdSendOutputReportInterrupt.Text = "Send Output Report"; + this.cmdSendOutputReportInterrupt.UseVisualStyleBackColor = true; + this.cmdSendOutputReportInterrupt.Click += new System.EventHandler(this.cmdSendOutputReportInterrupt_Click); + // + // cmdGetInputReportInterrupt + // + this.cmdGetInputReportInterrupt.Location = new System.Drawing.Point(21, 60); + this.cmdGetInputReportInterrupt.Name = "cmdGetInputReportInterrupt"; + this.cmdGetInputReportInterrupt.Size = new System.Drawing.Size(118, 26); + this.cmdGetInputReportInterrupt.TabIndex = 13; + this.cmdGetInputReportInterrupt.Text = "Get Input Report"; + this.cmdGetInputReportInterrupt.UseVisualStyleBackColor = true; + this.cmdGetInputReportInterrupt.Click += new System.EventHandler(this.cmdGetInputReportInterrupt_Click); + // + // fraInterruptTransfers + // + this.fraInterruptTransfers.BackColor = System.Drawing.SystemColors.Control; + this.fraInterruptTransfers.Controls.Add(this.cmdSendOutputReportInterrupt); + this.fraInterruptTransfers.Controls.Add(this.cmdGetInputReportInterrupt); + this.fraInterruptTransfers.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.fraInterruptTransfers.ForeColor = System.Drawing.SystemColors.ControlText; + this.fraInterruptTransfers.Location = new System.Drawing.Point(338, 129); + this.fraInterruptTransfers.Name = "fraInterruptTransfers"; + this.fraInterruptTransfers.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.fraInterruptTransfers.Size = new System.Drawing.Size(151, 100); + this.fraInterruptTransfers.TabIndex = 14; + this.fraInterruptTransfers.TabStop = false; + this.fraInterruptTransfers.Text = "Interrupt Transfers"; + // + // cmdPeriodicTransfers + // + this.cmdPeriodicTransfers.Location = new System.Drawing.Point(153, 36); + this.cmdPeriodicTransfers.Name = "cmdPeriodicTransfers"; + this.cmdPeriodicTransfers.Size = new System.Drawing.Size(118, 26); + this.cmdPeriodicTransfers.TabIndex = 16; + this.cmdPeriodicTransfers.Text = "Start"; + this.cmdPeriodicTransfers.UseVisualStyleBackColor = true; + this.cmdPeriodicTransfers.Click += new System.EventHandler(this.cmdPeriodicTransfers_Click); + // + // cmdSendOutputReportControl + // + this.cmdSendOutputReportControl.Location = new System.Drawing.Point(10, 27); + this.cmdSendOutputReportControl.Name = "cmdSendOutputReportControl"; + this.cmdSendOutputReportControl.Size = new System.Drawing.Size(118, 26); + this.cmdSendOutputReportControl.TabIndex = 12; + this.cmdSendOutputReportControl.Text = "Send Output Report"; + this.cmdSendOutputReportControl.UseVisualStyleBackColor = true; + this.cmdSendOutputReportControl.Click += new System.EventHandler(this.cmdSendOutputReportControl_Click); + // + // cmdGetInputReportControl + // + this.cmdGetInputReportControl.Location = new System.Drawing.Point(10, 60); + this.cmdGetInputReportControl.Name = "cmdGetInputReportControl"; + this.cmdGetInputReportControl.Size = new System.Drawing.Size(118, 26); + this.cmdGetInputReportControl.TabIndex = 13; + this.cmdGetInputReportControl.Text = "Get Input Report"; + this.cmdGetInputReportControl.UseVisualStyleBackColor = true; + this.cmdGetInputReportControl.Click += new System.EventHandler(this.cmdGetInputReportControl_Click); + // + // fraControlTransfers + // + this.fraControlTransfers.BackColor = System.Drawing.SystemColors.Control; + this.fraControlTransfers.Controls.Add(this.cmdGetFeatureReport); + this.fraControlTransfers.Controls.Add(this.cmdSendFeatureReport); + this.fraControlTransfers.Controls.Add(this.cmdSendOutputReportControl); + this.fraControlTransfers.Controls.Add(this.cmdGetInputReportControl); + this.fraControlTransfers.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.fraControlTransfers.ForeColor = System.Drawing.SystemColors.ControlText; + this.fraControlTransfers.Location = new System.Drawing.Point(495, 129); + this.fraControlTransfers.Name = "fraControlTransfers"; + this.fraControlTransfers.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.fraControlTransfers.Size = new System.Drawing.Size(277, 100); + this.fraControlTransfers.TabIndex = 15; + this.fraControlTransfers.TabStop = false; + this.fraControlTransfers.Text = "Control Transfers"; + // + // cmdGetFeatureReport + // + this.cmdGetFeatureReport.Location = new System.Drawing.Point(141, 60); + this.cmdGetFeatureReport.Name = "cmdGetFeatureReport"; + this.cmdGetFeatureReport.Size = new System.Drawing.Size(118, 26); + this.cmdGetFeatureReport.TabIndex = 15; + this.cmdGetFeatureReport.Text = "Get Feature Report"; + this.cmdGetFeatureReport.UseVisualStyleBackColor = true; + this.cmdGetFeatureReport.Click += new System.EventHandler(this.cmdGetFeatureReport_Click); + // + // cmdSendFeatureReport + // + this.cmdSendFeatureReport.Location = new System.Drawing.Point(141, 27); + this.cmdSendFeatureReport.Name = "cmdSendFeatureReport"; + this.cmdSendFeatureReport.Size = new System.Drawing.Size(118, 26); + this.cmdSendFeatureReport.TabIndex = 14; + this.cmdSendFeatureReport.Text = "Send Feature Report"; + this.cmdSendFeatureReport.UseVisualStyleBackColor = true; + this.cmdSendFeatureReport.Click += new System.EventHandler(this.cmdSendFeatureReport_Click); + // + // fraSendAndGetContinuous + // + this.fraSendAndGetContinuous.BackColor = System.Drawing.SystemColors.Control; + this.fraSendAndGetContinuous.Controls.Add(this.radFeature); + this.fraSendAndGetContinuous.Controls.Add(this.radInputOutputControl); + this.fraSendAndGetContinuous.Controls.Add(this.radInputOutputInterrupt); + this.fraSendAndGetContinuous.Controls.Add(this.cmdPeriodicTransfers); + this.fraSendAndGetContinuous.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.fraSendAndGetContinuous.ForeColor = System.Drawing.SystemColors.ControlText; + this.fraSendAndGetContinuous.Location = new System.Drawing.Point(311, 235); + this.fraSendAndGetContinuous.Name = "fraSendAndGetContinuous"; + this.fraSendAndGetContinuous.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.fraSendAndGetContinuous.Size = new System.Drawing.Size(295, 112); + this.fraSendAndGetContinuous.TabIndex = 17; + this.fraSendAndGetContinuous.TabStop = false; + this.fraSendAndGetContinuous.Text = "Send and Get Continuous"; + // + // radFeature + // + this.radFeature.AutoSize = true; + this.radFeature.Location = new System.Drawing.Point(17, 76); + this.radFeature.Name = "radFeature"; + this.radFeature.Size = new System.Drawing.Size(62, 18); + this.radFeature.TabIndex = 19; + this.radFeature.TabStop = true; + this.radFeature.Text = "Feature"; + this.radFeature.UseVisualStyleBackColor = true; + this.radFeature.CheckedChanged += new System.EventHandler(this.radFeature_CheckedChanged); + // + // radInputOutputControl + // + this.radInputOutputControl.AutoSize = true; + this.radInputOutputControl.Location = new System.Drawing.Point(17, 52); + this.radInputOutputControl.Name = "radInputOutputControl"; + this.radInputOutputControl.Size = new System.Drawing.Size(120, 18); + this.radInputOutputControl.TabIndex = 18; + this.radInputOutputControl.TabStop = true; + this.radInputOutputControl.Text = "Input Output Control"; + this.radInputOutputControl.UseVisualStyleBackColor = true; + this.radInputOutputControl.CheckedChanged += new System.EventHandler(this.radInputOutputControl_CheckedChanged); + // + // radInputOutputInterrupt + // + this.radInputOutputInterrupt.AutoSize = true; + this.radInputOutputInterrupt.Location = new System.Drawing.Point(17, 28); + this.radInputOutputInterrupt.Name = "radInputOutputInterrupt"; + this.radInputOutputInterrupt.Size = new System.Drawing.Size(126, 18); + this.radInputOutputInterrupt.TabIndex = 17; + this.radInputOutputInterrupt.TabStop = true; + this.radInputOutputInterrupt.Text = "Input Output Interrupt"; + this.radInputOutputInterrupt.UseVisualStyleBackColor = true; + this.radInputOutputInterrupt.CheckedChanged += new System.EventHandler(this.radInputOutputInterrupt_CheckedChanged); + // + // treeViewDevices + // + this.treeViewDevices.Location = new System.Drawing.Point(12, 12); + this.treeViewDevices.Name = "treeViewDevices"; + this.treeViewDevices.Size = new System.Drawing.Size(284, 461); + this.treeViewDevices.TabIndex = 18; + // + // FrmMain + // + this.ClientSize = new System.Drawing.Size(784, 756); + this.Controls.Add(this.treeViewDevices); + this.Controls.Add(this.fraSendAndGetContinuous); + this.Controls.Add(this.fraControlTransfers); + this.Controls.Add(this.fraInterruptTransfers); + this.Controls.Add(this.cmdFindDevice); + this.Controls.Add(this.fraDeviceIdentifiers); + this.Controls.Add(this.fraInputReportBufferSize); + this.Controls.Add(this.FraBytesReceived); + this.Controls.Add(this.FraBytesToSend); + this.Controls.Add(this.LstResults); + this.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Location = new System.Drawing.Point(21, 28); + this.Name = "FrmMain"; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Text = "Generic HID Tester"; + this.Closed += new System.EventHandler(this.frmMain_Closed); + this.Load += new System.EventHandler(this.frmMain_Load); + this.FraBytesReceived.ResumeLayout(false); + this.FraBytesReceived.PerformLayout(); + this.FraBytesToSend.ResumeLayout(false); + this.fraInputReportBufferSize.ResumeLayout(false); + this.fraInputReportBufferSize.PerformLayout(); + this.fraDeviceIdentifiers.ResumeLayout(false); + this.fraDeviceIdentifiers.PerformLayout(); + this.fraInterruptTransfers.ResumeLayout(false); + this.fraControlTransfers.ResumeLayout(false); + this.fraSendAndGetContinuous.ResumeLayout(false); + this.fraSendAndGetContinuous.PerformLayout(); + this.ResumeLayout(false); } #endregion '"Windows Form Designer generated code "' @@ -654,7 +666,10 @@ EnableInputReportBufferSize, EnableSendOutputReportInterrupt, ScrollToBottomOfListBox, - SetInputReportBufferSize + SetInputReportBufferSize, + AddDeviceToTreeView, + ResetDeviceTreeView, + SelectDeviceInTreeView } private enum ReportReadOrWritten @@ -698,7 +713,7 @@ // This delegate has the same parameters as AccessForm. // Used in accessing the application's form from a different thread. - private delegate void MarshalDataToForm(FormActions action, String textToAdd); + private delegate void MarshalDataToForm(FormActions action, params string[] strings); /// /// Performs various application-specific functions that @@ -709,7 +724,7 @@ /// text that the form displays or the code uses for /// another purpose. Actions that don't use text ignore this parameter. - private void AccessForm(FormActions action, String formText) + private void AccessForm(FormActions action, params string[] strings) { try { @@ -719,7 +734,7 @@ { case FormActions.AddItemToListBox: - LstResults.Items.Add(formText); + LstResults.Items.Add(strings[0]); break; case FormActions.DisableInputReportBufferSize: @@ -749,8 +764,41 @@ case FormActions.SetInputReportBufferSize: - txtInputReportBufferSize.Text = formText; + txtInputReportBufferSize.Text = strings[0]; break; + + case FormActions.AddDeviceToTreeView: + //Build our node from our string array + TreeNode newNode = new TreeNode(strings[0]); + for (int i=1;i0) + { + treeViewDevices.SelectedNode = res[0]; + treeViewDevices.SelectedNode.ForeColor = Color.Blue; + } + + + break; } } catch (Exception ex) @@ -1332,6 +1380,7 @@ { try { + MyMarshalDataToForm(FormActions.ResetDeviceTreeView); // Prepend "@" to string below to treat backslash as a normal character (not escape character): String deviceIdString = @"USB\VID_" + _myVendorId.ToString("X4") + "&PID_" + _myProductId.ToString("X4"); @@ -1345,33 +1394,40 @@ string deviceId = queryObj["PNPDeviceID"].ToString(); if (deviceId.Contains(deviceIdString)) { - usbDeviceCounter++; _deviceDetected = true; - MyMarshalDataToForm(FormActions.AddItemToListBox, "--------"); MyMarshalDataToForm(FormActions.AddItemToListBox, "My device found (WMI):"); + MyMarshalDataToForm(FormActions.AddItemToListBox, "--------"); + List device = new List(); + device.Add(deviceId); + usbDeviceCounter++; // Display device properties. - foreach (WmiDeviceProperties wmiDeviceProperty in Enum.GetValues(typeof(WmiDeviceProperties))) { MyMarshalDataToForm(FormActions.AddItemToListBox, (wmiDeviceProperty.ToString() + ": " + queryObj[wmiDeviceProperty.ToString()])); + device.Add((wmiDeviceProperty.ToString() + ": " + queryObj[wmiDeviceProperty.ToString()])); Debug.WriteLine(wmiDeviceProperty.ToString() + ": {0}", queryObj[wmiDeviceProperty.ToString()]); } MyMarshalDataToForm(FormActions.AddItemToListBox, "--------"); MyMarshalDataToForm(FormActions.ScrollToBottomOfListBox, ""); + + MyMarshalDataToForm(FormActions.AddDeviceToTreeView, device.ToArray()); + MyMarshalDataToForm(FormActions.SelectDeviceInTreeView, deviceId); + } - else if (deviceId.StartsWith("USB\\")) + else if (deviceId.StartsWith("USB\\VID")) { + List device = new List(); + device.Add(deviceId); usbDeviceCounter++; - MyMarshalDataToForm(FormActions.AddItemToListBox, "--------"); - MyMarshalDataToForm(FormActions.AddItemToListBox, "Skipping device:" + deviceId); + // Add device properties. foreach (WmiDeviceProperties wmiDeviceProperty in Enum.GetValues(typeof(WmiDeviceProperties))) { - MyMarshalDataToForm(FormActions.AddItemToListBox, (wmiDeviceProperty.ToString() + ": " + queryObj[wmiDeviceProperty.ToString()])); + device.Add((wmiDeviceProperty.ToString() + ": " + queryObj[wmiDeviceProperty.ToString()])); Debug.WriteLine(wmiDeviceProperty.ToString() + ": {0}", queryObj[wmiDeviceProperty.ToString()]); } - MyMarshalDataToForm(FormActions.AddItemToListBox, "--------"); - MyMarshalDataToForm(FormActions.ScrollToBottomOfListBox, ""); + + MyMarshalDataToForm(FormActions.AddDeviceToTreeView, device.ToArray()); } } @@ -1738,11 +1794,11 @@ /// text that the form displays or the code uses for /// another purpose. Actions that don't use text ignore this parameter. - private void MyMarshalDataToForm(FormActions action, String textToDisplay) + private void MyMarshalDataToForm(FormActions action, params string[] strings) { try { - object[] args = { action, textToDisplay }; + object[] args = { action, strings }; // The AccessForm routine contains the code that accesses the form.