#pragma once #include #pragma comment(lib, "user32.lib") namespace PowerTank { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; /// /// Form1 の概要 /// public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: ここにコンストラクター コードを追加します // } protected: /// /// 使用中のリソースをすべてクリーンアップします。 /// ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::GroupBox^ groupBox1; protected: private: System::Windows::Forms::NumericUpDown^ numericUpDown3; private: System::Windows::Forms::NumericUpDown^ numericUpDown2; private: System::Windows::Forms::NumericUpDown^ numericUpDown1; private: System::Windows::Forms::CheckBox^ checkBox3; private: System::Windows::Forms::CheckBox^ checkBox2; private: System::Windows::Forms::CheckBox^ checkBox1; private: System::Windows::Forms::Label^ label2; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::GroupBox^ groupBox2; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::Label^ label4; private: System::Windows::Forms::NumericUpDown^ numericUpDown6; private: System::Windows::Forms::NumericUpDown^ numericUpDown5; private: System::Windows::Forms::NumericUpDown^ numericUpDown4; private: System::Windows::Forms::CheckBox^ checkBox6; private: System::Windows::Forms::CheckBox^ checkBox5; private: System::Windows::Forms::CheckBox^ checkBox4; private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::GroupBox^ groupBox3; private: System::Windows::Forms::DomainUpDown^ domainUpDown1; private: System::Windows::Forms::DomainUpDown^ domainUpDown2; private: System::ComponentModel::BackgroundWorker^ backgroundWorker1; private: System::Windows::Forms::Button^ button2; private: System::Windows::Forms::Label^ label5; private: System::Windows::Forms::CheckBox^ checkBox7; private: System::Windows::Forms::CheckBox^ checkBox8; private: /// /// 必要なデザイナー変数です。 /// System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// /// デザイナー サポートに必要なメソッドです。このメソッドの内容を /// コード エディターで変更しないでください。 /// void InitializeComponent(void) { this->groupBox1 = (gcnew System::Windows::Forms::GroupBox()); this->domainUpDown1 = (gcnew System::Windows::Forms::DomainUpDown()); this->label2 = (gcnew System::Windows::Forms::Label()); this->label1 = (gcnew System::Windows::Forms::Label()); this->numericUpDown3 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown2 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown()); this->checkBox3 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox2 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox1 = (gcnew System::Windows::Forms::CheckBox()); this->groupBox2 = (gcnew System::Windows::Forms::GroupBox()); this->domainUpDown2 = (gcnew System::Windows::Forms::DomainUpDown()); this->label3 = (gcnew System::Windows::Forms::Label()); this->label4 = (gcnew System::Windows::Forms::Label()); this->numericUpDown6 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown5 = (gcnew System::Windows::Forms::NumericUpDown()); this->numericUpDown4 = (gcnew System::Windows::Forms::NumericUpDown()); this->checkBox6 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox5 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox4 = (gcnew System::Windows::Forms::CheckBox()); this->button1 = (gcnew System::Windows::Forms::Button()); this->groupBox3 = (gcnew System::Windows::Forms::GroupBox()); this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker()); this->button2 = (gcnew System::Windows::Forms::Button()); this->label5 = (gcnew System::Windows::Forms::Label()); this->checkBox7 = (gcnew System::Windows::Forms::CheckBox()); this->checkBox8 = (gcnew System::Windows::Forms::CheckBox()); this->groupBox1->SuspendLayout(); (cli::safe_cast(this->numericUpDown3))->BeginInit(); (cli::safe_cast(this->numericUpDown2))->BeginInit(); (cli::safe_cast(this->numericUpDown1))->BeginInit(); this->groupBox2->SuspendLayout(); (cli::safe_cast(this->numericUpDown6))->BeginInit(); (cli::safe_cast(this->numericUpDown5))->BeginInit(); (cli::safe_cast(this->numericUpDown4))->BeginInit(); this->SuspendLayout(); // // groupBox1 // this->groupBox1->Controls->Add(this->domainUpDown1); this->groupBox1->Controls->Add(this->label2); this->groupBox1->Controls->Add(this->label1); this->groupBox1->Controls->Add(this->numericUpDown3); this->groupBox1->Controls->Add(this->numericUpDown2); this->groupBox1->Controls->Add(this->numericUpDown1); this->groupBox1->Controls->Add(this->checkBox3); this->groupBox1->Controls->Add(this->checkBox2); this->groupBox1->Controls->Add(this->checkBox1); this->groupBox1->Font = (gcnew System::Drawing::Font(L"メイリオ", 9, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), System::Drawing::GraphicsUnit::Point, static_cast(128))); this->groupBox1->Location = System::Drawing::Point(12, 12); this->groupBox1->Name = L"groupBox1"; this->groupBox1->Size = System::Drawing::Size(247, 100); this->groupBox1->TabIndex = 0; this->groupBox1->TabStop = false; this->groupBox1->Text = L"Player1 Power"; // // domainUpDown1 // this->domainUpDown1->AutoSize = true; this->domainUpDown1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->domainUpDown1->Items->Add(L"固定"); this->domainUpDown1->Items->Add(L"以上"); this->domainUpDown1->Location = System::Drawing::Point(96, 46); this->domainUpDown1->Name = L"domainUpDown1"; this->domainUpDown1->Size = System::Drawing::Size(57, 19); this->domainUpDown1->TabIndex = 8; this->domainUpDown1->Text = L"以上"; this->domainUpDown1->Wrap = true; this->domainUpDown1->SelectedItemChanged += gcnew System::EventHandler(this, &Form1::domainUpDown1_SelectedItemChanged); // // label2 // this->label2->AutoSize = true; this->label2->Font = (gcnew System::Drawing::Font(L"メイリオ", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->label2->Location = System::Drawing::Point(200, 73); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(30, 17); this->label2->TabIndex = 7; this->label2->Text = L"上昇"; // // label1 // this->label1->AutoSize = true; this->label1->Font = (gcnew System::Drawing::Font(L"メイリオ", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->label1->Location = System::Drawing::Point(93, 73); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(41, 17); this->label1->TabIndex = 6; this->label1->Text = L"F毎に"; // // numericUpDown3 // this->numericUpDown3->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->numericUpDown3->Location = System::Drawing::Point(139, 73); this->numericUpDown3->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {2147483647, 0, 0, 0}); this->numericUpDown3->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); this->numericUpDown3->Name = L"numericUpDown3"; this->numericUpDown3->Size = System::Drawing::Size(59, 19); this->numericUpDown3->TabIndex = 4; this->numericUpDown3->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); // // numericUpDown2 // this->numericUpDown2->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->numericUpDown2->Location = System::Drawing::Point(30, 73); this->numericUpDown2->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {9999, 0, 0, 0}); this->numericUpDown2->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); this->numericUpDown2->Name = L"numericUpDown2"; this->numericUpDown2->Size = System::Drawing::Size(59, 19); this->numericUpDown2->TabIndex = 3; this->numericUpDown2->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); // // numericUpDown1 // this->numericUpDown1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->numericUpDown1->Location = System::Drawing::Point(30, 46); this->numericUpDown1->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {2147483647, 0, 0, 0}); this->numericUpDown1->Name = L"numericUpDown1"; this->numericUpDown1->Size = System::Drawing::Size(59, 19); this->numericUpDown1->TabIndex = 2; // // checkBox3 // this->checkBox3->AutoSize = true; this->checkBox3->Location = System::Drawing::Point(6, 74); this->checkBox3->Name = L"checkBox3"; this->checkBox3->Size = System::Drawing::Size(15, 14); this->checkBox3->TabIndex = 0; this->checkBox3->UseVisualStyleBackColor = true; // // checkBox2 // this->checkBox2->AutoSize = true; this->checkBox2->Location = System::Drawing::Point(6, 48); this->checkBox2->Name = L"checkBox2"; this->checkBox2->Size = System::Drawing::Size(15, 14); this->checkBox2->TabIndex = 1; this->checkBox2->UseVisualStyleBackColor = true; this->checkBox2->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox2_CheckedChanged); // // checkBox1 // this->checkBox1->AutoSize = true; this->checkBox1->Font = (gcnew System::Drawing::Font(L"メイリオ", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->checkBox1->Location = System::Drawing::Point(6, 18); this->checkBox1->Name = L"checkBox1"; this->checkBox1->Size = System::Drawing::Size(91, 24); this->checkBox1->TabIndex = 0; this->checkBox1->Text = L" MAX 固定"; this->checkBox1->UseVisualStyleBackColor = true; this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox1_CheckedChanged); // // groupBox2 // this->groupBox2->Controls->Add(this->domainUpDown2); this->groupBox2->Controls->Add(this->label3); this->groupBox2->Controls->Add(this->label4); this->groupBox2->Controls->Add(this->numericUpDown6); this->groupBox2->Controls->Add(this->numericUpDown5); this->groupBox2->Controls->Add(this->numericUpDown4); this->groupBox2->Controls->Add(this->checkBox6); this->groupBox2->Controls->Add(this->checkBox5); this->groupBox2->Controls->Add(this->checkBox4); this->groupBox2->Font = (gcnew System::Drawing::Font(L"メイリオ", 9, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), System::Drawing::GraphicsUnit::Point, static_cast(128))); this->groupBox2->Location = System::Drawing::Point(12, 118); this->groupBox2->Name = L"groupBox2"; this->groupBox2->Size = System::Drawing::Size(247, 100); this->groupBox2->TabIndex = 1; this->groupBox2->TabStop = false; this->groupBox2->Text = L"Player2 Power"; // // domainUpDown2 // this->domainUpDown2->AutoSize = true; this->domainUpDown2->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->domainUpDown2->Items->Add(L"固定"); this->domainUpDown2->Items->Add(L"以上"); this->domainUpDown2->Location = System::Drawing::Point(96, 46); this->domainUpDown2->Name = L"domainUpDown2"; this->domainUpDown2->Size = System::Drawing::Size(57, 19); this->domainUpDown2->TabIndex = 9; this->domainUpDown2->Text = L"以上"; this->domainUpDown2->Wrap = true; this->domainUpDown2->SelectedItemChanged += gcnew System::EventHandler(this, &Form1::domainUpDown2_SelectedItemChanged); // // label3 // this->label3->AutoSize = true; this->label3->Font = (gcnew System::Drawing::Font(L"メイリオ", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->label3->Location = System::Drawing::Point(200, 73); this->label3->Name = L"label3"; this->label3->Size = System::Drawing::Size(30, 17); this->label3->TabIndex = 7; this->label3->Text = L"上昇"; // // label4 // this->label4->AutoSize = true; this->label4->Font = (gcnew System::Drawing::Font(L"メイリオ", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->label4->Location = System::Drawing::Point(93, 73); this->label4->Name = L"label4"; this->label4->Size = System::Drawing::Size(41, 17); this->label4->TabIndex = 6; this->label4->Text = L"F毎に"; // // numericUpDown6 // this->numericUpDown6->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->numericUpDown6->Location = System::Drawing::Point(139, 73); this->numericUpDown6->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {2147483647, 0, 0, 0}); this->numericUpDown6->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); this->numericUpDown6->Name = L"numericUpDown6"; this->numericUpDown6->Size = System::Drawing::Size(59, 19); this->numericUpDown6->TabIndex = 4; this->numericUpDown6->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); // // numericUpDown5 // this->numericUpDown5->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->numericUpDown5->Location = System::Drawing::Point(30, 73); this->numericUpDown5->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {9999, 0, 0, 0}); this->numericUpDown5->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); this->numericUpDown5->Name = L"numericUpDown5"; this->numericUpDown5->Size = System::Drawing::Size(59, 19); this->numericUpDown5->TabIndex = 3; this->numericUpDown5->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); // // numericUpDown4 // this->numericUpDown4->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->numericUpDown4->Location = System::Drawing::Point(30, 46); this->numericUpDown4->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {2147483647, 0, 0, 0}); this->numericUpDown4->Name = L"numericUpDown4"; this->numericUpDown4->Size = System::Drawing::Size(59, 19); this->numericUpDown4->TabIndex = 2; // // checkBox6 // this->checkBox6->AutoSize = true; this->checkBox6->Location = System::Drawing::Point(6, 74); this->checkBox6->Name = L"checkBox6"; this->checkBox6->Size = System::Drawing::Size(15, 14); this->checkBox6->TabIndex = 0; this->checkBox6->UseVisualStyleBackColor = true; // // checkBox5 // this->checkBox5->AutoSize = true; this->checkBox5->Location = System::Drawing::Point(6, 48); this->checkBox5->Name = L"checkBox5"; this->checkBox5->Size = System::Drawing::Size(15, 14); this->checkBox5->TabIndex = 1; this->checkBox5->UseVisualStyleBackColor = true; this->checkBox5->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox5_CheckedChanged); // // checkBox4 // this->checkBox4->AutoSize = true; this->checkBox4->Font = (gcnew System::Drawing::Font(L"メイリオ", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->checkBox4->Location = System::Drawing::Point(6, 19); this->checkBox4->Name = L"checkBox4"; this->checkBox4->Size = System::Drawing::Size(91, 24); this->checkBox4->TabIndex = 0; this->checkBox4->Text = L" MAX 固定"; this->checkBox4->UseVisualStyleBackColor = true; this->checkBox4->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox4_CheckedChanged); // // button1 // this->button1->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->button1->Location = System::Drawing::Point(151, 239); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(107, 38); this->button1->TabIndex = 2; this->button1->Text = L"実行"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // groupBox3 // this->groupBox3->Location = System::Drawing::Point(12, 224); this->groupBox3->Name = L"groupBox3"; this->groupBox3->Size = System::Drawing::Size(0, 0); this->groupBox3->TabIndex = 3; this->groupBox3->TabStop = false; this->groupBox3->Text = L"groupBox3"; // // backgroundWorker1 // this->backgroundWorker1->WorkerReportsProgress = true; this->backgroundWorker1->WorkerSupportsCancellation = true; this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &Form1::backgroundWorker1_DoWork); this->backgroundWorker1->ProgressChanged += gcnew System::ComponentModel::ProgressChangedEventHandler(this, &Form1::backgroundWorker1_ProgressChanged); this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &Form1::backgroundWorker1_RunWorkerCompleted); // // button2 // this->button2->Enabled = false; this->button2->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(128))); this->button2->Location = System::Drawing::Point(152, 239); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(107, 38); this->button2->TabIndex = 10; this->button2->Text = L"中断"; this->button2->UseVisualStyleBackColor = true; this->button2->Visible = false; this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click); // // label5 // this->label5->AutoSize = true; this->label5->Font = (gcnew System::Drawing::Font(L"メイリオ", 9.75F, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)), System::Drawing::GraphicsUnit::Point, static_cast(128))); this->label5->Location = System::Drawing::Point(168, 220); this->label5->Name = L"label5"; this->label5->Size = System::Drawing::Size(74, 20); this->label5->TabIndex = 11; this->label5->Text = L"現在実行中"; this->label5->Visible = false; // // checkBox7 // this->checkBox7->AutoSize = true; this->checkBox7->Location = System::Drawing::Point(18, 225); this->checkBox7->Name = L"checkBox7"; this->checkBox7->Size = System::Drawing::Size(91, 16); this->checkBox7->TabIndex = 12; this->checkBox7->Text = L"試合終了まで"; this->checkBox7->UseVisualStyleBackColor = true; this->checkBox7->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox7_CheckedChanged); // // checkBox8 // this->checkBox8->AutoSize = true; this->checkBox8->Location = System::Drawing::Point(18, 248); this->checkBox8->Name = L"checkBox8"; this->checkBox8->Size = System::Drawing::Size(102, 16); this->checkBox8->TabIndex = 13; this->checkBox8->Text = L"ラウンド終了まで"; this->checkBox8->UseVisualStyleBackColor = true; this->checkBox8->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox8_CheckedChanged); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(270, 287); this->Controls->Add(this->checkBox8); this->Controls->Add(this->checkBox7); this->Controls->Add(this->label5); this->Controls->Add(this->button2); this->Controls->Add(this->groupBox3); this->Controls->Add(this->button1); this->Controls->Add(this->groupBox2); this->Controls->Add(this->groupBox1); this->Name = L"Form1"; this->Text = L"PowerTank"; this->groupBox1->ResumeLayout(false); this->groupBox1->PerformLayout(); (cli::safe_cast(this->numericUpDown3))->EndInit(); (cli::safe_cast(this->numericUpDown2))->EndInit(); (cli::safe_cast(this->numericUpDown1))->EndInit(); this->groupBox2->ResumeLayout(false); this->groupBox2->PerformLayout(); (cli::safe_cast(this->numericUpDown6))->EndInit(); (cli::safe_cast(this->numericUpDown5))->EndInit(); (cli::safe_cast(this->numericUpDown4))->EndInit(); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { if(checkBox1->Checked){ numericUpDown1->Enabled = false; numericUpDown2->Enabled = false; numericUpDown3->Enabled = false; domainUpDown1->Enabled = false; } if(!checkBox1->Checked){ numericUpDown1->Enabled = true; numericUpDown2->Enabled = true; numericUpDown3->Enabled = true; domainUpDown1->Enabled = true; } } private: System::Void checkBox4_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { if(checkBox4->Checked){ numericUpDown4->Enabled = false; numericUpDown5->Enabled = false; numericUpDown6->Enabled = false; domainUpDown2->Enabled = false; } if(!checkBox4->Checked){ numericUpDown4->Enabled = true; numericUpDown5->Enabled = true; numericUpDown6->Enabled = true; domainUpDown2->Enabled = true; } } private: System::Void domainUpDown1_SelectedItemChanged(System::Object^ sender, System::EventArgs^ e) { if(domainUpDown1->Text!=L"固定" && domainUpDown1->Text!=L"以上"){ domainUpDown1->Text=L"固定"; } if(domainUpDown1->Text==L"以上"){ numericUpDown2->Enabled = true; numericUpDown3->Enabled = true; } if(checkBox2->Checked && domainUpDown1->Text==L"固定"){ numericUpDown2->Enabled = false; numericUpDown3->Enabled = false; } } private: System::Void domainUpDown2_SelectedItemChanged(System::Object^ sender, System::EventArgs^ e) { if(domainUpDown2->Text!=L"固定" && domainUpDown2->Text!=L"以上"){ domainUpDown2->Text=L"固定"; } if(domainUpDown2->Text==L"以上"){ numericUpDown5->Enabled = true; numericUpDown6->Enabled = true; } if(checkBox5->Checked && domainUpDown2->Text==L"固定"){ numericUpDown5->Enabled = false; numericUpDown6->Enabled = false; } } private: System::Void checkBox7_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { if(checkBox7->Checked && checkBox8->Checked)checkBox8->Checked = false; } private: System::Void checkBox8_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { if(checkBox7->Checked && checkBox8->Checked)checkBox7->Checked = false; } private: System::Void checkBox2_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { if(!checkBox2->Checked){ numericUpDown2->Enabled = true; numericUpDown3->Enabled = true; } if(checkBox2->Checked && domainUpDown1->Text==L"固定"){ numericUpDown2->Enabled = false; numericUpDown3->Enabled = false; } } private: System::Void checkBox5_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { if(!checkBox5->Checked){ numericUpDown5->Enabled = true; numericUpDown6->Enabled = true; } if(checkBox5->Checked && domainUpDown2->Text==L"固定"){ numericUpDown5->Enabled = false; numericUpDown6->Enabled = false; } } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { //実行ボタン // ボタン等の変更 button1->Visible = false; button1->Enabled = false; checkBox1->Enabled = false; checkBox2->Enabled = false; checkBox3->Enabled = false; checkBox4->Enabled = false; checkBox5->Enabled = false; checkBox6->Enabled = false; checkBox7->Enabled = false; checkBox8->Enabled = false; numericUpDown1->Enabled = false; numericUpDown2->Enabled = false; numericUpDown3->Enabled = false; numericUpDown4->Enabled = false; numericUpDown5->Enabled = false; numericUpDown6->Enabled = false; domainUpDown1->Enabled = false; domainUpDown2->Enabled = false; button2->Enabled = true; button2->Visible = true; label5->Visible = true; backgroundWorker1->RunWorkerAsync(); //メイン処理 } private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) { //メイン処理 do{ // 変数等の設定 int UpDown1; int UpDown2; int UpDown3; int UpDown4; int UpDown5; int UpDown6; UpDown1 = (int)numericUpDown1->Value; UpDown2 = (int)numericUpDown2->Value; UpDown3 = (int)numericUpDown3->Value; UpDown4 = (int)numericUpDown4->Value; UpDown5 = (int)numericUpDown5->Value; UpDown6 = (int)numericUpDown6->Value; int Prevtime1 = 0; int Prevtime2 = 0; int Endflag = 0; int RoundStateflag = 0; char *lpData0; char *lpDataPP; char *lpDataGametime; char *lpDataRo; char *lpDataRoS; char *lpDatacheck1; char *lpDatacheck2; char *lpDataP1power; char *lpDataP2power; LPVOID EAX[1] = {0}; LPVOID EBX[2] = {0}; LPVOID Gametime[1] = {0}; LPVOID RoundState[1] = {0}; LPVOID check1[1] = {0}; LPVOID check2[1] = {0}; LPVOID P1Power[2] = {0}; LPVOID P2Power[2] = {0}; LPVOID setPower[1] = {0}; DWORD dwAccessByte = 0; // MUGENのハンドルを取得する処理 HWND hWnd; DWORD dwPID; HANDLE ph; hWnd = FindWindow(NULL, L"M.U.G.E.N"); //ウィンドウハンドルを名称より取得、多重起動は放置。 GetWindowThreadProcessId(hWnd,&dwPID); //プロセスID取得 ph = OpenProcess(PROCESS_ALL_ACCESS,TRUE,dwPID); //プロセスハンドル取得、及び権限取得? if(!hWnd){ MessageBox::Show("M.U.G.E.Nのウィンドウが見つかりませんでした。\n","エラーメッセージ"); return; } // MUGENの情報の位置確認 // 基本のアドレス EAX取得 // 004B5B4C:ポインタ → EAX[0] lpData0=(char *)0x004B5B4C; ReadProcessMemory(ph,lpData0,EAX,4,&dwAccessByte); // プレイヤー情報ポインタ取得 // EAX+B754h:1Pのポインタ → EBX[0] // EAX+B758h:2Pのポインタ → EBX[1] lpDataPP=(char *)EAX[0]; lpDataPP+=0xB754; backgroundWorker1->ReportProgress(1); do{ ReadProcessMemory(ph,lpData0,EAX,4,&dwAccessByte); if(dwAccessByte == 0)return; //ループ中MUGEN消失 if(RoundStateflag<2){ RoundStateflag++; //初回読み込み失敗時≒試合前実行は2 } ReadProcessMemory(ph,lpDataPP,EBX,8,&dwAccessByte); if (backgroundWorker1->CancellationPending) { //中断処理 e->Cancel = true; return; } }while(dwAccessByte == 0 || EBX[0]==0 || EBX[1]==0); // EAX+BC30h:ラウンドステート → RoundState[0] // EBX+0158h:存在フラグ → check1[0],check2[0] ※Shift+F4でも消える // EBX+0178h:power → P1Power[0],P2Power[0] // EBX+017Ch:powermax → P1Power[1],P21Power[1] // EAX+B3FCh:gametime → Gametime[0] ※MUGEN起動後の総試合の合計 1秒=60 lpDataRo=(char *)EAX[0]; lpDataRo+=0xBC04; lpDataRoS=(char *)EAX[0]; lpDataRoS+=0xBC30; lpDataGametime=(char *)EAX[0]; lpDataGametime+=0xB3FC; lpDataP1power=(char *)EBX[0]; lpDataP1power+=0x0178; lpDatacheck1=(char *)EBX[0]; lpDatacheck1+=0x0158; lpDataP2power=(char *)EBX[1]; lpDataP2power+=0x0178; lpDatacheck2=(char *)EBX[1]; lpDatacheck2+=0x0158; while(RoundStateflag!=1 && dwAccessByte!=0){ //試合前実行用処理。 ReadProcessMemory(ph,lpDataRoS,RoundState,4,&dwAccessByte); if(RoundStateflag==2 && (int)RoundState[0] != 1)RoundStateflag=0; if(RoundStateflag==0 && (int)RoundState[0] == 1)RoundStateflag=1; if (backgroundWorker1->CancellationPending) { //中断処理 e->Cancel = true; return; } } backgroundWorker1->ReportProgress(0); // MUGEN監視開始 while(dwAccessByte!=0){ // 存在確認とラウンドステート取得 ReadProcessMemory(ph,lpDatacheck1,check1,4,&dwAccessByte); ReadProcessMemory(ph,lpDatacheck2,check2,4,&dwAccessByte); ReadProcessMemory(ph,lpDataRoS,RoundState,4,&dwAccessByte); // チーム戦キャラ切り替え時用 if((int)RoundState[0] != 2 && (!check1[0] || !check2[0]) && (check1[0] || check2[0])){ do{ ReadProcessMemory(ph,lpDataPP,EBX,8,&dwAccessByte); if (backgroundWorker1->CancellationPending) { //中断処理 e->Cancel = true; return; } }while(dwAccessByte == 0 || EBX[0]==0 || EBX[1]==0); lpDataP1power=(char *)EBX[0]; lpDataP1power+=0x0178; lpDatacheck1=(char *)EBX[0]; lpDatacheck1+=0x0158; lpDataP2power=(char *)EBX[1]; lpDataP2power+=0x0178; lpDatacheck2=(char *)EBX[1]; lpDatacheck2+=0x0158; do{ ReadProcessMemory(ph,lpDatacheck1,check1,4,&dwAccessByte); ReadProcessMemory(ph,lpDatacheck2,check2,4,&dwAccessByte); if (backgroundWorker1->CancellationPending) { //中断処理 e->Cancel = true; return; } }while(dwAccessByte == 0 || (!check1[0] || !check2[0]) && (check1[0] || check2[0])); } if(dwAccessByte==0 || !check1[0] || !check2[0] || checkBox8->Checked && (int)RoundState[0] > 2 && RoundStateflag==2){ break; //情報取得失敗か、監視中のキャラが消えたか、ラウンド終了時に抜ける。 } // 試合中なら if((int)RoundState[0] == 2){ // 1P用 // Power確認 ReadProcessMemory(ph,lpDataP1power,P1Power,8,&dwAccessByte); if(checkBox1->Checked){ //1PMAX setPower[0] = P1Power[1]; WriteProcessMemory(ph,lpDataP1power,setPower,4,&dwAccessByte); }else{ if(checkBox2->Checked){ //1P指定値 if(UpDown1 >= (int)P1Power[1]){ setPower[0] = P1Power[1]; }else{ setPower[0] = (LPVOID)UpDown1; } if(domainUpDown1->Text==L"以上" && P1Power[0]Text==L"固定"){ WriteProcessMemory(ph,lpDataP1power,setPower,4,&dwAccessByte); } } if(checkBox3->Checked && (!checkBox2->Checked || domainUpDown1->Text==L"以上")){ //1P上昇 ReadProcessMemory(ph,lpDataGametime,Gametime,4,&dwAccessByte); if((int)Gametime[0] >= Prevtime1 + UpDown2){ if((int)P1Power[1] - (int)P1Power[0] < UpDown3){ setPower[0] = P1Power[1]; }else{ setPower[0] = (LPVOID)((int)P1Power[0]+UpDown3); } WriteProcessMemory(ph,lpDataP1power,setPower,4,&dwAccessByte); Prevtime1 = (int)Gametime[0]; } } } // 2P用 // Power確認 ReadProcessMemory(ph,lpDataP2power,P2Power,8,&dwAccessByte); if(checkBox4->Checked){ //2PMAX setPower[0] = P2Power[1]; WriteProcessMemory(ph,lpDataP2power,setPower,4,&dwAccessByte); }else{ if(checkBox5->Checked){ //2P指定値 if(UpDown4 >= (int)P2Power[1]){ setPower[0] = P2Power[1]; }else{ setPower[0] = (LPVOID)UpDown4; } if(domainUpDown2->Text==L"以上" && P2Power[0]Text==L"固定"){ WriteProcessMemory(ph,lpDataP2power,setPower,4,&dwAccessByte); } } if(checkBox6->Checked && (!checkBox5->Checked || domainUpDown2->Text==L"以上")){ //2P上昇 ReadProcessMemory(ph,lpDataGametime,Gametime,4,&dwAccessByte); if((int)Gametime[0] >= Prevtime2 + UpDown5){ if((int)P2Power[1] - (int)P2Power[0] < UpDown6){ setPower[0] = P2Power[1]; }else{ setPower[0] = (LPVOID)((int)P2Power[0]+UpDown6); } WriteProcessMemory(ph,lpDataP2power,setPower,4,&dwAccessByte); Prevtime2 = (int)Gametime[0]; } } } if(RoundStateflag==1)RoundStateflag++; //1回でもちゃんと動いたら2に }//試合中処理の終わり if (backgroundWorker1->CancellationPending) { //中断処理 e->Cancel = true; return; } } }while(checkBox7->Checked == false && checkBox8->Checked == false); } private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e) { //処理終了 //ボタン等を戻す label5->Visible = false; button2->Enabled = false; button2->Visible = false; button1->Enabled = true; button1->Visible = true; checkBox1->Enabled = true; checkBox2->Enabled = true; checkBox3->Enabled = true; checkBox4->Enabled = true; checkBox5->Enabled = true; checkBox6->Enabled = true; checkBox7->Enabled = true; checkBox8->Enabled = true; numericUpDown1->Enabled = true; numericUpDown2->Enabled = true; numericUpDown3->Enabled = true; numericUpDown4->Enabled = true; numericUpDown5->Enabled = true; numericUpDown6->Enabled = true; domainUpDown1->Enabled = true; domainUpDown2->Enabled = true; if(checkBox2->Checked && domainUpDown1->Text==L"固定"){ numericUpDown2->Enabled = false; numericUpDown3->Enabled = false; } if(checkBox5->Checked && domainUpDown2->Text==L"固定"){ numericUpDown5->Enabled = false; numericUpDown6->Enabled = false; } if(checkBox1->Checked){ numericUpDown1->Enabled = false; numericUpDown2->Enabled = false; numericUpDown3->Enabled = false; domainUpDown1->Enabled = false; } if(checkBox4->Checked){ numericUpDown4->Enabled = false; numericUpDown5->Enabled = false; numericUpDown6->Enabled = false; domainUpDown2->Enabled = false; } } private: System::Void backgroundWorker1_ProgressChanged(System::Object^ sender, System::ComponentModel::ProgressChangedEventArgs^ e) { if(e->ProgressPercentage==0)label5->Text = L"現在実行中"; if(e->ProgressPercentage==1)label5->Text = L"現在待機中"; } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { //中断ボタン backgroundWorker1->CancelAsync(); } }; }