using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Text;
using System.Runtime.InteropServices;
using System.Globalization;

namespace MultiIO
{
	/// <summary>
	/// Form1 ̊Tv̐łB
	/// </summary>
	public class MultiIO : System.Windows.Forms.Form
	{
		internal System.Windows.Forms.GroupBox GroupBox4;
		internal System.Windows.Forms.Label Label29;
		internal System.Windows.Forms.Label Label30;
		internal System.Windows.Forms.Label Label31;
		internal System.Windows.Forms.Label Label32;
		internal System.Windows.Forms.Label Label33;
		internal System.Windows.Forms.Label Label34;
		internal System.Windows.Forms.Label Label35;
		internal System.Windows.Forms.Label Label36;
		internal System.Windows.Forms.Label Label37;
		internal System.Windows.Forms.GroupBox GroupBox3;
		internal System.Windows.Forms.Label Label20;
		internal System.Windows.Forms.Label Label21;
		internal System.Windows.Forms.Label Label22;
		internal System.Windows.Forms.Label Label23;
		internal System.Windows.Forms.Label Label24;
		internal System.Windows.Forms.Label Label25;
		internal System.Windows.Forms.Label Label26;
		internal System.Windows.Forms.Label Label27;
		internal System.Windows.Forms.Label Label28;
		internal System.Windows.Forms.GroupBox GroupBox2;
		internal System.Windows.Forms.Label Label11;
		internal System.Windows.Forms.Label Label12;
		internal System.Windows.Forms.Label Label13;
		internal System.Windows.Forms.Label Label14;
		internal System.Windows.Forms.Label Label15;
		internal System.Windows.Forms.Label Label16;
		internal System.Windows.Forms.Label Label17;
		internal System.Windows.Forms.Label Label18;
		internal System.Windows.Forms.Label Label19;
		internal System.Windows.Forms.GroupBox GroupBox1;
		internal System.Windows.Forms.Label Label10;
		internal System.Windows.Forms.Label Label9;
		internal System.Windows.Forms.Label Label8;
		internal System.Windows.Forms.Label Label7;
		internal System.Windows.Forms.Label Label6;
		internal System.Windows.Forms.Label Label5;
		internal System.Windows.Forms.Label Label4;
		internal System.Windows.Forms.Label Label3;
		internal System.Windows.Forms.Label Label2;
		internal System.Windows.Forms.Label Label1;
		internal System.Windows.Forms.Label label38;
		internal System.Windows.Forms.TextBox txtReturnCode;
		internal System.Windows.Forms.Button btnExit;
		internal System.Windows.Forms.Button btnDioExit;
		internal System.Windows.Forms.Button btnOutMultiBit;
		internal System.Windows.Forms.Button btnOutMultiByte;
		internal System.Windows.Forms.Button btnInpMultiBit;
		internal System.Windows.Forms.Button btnInpMultiByte;
		internal System.Windows.Forms.Button btnDioInit;
		internal System.Windows.Forms.ComboBox cboDeviceName;
		internal System.Windows.Forms.TextBox txtOutBitData7;
		internal System.Windows.Forms.TextBox txtOutBitData6;
		internal System.Windows.Forms.TextBox txtOutBitData5;
		internal System.Windows.Forms.TextBox txtOutBitData4;
		internal System.Windows.Forms.TextBox txtOutBitData3;
		internal System.Windows.Forms.TextBox txtOutBitData2;
		internal System.Windows.Forms.TextBox txtOutBitData1;
		internal System.Windows.Forms.TextBox txtOutBitData0;
		internal System.Windows.Forms.TextBox txtOutPortData7;
		internal System.Windows.Forms.TextBox txtOutPortData6;
		internal System.Windows.Forms.TextBox txtOutPortData5;
		internal System.Windows.Forms.TextBox txtOutPortData4;
		internal System.Windows.Forms.TextBox txtOutPortData3;
		internal System.Windows.Forms.TextBox txtOutPortData2;
		internal System.Windows.Forms.TextBox txtOutPortData1;
		internal System.Windows.Forms.TextBox txtOutPortData0;
		internal System.Windows.Forms.TextBox txtInpBitData7;
		internal System.Windows.Forms.TextBox txtInpBitData6;
		internal System.Windows.Forms.TextBox txtInpBitData5;
		internal System.Windows.Forms.TextBox txtInpBitData4;
		internal System.Windows.Forms.TextBox txtInpBitData3;
		internal System.Windows.Forms.TextBox txtInpBitData2;
		internal System.Windows.Forms.TextBox txtInpBitData1;
		internal System.Windows.Forms.TextBox txtInpBitData0;
		internal System.Windows.Forms.TextBox txtInpPortData7;
		internal System.Windows.Forms.TextBox txtInpPortData6;
		internal System.Windows.Forms.TextBox txtInpPortData5;
		internal System.Windows.Forms.TextBox txtInpPortData4;
		internal System.Windows.Forms.TextBox txtInpPortData3;
		internal System.Windows.Forms.TextBox txtInpPortData2;
		internal System.Windows.Forms.TextBox txtInpPortData1;
		internal System.Windows.Forms.TextBox txtInpPortData0;
		/// <summary>
		/// KvȃfUCiϐłB
		/// </summary>
		private System.ComponentModel.Container components = null;
		private const short DIO_MAX_ACCS_PORTS	=	8;			// ̃Tv̍őANZX|[g
		private const short DIO_MAX_ACCS_BITS	=	8;			// ̃Tv̍őANZXrbg
		// ǉf[^
		short			Id;										// foCXID
		int				Ret;									// ߂l
		short			InpPortNum;								// ̓|[g
		short			OutPortNum;								// o̓|[g
		short			InpBitNum;								// ̓rbg
		short			OutBitNum;								// o̓rbg
		StringBuilder	szError = new StringBuilder("", 256);	// G[
		string			szReturnCode = new string(' ', 256);	// \G[
		string			szText = new string(' ', 100);
		TextBox[]		m_InpPort = new TextBox[8];
		TextBox[]		m_InpBit = new TextBox[8];
		TextBox[]		m_OutPort = new TextBox[8];		
		TextBox[]		m_OutBit = new TextBox[8];

		public MultiIO()
		{
			//
			// Windows tH[ fUCi T|[gɕKvłB
			//
			InitializeComponent();

			//
			// TODO: InitializeComponent ĂяǒɁARXgN^ R[hǉĂB
			//
		}

		/// <summary>
		/// gpĂ郊\[XɌ㏈s܂B
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// fUCi T|[gɕKvȃ\bhłB̃\bh̓e
		/// R[h GfB^ŕύXȂłB
		/// </summary>
		private void InitializeComponent()
		{
			this.txtReturnCode = new System.Windows.Forms.TextBox();
			this.btnExit = new System.Windows.Forms.Button();
			this.btnDioExit = new System.Windows.Forms.Button();
			this.GroupBox4 = new System.Windows.Forms.GroupBox();
			this.btnOutMultiBit = new System.Windows.Forms.Button();
			this.Label29 = new System.Windows.Forms.Label();
			this.Label30 = new System.Windows.Forms.Label();
			this.Label31 = new System.Windows.Forms.Label();
			this.Label32 = new System.Windows.Forms.Label();
			this.Label33 = new System.Windows.Forms.Label();
			this.Label34 = new System.Windows.Forms.Label();
			this.Label35 = new System.Windows.Forms.Label();
			this.Label36 = new System.Windows.Forms.Label();
			this.Label37 = new System.Windows.Forms.Label();
			this.txtOutBitData7 = new System.Windows.Forms.TextBox();
			this.txtOutBitData6 = new System.Windows.Forms.TextBox();
			this.txtOutBitData5 = new System.Windows.Forms.TextBox();
			this.txtOutBitData4 = new System.Windows.Forms.TextBox();
			this.txtOutBitData3 = new System.Windows.Forms.TextBox();
			this.txtOutBitData2 = new System.Windows.Forms.TextBox();
			this.txtOutBitData1 = new System.Windows.Forms.TextBox();
			this.txtOutBitData0 = new System.Windows.Forms.TextBox();
			this.GroupBox3 = new System.Windows.Forms.GroupBox();
			this.btnOutMultiByte = new System.Windows.Forms.Button();
			this.Label20 = new System.Windows.Forms.Label();
			this.Label21 = new System.Windows.Forms.Label();
			this.Label22 = new System.Windows.Forms.Label();
			this.Label23 = new System.Windows.Forms.Label();
			this.Label24 = new System.Windows.Forms.Label();
			this.Label25 = new System.Windows.Forms.Label();
			this.Label26 = new System.Windows.Forms.Label();
			this.Label27 = new System.Windows.Forms.Label();
			this.Label28 = new System.Windows.Forms.Label();
			this.txtOutPortData7 = new System.Windows.Forms.TextBox();
			this.txtOutPortData6 = new System.Windows.Forms.TextBox();
			this.txtOutPortData5 = new System.Windows.Forms.TextBox();
			this.txtOutPortData4 = new System.Windows.Forms.TextBox();
			this.txtOutPortData3 = new System.Windows.Forms.TextBox();
			this.txtOutPortData2 = new System.Windows.Forms.TextBox();
			this.txtOutPortData1 = new System.Windows.Forms.TextBox();
			this.txtOutPortData0 = new System.Windows.Forms.TextBox();
			this.GroupBox2 = new System.Windows.Forms.GroupBox();
			this.btnInpMultiBit = new System.Windows.Forms.Button();
			this.Label11 = new System.Windows.Forms.Label();
			this.Label12 = new System.Windows.Forms.Label();
			this.Label13 = new System.Windows.Forms.Label();
			this.Label14 = new System.Windows.Forms.Label();
			this.Label15 = new System.Windows.Forms.Label();
			this.Label16 = new System.Windows.Forms.Label();
			this.Label17 = new System.Windows.Forms.Label();
			this.Label18 = new System.Windows.Forms.Label();
			this.Label19 = new System.Windows.Forms.Label();
			this.txtInpBitData7 = new System.Windows.Forms.TextBox();
			this.txtInpBitData6 = new System.Windows.Forms.TextBox();
			this.txtInpBitData5 = new System.Windows.Forms.TextBox();
			this.txtInpBitData4 = new System.Windows.Forms.TextBox();
			this.txtInpBitData3 = new System.Windows.Forms.TextBox();
			this.txtInpBitData2 = new System.Windows.Forms.TextBox();
			this.txtInpBitData1 = new System.Windows.Forms.TextBox();
			this.txtInpBitData0 = new System.Windows.Forms.TextBox();
			this.GroupBox1 = new System.Windows.Forms.GroupBox();
			this.btnInpMultiByte = new System.Windows.Forms.Button();
			this.Label10 = new System.Windows.Forms.Label();
			this.Label9 = new System.Windows.Forms.Label();
			this.Label8 = new System.Windows.Forms.Label();
			this.Label7 = new System.Windows.Forms.Label();
			this.Label6 = new System.Windows.Forms.Label();
			this.Label5 = new System.Windows.Forms.Label();
			this.Label4 = new System.Windows.Forms.Label();
			this.Label3 = new System.Windows.Forms.Label();
			this.Label2 = new System.Windows.Forms.Label();
			this.txtInpPortData7 = new System.Windows.Forms.TextBox();
			this.txtInpPortData6 = new System.Windows.Forms.TextBox();
			this.txtInpPortData5 = new System.Windows.Forms.TextBox();
			this.txtInpPortData4 = new System.Windows.Forms.TextBox();
			this.txtInpPortData3 = new System.Windows.Forms.TextBox();
			this.txtInpPortData2 = new System.Windows.Forms.TextBox();
			this.txtInpPortData1 = new System.Windows.Forms.TextBox();
			this.txtInpPortData0 = new System.Windows.Forms.TextBox();
			this.btnDioInit = new System.Windows.Forms.Button();
			this.cboDeviceName = new System.Windows.Forms.ComboBox();
			this.Label1 = new System.Windows.Forms.Label();
			this.label38 = new System.Windows.Forms.Label();
			this.GroupBox4.SuspendLayout();
			this.GroupBox3.SuspendLayout();
			this.GroupBox2.SuspendLayout();
			this.GroupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// txtReturnCode
			// 
			this.txtReturnCode.Location = new System.Drawing.Point(56, 341);
			this.txtReturnCode.Name = "txtReturnCode";
			this.txtReturnCode.Size = new System.Drawing.Size(304, 19);
			this.txtReturnCode.TabIndex = 38;
			this.txtReturnCode.Text = "TextBox33";
			// 
			// btnExit
			// 
			this.btnExit.Location = new System.Drawing.Point(377, 370);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(105, 24);
			this.btnExit.TabIndex = 37;
			this.btnExit.Text = "Exit";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// btnDioExit
			// 
			this.btnDioExit.Location = new System.Drawing.Point(377, 338);
			this.btnDioExit.Name = "btnDioExit";
			this.btnDioExit.Size = new System.Drawing.Size(105, 24);
			this.btnDioExit.TabIndex = 36;
			this.btnDioExit.Text = "DioExit";
			this.btnDioExit.Click += new System.EventHandler(this.btnDioExit_Click);
			// 
			// GroupBox4
			// 
			this.GroupBox4.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.btnOutMultiBit,
																					this.Label29,
																					this.Label30,
																					this.Label31,
																					this.Label32,
																					this.Label33,
																					this.Label34,
																					this.Label35,
																					this.Label36,
																					this.Label37,
																					this.txtOutBitData7,
																					this.txtOutBitData6,
																					this.txtOutBitData5,
																					this.txtOutBitData4,
																					this.txtOutBitData3,
																					this.txtOutBitData2,
																					this.txtOutBitData1,
																					this.txtOutBitData0});
			this.GroupBox4.Location = new System.Drawing.Point(8, 266);
			this.GroupBox4.Name = "GroupBox4";
			this.GroupBox4.Size = new System.Drawing.Size(496, 64);
			this.GroupBox4.TabIndex = 35;
			this.GroupBox4.TabStop = false;
			this.GroupBox4.Text = "rbgo";
			// 
			// btnOutMultiBit
			// 
			this.btnOutMultiBit.Location = new System.Drawing.Point(369, 27);
			this.btnOutMultiBit.Name = "btnOutMultiBit";
			this.btnOutMultiBit.Size = new System.Drawing.Size(105, 24);
			this.btnOutMultiBit.TabIndex = 20;
			this.btnOutMultiBit.Text = "DioOutMultiBit";
			this.btnOutMultiBit.Click += new System.EventHandler(this.btnOutMultiBit_Click);
			// 
			// Label29
			// 
			this.Label29.Location = new System.Drawing.Point(9, 35);
			this.Label29.Name = "Label29";
			this.Label29.Size = new System.Drawing.Size(72, 16);
			this.Label29.TabIndex = 19;
			this.Label29.Text = "rbgf[^F";
			// 
			// Label30
			// 
			this.Label30.Location = new System.Drawing.Point(332, 14);
			this.Label30.Name = "Label30";
			this.Label30.Size = new System.Drawing.Size(8, 12);
			this.Label30.TabIndex = 15;
			this.Label30.Text = "7";
			// 
			// Label31
			// 
			this.Label31.Location = new System.Drawing.Point(300, 14);
			this.Label31.Name = "Label31";
			this.Label31.Size = new System.Drawing.Size(8, 12);
			this.Label31.TabIndex = 14;
			this.Label31.Text = "6";
			// 
			// Label32
			// 
			this.Label32.Location = new System.Drawing.Point(268, 14);
			this.Label32.Name = "Label32";
			this.Label32.Size = new System.Drawing.Size(8, 12);
			this.Label32.TabIndex = 13;
			this.Label32.Text = "5";
			// 
			// Label33
			// 
			this.Label33.Location = new System.Drawing.Point(236, 14);
			this.Label33.Name = "Label33";
			this.Label33.Size = new System.Drawing.Size(8, 12);
			this.Label33.TabIndex = 12;
			this.Label33.Text = "4";
			// 
			// Label34
			// 
			this.Label34.Location = new System.Drawing.Point(205, 14);
			this.Label34.Name = "Label34";
			this.Label34.Size = new System.Drawing.Size(8, 12);
			this.Label34.TabIndex = 11;
			this.Label34.Text = "3";
			// 
			// Label35
			// 
			this.Label35.Location = new System.Drawing.Point(172, 14);
			this.Label35.Name = "Label35";
			this.Label35.Size = new System.Drawing.Size(8, 12);
			this.Label35.TabIndex = 10;
			this.Label35.Text = "2";
			// 
			// Label36
			// 
			this.Label36.Location = new System.Drawing.Point(140, 14);
			this.Label36.Name = "Label36";
			this.Label36.Size = new System.Drawing.Size(8, 12);
			this.Label36.TabIndex = 9;
			this.Label36.Text = "1";
			// 
			// Label37
			// 
			this.Label37.Location = new System.Drawing.Point(109, 14);
			this.Label37.Name = "Label37";
			this.Label37.Size = new System.Drawing.Size(8, 12);
			this.Label37.TabIndex = 8;
			this.Label37.Text = "0";
			// 
			// txtOutBitData7
			// 
			this.txtOutBitData7.Location = new System.Drawing.Point(323, 32);
			this.txtOutBitData7.Name = "txtOutBitData7";
			this.txtOutBitData7.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData7.TabIndex = 7;
			this.txtOutBitData7.Text = "TextBox8";
			// 
			// txtOutBitData6
			// 
			this.txtOutBitData6.Location = new System.Drawing.Point(291, 32);
			this.txtOutBitData6.Name = "txtOutBitData6";
			this.txtOutBitData6.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData6.TabIndex = 6;
			this.txtOutBitData6.Text = "TextBox7";
			// 
			// txtOutBitData5
			// 
			this.txtOutBitData5.Location = new System.Drawing.Point(259, 32);
			this.txtOutBitData5.Name = "txtOutBitData5";
			this.txtOutBitData5.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData5.TabIndex = 5;
			this.txtOutBitData5.Text = "TextBox6";
			// 
			// txtOutBitData4
			// 
			this.txtOutBitData4.Location = new System.Drawing.Point(227, 32);
			this.txtOutBitData4.Name = "txtOutBitData4";
			this.txtOutBitData4.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData4.TabIndex = 4;
			this.txtOutBitData4.Text = "TextBox5";
			// 
			// txtOutBitData3
			// 
			this.txtOutBitData3.Location = new System.Drawing.Point(195, 32);
			this.txtOutBitData3.Name = "txtOutBitData3";
			this.txtOutBitData3.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData3.TabIndex = 3;
			this.txtOutBitData3.Text = "TextBox4";
			// 
			// txtOutBitData2
			// 
			this.txtOutBitData2.Location = new System.Drawing.Point(163, 32);
			this.txtOutBitData2.Name = "txtOutBitData2";
			this.txtOutBitData2.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData2.TabIndex = 2;
			this.txtOutBitData2.Text = "TextBox3";
			// 
			// txtOutBitData1
			// 
			this.txtOutBitData1.Location = new System.Drawing.Point(131, 32);
			this.txtOutBitData1.Name = "txtOutBitData1";
			this.txtOutBitData1.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData1.TabIndex = 1;
			this.txtOutBitData1.Text = "TextBox2";
			// 
			// txtOutBitData0
			// 
			this.txtOutBitData0.Location = new System.Drawing.Point(99, 32);
			this.txtOutBitData0.Name = "txtOutBitData0";
			this.txtOutBitData0.Size = new System.Drawing.Size(29, 19);
			this.txtOutBitData0.TabIndex = 0;
			this.txtOutBitData0.Text = "TextBox1";
			// 
			// GroupBox3
			// 
			this.GroupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.btnOutMultiByte,
																					this.Label20,
																					this.Label21,
																					this.Label22,
																					this.Label23,
																					this.Label24,
																					this.Label25,
																					this.Label26,
																					this.Label27,
																					this.Label28,
																					this.txtOutPortData7,
																					this.txtOutPortData6,
																					this.txtOutPortData5,
																					this.txtOutPortData4,
																					this.txtOutPortData3,
																					this.txtOutPortData2,
																					this.txtOutPortData1,
																					this.txtOutPortData0});
			this.GroupBox3.Location = new System.Drawing.Point(8, 194);
			this.GroupBox3.Name = "GroupBox3";
			this.GroupBox3.Size = new System.Drawing.Size(496, 64);
			this.GroupBox3.TabIndex = 34;
			this.GroupBox3.TabStop = false;
			this.GroupBox3.Text = "|[go";
			// 
			// btnOutMultiByte
			// 
			this.btnOutMultiByte.Location = new System.Drawing.Point(369, 27);
			this.btnOutMultiByte.Name = "btnOutMultiByte";
			this.btnOutMultiByte.Size = new System.Drawing.Size(105, 24);
			this.btnOutMultiByte.TabIndex = 20;
			this.btnOutMultiByte.Text = "DioOutMultiByte";
			this.btnOutMultiByte.Click += new System.EventHandler(this.btnOutMultiByte_Click);
			// 
			// Label20
			// 
			this.Label20.Location = new System.Drawing.Point(9, 35);
			this.Label20.Name = "Label20";
			this.Label20.Size = new System.Drawing.Size(79, 16);
			this.Label20.TabIndex = 19;
			this.Label20.Text = "|[gf[^F";
			// 
			// Label21
			// 
			this.Label21.Location = new System.Drawing.Point(332, 14);
			this.Label21.Name = "Label21";
			this.Label21.Size = new System.Drawing.Size(8, 12);
			this.Label21.TabIndex = 15;
			this.Label21.Text = "7";
			// 
			// Label22
			// 
			this.Label22.Location = new System.Drawing.Point(300, 14);
			this.Label22.Name = "Label22";
			this.Label22.Size = new System.Drawing.Size(8, 12);
			this.Label22.TabIndex = 14;
			this.Label22.Text = "6";
			// 
			// Label23
			// 
			this.Label23.Location = new System.Drawing.Point(268, 14);
			this.Label23.Name = "Label23";
			this.Label23.Size = new System.Drawing.Size(8, 12);
			this.Label23.TabIndex = 13;
			this.Label23.Text = "5";
			// 
			// Label24
			// 
			this.Label24.Location = new System.Drawing.Point(236, 14);
			this.Label24.Name = "Label24";
			this.Label24.Size = new System.Drawing.Size(8, 12);
			this.Label24.TabIndex = 12;
			this.Label24.Text = "4";
			// 
			// Label25
			// 
			this.Label25.Location = new System.Drawing.Point(205, 14);
			this.Label25.Name = "Label25";
			this.Label25.Size = new System.Drawing.Size(8, 12);
			this.Label25.TabIndex = 11;
			this.Label25.Text = "3";
			// 
			// Label26
			// 
			this.Label26.Location = new System.Drawing.Point(172, 14);
			this.Label26.Name = "Label26";
			this.Label26.Size = new System.Drawing.Size(8, 12);
			this.Label26.TabIndex = 10;
			this.Label26.Text = "2";
			// 
			// Label27
			// 
			this.Label27.Location = new System.Drawing.Point(140, 14);
			this.Label27.Name = "Label27";
			this.Label27.Size = new System.Drawing.Size(8, 12);
			this.Label27.TabIndex = 9;
			this.Label27.Text = "1";
			// 
			// Label28
			// 
			this.Label28.Location = new System.Drawing.Point(109, 14);
			this.Label28.Name = "Label28";
			this.Label28.Size = new System.Drawing.Size(8, 12);
			this.Label28.TabIndex = 8;
			this.Label28.Text = "0";
			// 
			// txtOutPortData7
			// 
			this.txtOutPortData7.Location = new System.Drawing.Point(323, 32);
			this.txtOutPortData7.Name = "txtOutPortData7";
			this.txtOutPortData7.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData7.TabIndex = 7;
			this.txtOutPortData7.Text = "TextBox8";
			// 
			// txtOutPortData6
			// 
			this.txtOutPortData6.Location = new System.Drawing.Point(291, 32);
			this.txtOutPortData6.Name = "txtOutPortData6";
			this.txtOutPortData6.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData6.TabIndex = 6;
			this.txtOutPortData6.Text = "TextBox7";
			// 
			// txtOutPortData5
			// 
			this.txtOutPortData5.Location = new System.Drawing.Point(259, 32);
			this.txtOutPortData5.Name = "txtOutPortData5";
			this.txtOutPortData5.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData5.TabIndex = 5;
			this.txtOutPortData5.Text = "TextBox6";
			// 
			// txtOutPortData4
			// 
			this.txtOutPortData4.Location = new System.Drawing.Point(227, 32);
			this.txtOutPortData4.Name = "txtOutPortData4";
			this.txtOutPortData4.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData4.TabIndex = 4;
			this.txtOutPortData4.Text = "TextBox5";
			// 
			// txtOutPortData3
			// 
			this.txtOutPortData3.Location = new System.Drawing.Point(195, 32);
			this.txtOutPortData3.Name = "txtOutPortData3";
			this.txtOutPortData3.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData3.TabIndex = 3;
			this.txtOutPortData3.Text = "TextBox4";
			// 
			// txtOutPortData2
			// 
			this.txtOutPortData2.Location = new System.Drawing.Point(163, 32);
			this.txtOutPortData2.Name = "txtOutPortData2";
			this.txtOutPortData2.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData2.TabIndex = 2;
			this.txtOutPortData2.Text = "TextBox3";
			// 
			// txtOutPortData1
			// 
			this.txtOutPortData1.Location = new System.Drawing.Point(131, 32);
			this.txtOutPortData1.Name = "txtOutPortData1";
			this.txtOutPortData1.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData1.TabIndex = 1;
			this.txtOutPortData1.Text = "TextBox2";
			// 
			// txtOutPortData0
			// 
			this.txtOutPortData0.Location = new System.Drawing.Point(99, 32);
			this.txtOutPortData0.Name = "txtOutPortData0";
			this.txtOutPortData0.Size = new System.Drawing.Size(29, 19);
			this.txtOutPortData0.TabIndex = 0;
			this.txtOutPortData0.Text = "TextBox1";
			// 
			// GroupBox2
			// 
			this.GroupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.btnInpMultiBit,
																					this.Label11,
																					this.Label12,
																					this.Label13,
																					this.Label14,
																					this.Label15,
																					this.Label16,
																					this.Label17,
																					this.Label18,
																					this.Label19,
																					this.txtInpBitData7,
																					this.txtInpBitData6,
																					this.txtInpBitData5,
																					this.txtInpBitData4,
																					this.txtInpBitData3,
																					this.txtInpBitData2,
																					this.txtInpBitData1,
																					this.txtInpBitData0});
			this.GroupBox2.Location = new System.Drawing.Point(8, 122);
			this.GroupBox2.Name = "GroupBox2";
			this.GroupBox2.Size = new System.Drawing.Size(496, 64);
			this.GroupBox2.TabIndex = 33;
			this.GroupBox2.TabStop = false;
			this.GroupBox2.Text = "rbg";
			// 
			// btnInpMultiBit
			// 
			this.btnInpMultiBit.Location = new System.Drawing.Point(369, 27);
			this.btnInpMultiBit.Name = "btnInpMultiBit";
			this.btnInpMultiBit.Size = new System.Drawing.Size(105, 24);
			this.btnInpMultiBit.TabIndex = 20;
			this.btnInpMultiBit.Text = "DioInpMultiBit";
			this.btnInpMultiBit.Click += new System.EventHandler(this.btnInpMultiBit_Click);
			// 
			// Label11
			// 
			this.Label11.Location = new System.Drawing.Point(9, 35);
			this.Label11.Name = "Label11";
			this.Label11.Size = new System.Drawing.Size(72, 16);
			this.Label11.TabIndex = 19;
			this.Label11.Text = "rbgf[^F";
			// 
			// Label12
			// 
			this.Label12.Location = new System.Drawing.Point(332, 14);
			this.Label12.Name = "Label12";
			this.Label12.Size = new System.Drawing.Size(8, 12);
			this.Label12.TabIndex = 15;
			this.Label12.Text = "7";
			// 
			// Label13
			// 
			this.Label13.Location = new System.Drawing.Point(300, 14);
			this.Label13.Name = "Label13";
			this.Label13.Size = new System.Drawing.Size(8, 12);
			this.Label13.TabIndex = 14;
			this.Label13.Text = "6";
			// 
			// Label14
			// 
			this.Label14.Location = new System.Drawing.Point(268, 14);
			this.Label14.Name = "Label14";
			this.Label14.Size = new System.Drawing.Size(8, 12);
			this.Label14.TabIndex = 13;
			this.Label14.Text = "5";
			// 
			// Label15
			// 
			this.Label15.Location = new System.Drawing.Point(236, 14);
			this.Label15.Name = "Label15";
			this.Label15.Size = new System.Drawing.Size(8, 12);
			this.Label15.TabIndex = 12;
			this.Label15.Text = "4";
			// 
			// Label16
			// 
			this.Label16.Location = new System.Drawing.Point(205, 14);
			this.Label16.Name = "Label16";
			this.Label16.Size = new System.Drawing.Size(8, 12);
			this.Label16.TabIndex = 11;
			this.Label16.Text = "3";
			// 
			// Label17
			// 
			this.Label17.Location = new System.Drawing.Point(172, 14);
			this.Label17.Name = "Label17";
			this.Label17.Size = new System.Drawing.Size(8, 12);
			this.Label17.TabIndex = 10;
			this.Label17.Text = "2";
			// 
			// Label18
			// 
			this.Label18.Location = new System.Drawing.Point(140, 14);
			this.Label18.Name = "Label18";
			this.Label18.Size = new System.Drawing.Size(8, 12);
			this.Label18.TabIndex = 9;
			this.Label18.Text = "1";
			// 
			// Label19
			// 
			this.Label19.Location = new System.Drawing.Point(109, 14);
			this.Label19.Name = "Label19";
			this.Label19.Size = new System.Drawing.Size(8, 12);
			this.Label19.TabIndex = 8;
			this.Label19.Text = "0";
			// 
			// txtInpBitData7
			// 
			this.txtInpBitData7.Location = new System.Drawing.Point(323, 32);
			this.txtInpBitData7.Name = "txtInpBitData7";
			this.txtInpBitData7.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData7.TabIndex = 7;
			this.txtInpBitData7.Text = "TextBox8";
			// 
			// txtInpBitData6
			// 
			this.txtInpBitData6.Location = new System.Drawing.Point(291, 32);
			this.txtInpBitData6.Name = "txtInpBitData6";
			this.txtInpBitData6.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData6.TabIndex = 6;
			this.txtInpBitData6.Text = "TextBox7";
			// 
			// txtInpBitData5
			// 
			this.txtInpBitData5.Location = new System.Drawing.Point(259, 32);
			this.txtInpBitData5.Name = "txtInpBitData5";
			this.txtInpBitData5.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData5.TabIndex = 5;
			this.txtInpBitData5.Text = "TextBox6";
			// 
			// txtInpBitData4
			// 
			this.txtInpBitData4.Location = new System.Drawing.Point(227, 32);
			this.txtInpBitData4.Name = "txtInpBitData4";
			this.txtInpBitData4.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData4.TabIndex = 4;
			this.txtInpBitData4.Text = "TextBox5";
			// 
			// txtInpBitData3
			// 
			this.txtInpBitData3.Location = new System.Drawing.Point(195, 32);
			this.txtInpBitData3.Name = "txtInpBitData3";
			this.txtInpBitData3.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData3.TabIndex = 3;
			this.txtInpBitData3.Text = "TextBox4";
			// 
			// txtInpBitData2
			// 
			this.txtInpBitData2.Location = new System.Drawing.Point(163, 32);
			this.txtInpBitData2.Name = "txtInpBitData2";
			this.txtInpBitData2.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData2.TabIndex = 2;
			this.txtInpBitData2.Text = "TextBox3";
			// 
			// txtInpBitData1
			// 
			this.txtInpBitData1.Location = new System.Drawing.Point(131, 32);
			this.txtInpBitData1.Name = "txtInpBitData1";
			this.txtInpBitData1.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData1.TabIndex = 1;
			this.txtInpBitData1.Text = "TextBox2";
			// 
			// txtInpBitData0
			// 
			this.txtInpBitData0.Location = new System.Drawing.Point(99, 32);
			this.txtInpBitData0.Name = "txtInpBitData0";
			this.txtInpBitData0.Size = new System.Drawing.Size(29, 19);
			this.txtInpBitData0.TabIndex = 0;
			this.txtInpBitData0.Text = "TextBox1";
			// 
			// GroupBox1
			// 
			this.GroupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					this.btnInpMultiByte,
																					this.Label10,
																					this.Label9,
																					this.Label8,
																					this.Label7,
																					this.Label6,
																					this.Label5,
																					this.Label4,
																					this.Label3,
																					this.Label2,
																					this.txtInpPortData7,
																					this.txtInpPortData6,
																					this.txtInpPortData5,
																					this.txtInpPortData4,
																					this.txtInpPortData3,
																					this.txtInpPortData2,
																					this.txtInpPortData1,
																					this.txtInpPortData0});
			this.GroupBox1.Location = new System.Drawing.Point(8, 50);
			this.GroupBox1.Name = "GroupBox1";
			this.GroupBox1.Size = new System.Drawing.Size(496, 64);
			this.GroupBox1.TabIndex = 32;
			this.GroupBox1.TabStop = false;
			this.GroupBox1.Text = "|[g";
			// 
			// btnInpMultiByte
			// 
			this.btnInpMultiByte.Location = new System.Drawing.Point(369, 27);
			this.btnInpMultiByte.Name = "btnInpMultiByte";
			this.btnInpMultiByte.Size = new System.Drawing.Size(105, 24);
			this.btnInpMultiByte.TabIndex = 20;
			this.btnInpMultiByte.Text = "DioInpMultiByte";
			this.btnInpMultiByte.Click += new System.EventHandler(this.btnInpMultiByte_Click);
			// 
			// Label10
			// 
			this.Label10.Location = new System.Drawing.Point(9, 35);
			this.Label10.Name = "Label10";
			this.Label10.Size = new System.Drawing.Size(79, 16);
			this.Label10.TabIndex = 19;
			this.Label10.Text = "|[gf[^F";
			// 
			// Label9
			// 
			this.Label9.Location = new System.Drawing.Point(332, 14);
			this.Label9.Name = "Label9";
			this.Label9.Size = new System.Drawing.Size(8, 12);
			this.Label9.TabIndex = 15;
			this.Label9.Text = "7";
			// 
			// Label8
			// 
			this.Label8.Location = new System.Drawing.Point(300, 14);
			this.Label8.Name = "Label8";
			this.Label8.Size = new System.Drawing.Size(8, 12);
			this.Label8.TabIndex = 14;
			this.Label8.Text = "6";
			// 
			// Label7
			// 
			this.Label7.Location = new System.Drawing.Point(268, 14);
			this.Label7.Name = "Label7";
			this.Label7.Size = new System.Drawing.Size(8, 12);
			this.Label7.TabIndex = 13;
			this.Label7.Text = "5";
			// 
			// Label6
			// 
			this.Label6.Location = new System.Drawing.Point(236, 14);
			this.Label6.Name = "Label6";
			this.Label6.Size = new System.Drawing.Size(8, 12);
			this.Label6.TabIndex = 12;
			this.Label6.Text = "4";
			// 
			// Label5
			// 
			this.Label5.Location = new System.Drawing.Point(205, 14);
			this.Label5.Name = "Label5";
			this.Label5.Size = new System.Drawing.Size(8, 12);
			this.Label5.TabIndex = 11;
			this.Label5.Text = "3";
			// 
			// Label4
			// 
			this.Label4.Location = new System.Drawing.Point(172, 14);
			this.Label4.Name = "Label4";
			this.Label4.Size = new System.Drawing.Size(8, 12);
			this.Label4.TabIndex = 10;
			this.Label4.Text = "2";
			// 
			// Label3
			// 
			this.Label3.Location = new System.Drawing.Point(140, 14);
			this.Label3.Name = "Label3";
			this.Label3.Size = new System.Drawing.Size(8, 12);
			this.Label3.TabIndex = 9;
			this.Label3.Text = "1";
			// 
			// Label2
			// 
			this.Label2.Location = new System.Drawing.Point(109, 14);
			this.Label2.Name = "Label2";
			this.Label2.Size = new System.Drawing.Size(8, 12);
			this.Label2.TabIndex = 8;
			this.Label2.Text = "0";
			// 
			// txtInpPortData7
			// 
			this.txtInpPortData7.Location = new System.Drawing.Point(323, 32);
			this.txtInpPortData7.Name = "txtInpPortData7";
			this.txtInpPortData7.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData7.TabIndex = 7;
			this.txtInpPortData7.Text = "TextBox8";
			// 
			// txtInpPortData6
			// 
			this.txtInpPortData6.Location = new System.Drawing.Point(291, 32);
			this.txtInpPortData6.Name = "txtInpPortData6";
			this.txtInpPortData6.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData6.TabIndex = 6;
			this.txtInpPortData6.Text = "TextBox7";
			// 
			// txtInpPortData5
			// 
			this.txtInpPortData5.Location = new System.Drawing.Point(259, 32);
			this.txtInpPortData5.Name = "txtInpPortData5";
			this.txtInpPortData5.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData5.TabIndex = 5;
			this.txtInpPortData5.Text = "TextBox6";
			// 
			// txtInpPortData4
			// 
			this.txtInpPortData4.Location = new System.Drawing.Point(227, 32);
			this.txtInpPortData4.Name = "txtInpPortData4";
			this.txtInpPortData4.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData4.TabIndex = 4;
			this.txtInpPortData4.Text = "TextBox5";
			// 
			// txtInpPortData3
			// 
			this.txtInpPortData3.Location = new System.Drawing.Point(195, 32);
			this.txtInpPortData3.Name = "txtInpPortData3";
			this.txtInpPortData3.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData3.TabIndex = 3;
			this.txtInpPortData3.Text = "TextBox4";
			// 
			// txtInpPortData2
			// 
			this.txtInpPortData2.Location = new System.Drawing.Point(163, 32);
			this.txtInpPortData2.Name = "txtInpPortData2";
			this.txtInpPortData2.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData2.TabIndex = 2;
			this.txtInpPortData2.Text = "TextBox3";
			// 
			// txtInpPortData1
			// 
			this.txtInpPortData1.Location = new System.Drawing.Point(131, 32);
			this.txtInpPortData1.Name = "txtInpPortData1";
			this.txtInpPortData1.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData1.TabIndex = 1;
			this.txtInpPortData1.Text = "TextBox2";
			// 
			// txtInpPortData0
			// 
			this.txtInpPortData0.Location = new System.Drawing.Point(99, 32);
			this.txtInpPortData0.Name = "txtInpPortData0";
			this.txtInpPortData0.Size = new System.Drawing.Size(29, 19);
			this.txtInpPortData0.TabIndex = 0;
			this.txtInpPortData0.Text = "TextBox1";
			// 
			// btnDioInit
			// 
			this.btnDioInit.Location = new System.Drawing.Point(377, 10);
			this.btnDioInit.Name = "btnDioInit";
			this.btnDioInit.Size = new System.Drawing.Size(105, 24);
			this.btnDioInit.TabIndex = 31;
			this.btnDioInit.Text = "DioInit";
			this.btnDioInit.Click += new System.EventHandler(this.btnDioInit_Click);
			// 
			// cboDeviceName
			// 
			this.cboDeviceName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.cboDeviceName.Location = new System.Drawing.Point(80, 11);
			this.cboDeviceName.Name = "cboDeviceName";
			this.cboDeviceName.Size = new System.Drawing.Size(213, 20);
			this.cboDeviceName.TabIndex = 39;
			// 
			// Label1
			// 
			this.Label1.Location = new System.Drawing.Point(8, 13);
			this.Label1.Name = "Label1";
			this.Label1.Size = new System.Drawing.Size(72, 16);
			this.Label1.TabIndex = 30;
			this.Label1.Text = "foCXF";
			// 
			// label38
			// 
			this.label38.Location = new System.Drawing.Point(8, 344);
			this.label38.Name = "label38";
			this.label38.Size = new System.Drawing.Size(48, 16);
			this.label38.TabIndex = 40;
			this.label38.Text = "߂lF";
			// 
			// MultiIO
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
			this.ClientSize = new System.Drawing.Size(512, 405);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.label38,
																		  this.txtReturnCode,
																		  this.btnExit,
																		  this.btnDioExit,
																		  this.GroupBox4,
																		  this.GroupBox3,
																		  this.GroupBox2,
																		  this.GroupBox1,
																		  this.btnDioInit,
																		  this.cboDeviceName,
																		  this.Label1});
			this.Font = new System.Drawing.Font("lr oSVbN", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "MultiIO";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "|[g^rbg I/O";
			this.Load += new System.EventHandler(this.MultiIO_Load);
			this.GroupBox4.ResumeLayout(false);
			this.GroupBox3.ResumeLayout(false);
			this.GroupBox2.ResumeLayout(false);
			this.GroupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// AvP[ṼC Gg |CgłB
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new MultiIO());
		}

		//---------------------------------------------------------
		//	_CAO
		//---------------------------------------------------------
		private void MultiIO_Load(object sender, System.EventArgs e)
		{
			//-----------------------------------
			// foCX̌o
			//-----------------------------------
			short	Index;
			short	GroupID, UnitID, DeviceID;
			StringBuilder	DeviceName = new StringBuilder(256);
			StringBuilder	Device = new StringBuilder(256);
			GroupID = 0;
			UnitID = 0;
			DeviceID = 0;
			for (Index=0; ; Index++)
			{
				Ret = DIO.Ccapdio.DioQueryDeviceName(Index, ref GroupID, ref UnitID, ref DeviceID, DeviceName, Device);
				if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
				{
					break;
				}
				cboDeviceName.Items.Add(DeviceName);
			}
			cboDeviceName.SelectedIndex = 0;
			//-----------------------------------
			// ʃACȅ
			//-----------------------------------
			// |[g
			txtInpPortData0.Text = "";
			txtInpPortData1.Text = "";
			txtInpPortData2.Text = "";
			txtInpPortData3.Text = "";
			txtInpPortData4.Text = "";
			txtInpPortData5.Text = "";
			txtInpPortData6.Text = "";
			txtInpPortData7.Text = "";
			m_InpPort[0] = txtInpPortData0;
			m_InpPort[1] = txtInpPortData1;
			m_InpPort[2] = txtInpPortData2;
			m_InpPort[3] = txtInpPortData3;
			m_InpPort[4] = txtInpPortData4;
			m_InpPort[5] = txtInpPortData5;
			m_InpPort[6] = txtInpPortData6;
			m_InpPort[7] = txtInpPortData7;
			// rbg
			txtInpBitData0.Text = "";
			txtInpBitData1.Text = "";
			txtInpBitData2.Text = "";
			txtInpBitData3.Text = "";
			txtInpBitData4.Text = "";
			txtInpBitData5.Text = "";
			txtInpBitData6.Text = "";
			txtInpBitData7.Text = "";
			m_InpBit[0] = txtInpBitData0;
			m_InpBit[1] = txtInpBitData1;
			m_InpBit[2] = txtInpBitData2;
			m_InpBit[3] = txtInpBitData3;
			m_InpBit[4] = txtInpBitData4;
			m_InpBit[5] = txtInpBitData5;
			m_InpBit[6] = txtInpBitData6;
			m_InpBit[7] = txtInpBitData7;
			// |[go
			txtOutPortData0.Text = "11";
			txtOutPortData1.Text = "22";
			txtOutPortData2.Text = "33";
			txtOutPortData3.Text = "44";
			txtOutPortData4.Text = "55";
			txtOutPortData5.Text = "66";
			txtOutPortData6.Text = "77";
			txtOutPortData7.Text = "88";
			m_OutPort[0] = txtOutPortData0;
			m_OutPort[1] = txtOutPortData1;
			m_OutPort[2] = txtOutPortData2;
			m_OutPort[3] = txtOutPortData3;
			m_OutPort[4] = txtOutPortData4;
			m_OutPort[5] = txtOutPortData5;
			m_OutPort[6] = txtOutPortData6;
			m_OutPort[7] = txtOutPortData7;
			// rbgo
			txtOutBitData0.Text = "1";
			txtOutBitData1.Text = "0";
			txtOutBitData2.Text = "1";
			txtOutBitData3.Text = "0";
			txtOutBitData4.Text = "1";
			txtOutBitData5.Text = "0";
			txtOutBitData6.Text = "1";
			txtOutBitData7.Text = "0";
			m_OutBit[0] = txtOutBitData0;
			m_OutBit[1] = txtOutBitData1;
			m_OutBit[2] = txtOutBitData2;
			m_OutBit[3] = txtOutBitData3;
			m_OutBit[4] = txtOutBitData4;
			m_OutBit[5] = txtOutBitData5;
			m_OutBit[6] = txtOutBitData6;
			m_OutBit[7] = txtOutBitData7;
			// ߂l
			txtReturnCode.Text = "";
		}

		//---------------------------------------------------------
		//	
		//---------------------------------------------------------
		private void btnDioInit_Click(object sender, System.EventArgs e)
		{
			string	szDeviceName = new string(' ', 100);
			short	i;
			//-----------------------------
			// ʂfoCX擾
			//-----------------------------
			szDeviceName = cboDeviceName.Text;
			//-----------------------------
			// sȂAID擾
			//-----------------------------
			Ret = DIO.Ccapdio.DioInit(szDeviceName, ref Id);
			//-----------------------------
			// G[
			//-----------------------------
			DIO.Ccapdio.DioGetErrorString(Ret, szError);
			szReturnCode = "DioInit : " + szError;
			txtReturnCode.Text = szReturnCode;
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
			{
				return;
			}
			//-----------------------------
			// S|[g̎擾
			//-----------------------------
			Ret = DIO.Ccapdio.DioGetMaxPorts(Id, ref InpPortNum, ref OutPortNum);
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
			{
				DIO.Ccapdio.DioGetErrorString(Ret, szError);
				szReturnCode = "DioGetMaxPorts : " + szError;
				txtReturnCode.Text = szReturnCode;
				return;
			}
			// ̃Tv͍ő8|[g܂
			if (InpPortNum > DIO_MAX_ACCS_PORTS)
			{
				InpPortNum = DIO_MAX_ACCS_PORTS;
			}
			if (OutPortNum > DIO_MAX_ACCS_PORTS)
			{
				OutPortNum = DIO_MAX_ACCS_PORTS;
			}
			//-----------------------------
			// Srbg̎擾
			//-----------------------------
			Ret = DIO.Ccapdio.DioGetMaxBits(Id, ref InpBitNum, ref OutBitNum);
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
			{
				DIO.Ccapdio.DioGetErrorString(Ret, szError);
				szReturnCode = "DioGetMaxBits : " + szError;
				txtReturnCode.Text = szReturnCode;
				return;
			}
			// ̃Tv͍ő8rbg܂
			if (InpBitNum > DIO_MAX_ACCS_BITS)
			{
				InpBitNum = DIO_MAX_ACCS_BITS;
			}
			if (OutBitNum > DIO_MAX_ACCS_BITS)
			{
				OutBitNum = DIO_MAX_ACCS_BITS;
			}
			//-----------------------------
			// ʂ}XN
			//-----------------------------
			for (i=0; i<DIO_MAX_ACCS_PORTS; i++)
			{
				if (i < InpPortNum)
				{
					m_InpPort[i].Enabled = true;
				} 
				else
				{
					m_InpPort[i].Enabled = false;
				}
			}
			for (i=0; i<DIO_MAX_ACCS_BITS; i++)
			{
				if (i < InpBitNum)
				{
					m_InpBit[i].Enabled = true;
				}
				else
				{
					m_InpBit[i].Enabled = false;
				}
			}
			for (i=0; i<DIO_MAX_ACCS_PORTS; i++)
			{
				if (i < OutPortNum)
				{
					m_OutPort[i].Enabled = true;
				} 
				else
				{
					m_OutPort[i].Enabled = false;
				}
			}
			for (i=0; i<DIO_MAX_ACCS_BITS; i++)
			{
				if (i < OutBitNum)
				{
					m_OutBit[i].Enabled = true;
				}
				else
				{
					m_OutBit[i].Enabled = false;
				}
			}
		}

		//---------------------------------------------------------
		//	|[g
		//---------------------------------------------------------
		private void btnInpMultiByte_Click(object sender, System.EventArgs e)
		{
			short[]	InpPortNo = new short[DIO_MAX_ACCS_PORTS];
			byte[]	InpPortData = new byte [DIO_MAX_ACCS_PORTS];
			short	i;
			//-----------------------------
			// |[gԍZbg
			//-----------------------------
			for (i=0; i<InpPortNum; i++)
			{
				InpPortNo[i] = i;
			}
			//-----------------------------
			// |[g
			//-----------------------------
			GCHandle PterPNo = GCHandle.Alloc(InpPortNo, GCHandleType.Pinned);
			GCHandle PterPData = GCHandle.Alloc(InpPortData, GCHandleType.Pinned);
			Ret = DIO.Ccapdio.DioInpMultiByte(Id, InpPortNo, InpPortNum, InpPortData);
			PterPNo.Free();
			PterPData.Free();
			//-----------------------------
			// G[
			//-----------------------------
			DIO.Ccapdio.DioGetErrorString(Ret, szError);
			szReturnCode = "DioInpMultiByte : " + szError;
			txtReturnCode.Text = szReturnCode;	
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
			{
				return;
			}
			//-----------------------------
			// f[^\
			//-----------------------------
			for (i=0; i<InpPortNum; i++)
			{
				szText = string.Format("{0:X2}", InpPortData[i]);
				m_InpPort[i].Text = szText;
			}
		}

		//---------------------------------------------------------
		//	rbg
		//---------------------------------------------------------
		private void btnInpMultiBit_Click(object sender, System.EventArgs e)
		{
			short[]	InpBitNo = new short[DIO_MAX_ACCS_BITS];
			byte[]	InpBitData = new byte[DIO_MAX_ACCS_BITS];
			short	i;
			//-----------------------------
			// rbgԍZbg
			//-----------------------------
			for (i=0; i<InpBitNum; i++)
			{
				InpBitNo[i] = i;
			}
			//-----------------------------
			// rbg
			//-----------------------------
			GCHandle PterBNo = GCHandle.Alloc(InpBitNo, GCHandleType.Pinned);
			GCHandle PterBData = GCHandle.Alloc(InpBitData, GCHandleType.Pinned);
			Ret = DIO.Ccapdio.DioInpMultiBit(Id, InpBitNo, InpBitNum, InpBitData);
			PterBNo.Free();
			PterBData.Free();
			//-----------------------------
			// G[
			//-----------------------------
			DIO.Ccapdio.DioGetErrorString(Ret, szError);
			szReturnCode = "DioInpMultiBit : " + szError;
			txtReturnCode.Text = szReturnCode;	
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
			{
				return;
			}
			//-----------------------------
			// f[^\
			//-----------------------------
			for (i=0; i<InpBitNum; i++)
			{
				szText = string.Format("{0:X}", InpBitData[i]);
				m_InpBit[i].Text = szText;
			}
		}

		//---------------------------------------------------------
		//	|[go
		//---------------------------------------------------------
		private void btnOutMultiByte_Click(object sender, System.EventArgs e)
		{
			short[]	OutPortNo = new short[DIO_MAX_ACCS_PORTS];
			byte[]	OutPortData = new byte[DIO_MAX_ACCS_PORTS];
			short	i;
			uint	dwTmp;
			//-----------------------------
			// |[gԍA|[gf[^Zbg
			//-----------------------------
			for (i=0; i<OutPortNum; i++)
			{
				OutPortNo[i] = i;
				szText = m_OutPort[i].Text;
				try
				{
					dwTmp = uint.Parse(szText, NumberStyles.HexNumber);
				}
				catch (System.FormatException)
				{
					dwTmp = 0;
				}
				OutPortData[i] = (byte)dwTmp;
			}
			//-----------------------------
			// |[go
			//-----------------------------
			GCHandle PterPNo = GCHandle.Alloc(OutPortNo, GCHandleType.Pinned);
			GCHandle PterPData = GCHandle.Alloc(OutPortData, GCHandleType.Pinned);
			Ret = DIO.Ccapdio.DioOutMultiByte(Id, OutPortNo, OutPortNum, OutPortData);
			PterPNo.Free();
			PterPData.Free();
			//-----------------------------
			// G[
			//-----------------------------
			DIO.Ccapdio.DioGetErrorString(Ret, szError);
			szReturnCode = "DioOutMultiByte : " + szError;
			txtReturnCode.Text = szReturnCode;	
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS) 
			{
				return;
			}
		}

		//---------------------------------------------------------
		//	rbgo
		//---------------------------------------------------------
		private void btnOutMultiBit_Click(object sender, System.EventArgs e)
		{
			short[]	OutBitNo = new short[DIO_MAX_ACCS_BITS];
			byte[]	OutBitData = new byte[DIO_MAX_ACCS_BITS];
			short	i;
			uint	dwTmp;
			//-----------------------------
			// rbgԍArbgf[^Zbg
			//-----------------------------
			for (i=0; i<OutBitNum; i++)
			{
				OutBitNo[i] = i;
				szText = m_OutBit[i].Text;
				try
				{
					dwTmp = uint.Parse(szText, NumberStyles.HexNumber);
				}
				catch (System.FormatException)
				{
					dwTmp = 0;
				}
				OutBitData[i] = (byte)dwTmp;
			}
			//-----------------------------
			// rbgo
			//-----------------------------
			GCHandle PterBNo = GCHandle.Alloc(OutBitNo, GCHandleType.Pinned);
			GCHandle PterBData = GCHandle.Alloc(OutBitData, GCHandleType.Pinned);
			Ret = DIO.Ccapdio.DioOutMultiBit(Id, OutBitNo, OutBitNum, OutBitData);
			PterBNo.Free();
			PterBData.Free();
			//-----------------------------
			// G[
			//-----------------------------
			DIO.Ccapdio.DioGetErrorString(Ret, szError);
			szReturnCode = "DioOutMultiBit : " + szError;
			txtReturnCode.Text = szReturnCode;	
			if (Ret != DIO.Ccapdio.DIO_ERR_SUCCESS)
			{
				return;
			}
		}

		//---------------------------------------------------------
		//	I
		//---------------------------------------------------------
		private void btnDioExit_Click(object sender, System.EventArgs e)
		{
			//-----------------------------
			// Is
			//-----------------------------
			Ret = DIO.Ccapdio.DioExit(Id);
			//-----------------------------
			// G[
			//-----------------------------
			DIO.Ccapdio.DioGetErrorString(Ret, szError);
			szReturnCode = "DioExit : " + szError;
			txtReturnCode.Text = szReturnCode;
		}

		//---------------------------------------------------------
		//	_CAOI
		//---------------------------------------------------------
		private void btnExit_Click(object sender, System.EventArgs e)
		{
			//-----------------------------
			// Is
			//-----------------------------
			Ret = DIO.Ccapdio.DioExit(Id);
			//-----------------------------
			// _CAOI
			//-----------------------------
			this.Close();
		}

		private void MultiIO_Closed(object sender, System.EventArgs e)
		{
			//-----------------------------
			// Is
			//-----------------------------
			Ret = DIO.Ccapdio.DioExit(Id);
		}
	}
}