gimpei @Wiki

見た目のスキンのソース

最終更新:

匿名ユーザー

- view
だれでも歓迎! 編集
using System;
using System.Drawing;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading ;  // for Thread
using System.Text.RegularExpressions; //for正規表現
using System.Runtime.InteropServices ;  // for DllImport
using System.ServiceProcess;//ForAppDll
using System.DirectoryServices;//ForAppDll
using Microsoft.Win32;//forHard
using System.Text;
using Microsoft.CSharp;
//using Win32API;

namespace Muno0._1
{


/// <summary>
/// Form1 の概要の説明です。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button submit_b;
//以下いろいろイニシャライズ

// カレントディレクトリを取得する
string nCurrentDir = System.IO.Directory.GetCurrentDirectory();

//グローバル変数の設定
int t2c=0,m_x=0,m_y=0,giHour=0,giMinute=0;
private Point mMousePoint;
bool m_drag=false;
bool m_down=false;
string gTxt="";

//****以下の設定はグローバルのブール型に汎用する
bool[] gBool = new bool[100];

//****Random クラスの新しいインスタンスを生成する
Random hRandom = new System.Random();

//ProcessControllerManager is destined to the control of the system Processes via the Process component
//*****プロセスマネージメント
private ProcessControllerManager objPcsCrtlMgr = new ProcessControllerManager();

string iTxt;
//プログラムランチャの初期設定
string command;
System.Diagnostics.Process p;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox SocialWindow;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer cTimer;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Timer name_timer;
private System.ComponentModel.IContainer components;


//*****干渉用
//Running processes listBox
private System.Windows.Forms.ListBox lstPcsRun;
//Processes info listBox
private System.Windows.Forms.ListBox lstPcs;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.TextBox txtMachineName;
// returns the name of the local machine
public string GetLocalMachine()
{
return System.Environment.MachineName;
}

public string GetMachineName()
{
/*
if((txtMachineName.Text.Equals(""))|(txtMachineName.Text=null))

//machineName field is empty, take the local machine
{
txtMachineName.Text=GetLocalMachine();
txtMachineName.Focus();

}
*/
return System.Environment.MachineName;
}

//*****干渉用
public Form1()
{
//
// Windows フォーム デザイナ サポートに必要です。
//
InitializeComponent();
// このフォームをタスクバーに表示しない
this.ShowInTaskbar = false;

//****時間系の宣言
// 必要な変数を宣言する
DateTime dtNow = DateTime.Now;
// 時を取得する
int iHour = dtNow.Hour;
giHour = iHour;
// 分を取得する
int iMinute = dtNow.Minute;
giMinute = iMinute;




//以下、PATHの起動設定
/*
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
command = "PATH " + nCurrentDir + "\\bin\\Perl\\bin\\;.;" + nCurrentDir + "\\bin\\ChaSen;.;";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
*/
//以上、PATHの処理終わり


// カレントディレクトリを表示する
//MessageBox.Show(nCurrentDir);
//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
}

/// <summary>
/// 使用されているリソースに後処理を実行します。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows フォーム デザイナで生成されたコード
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.submit_b = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.SocialWindow = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.cTimer = new System.Windows.Forms.Timer(this.components);
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.label11 = new System.Windows.Forms.Label();
this.name_timer = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(320, -8);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(208, 328);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
//
// textBox1
//
this.textBox1.ForeColor = System.Drawing.SystemColors.HighlightText;
this.textBox1.Location = new System.Drawing.Point(544, 312);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(280, 19);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "こんにちは。";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// submit_b
//
this.submit_b.BackColor = System.Drawing.Color.PaleGreen;
this.submit_b.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(0)));
this.submit_b.Location = new System.Drawing.Point(736, 344);
this.submit_b.Name = "submit_b";
this.submit_b.Size = new System.Drawing.Size(88, 24);
this.submit_b.TabIndex = 1;
this.submit_b.Text = "submit";
this.submit_b.Click += new System.EventHandler(this.submit_b_Click);
//
// richTextBox1
//
this.richTextBox1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(64)));
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.Cursor = System.Windows.Forms.Cursors.Default;
this.richTextBox1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.richTextBox1.ForeColor = System.Drawing.Color.Ivory;
this.richTextBox1.Location = new System.Drawing.Point(544, 16);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(432, 192);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// pictureBox2
//
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(528, 0);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(472, 240);
this.pictureBox2.TabIndex = 5;
this.pictureBox2.TabStop = false;
//
// pictureBox3
//
this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
this.pictureBox3.Location = new System.Drawing.Point(512, 280);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(344, 136);
this.pictureBox3.TabIndex = 6;
this.pictureBox3.TabStop = false;
//
// SocialWindow
//
this.SocialWindow.Image = ((System.Drawing.Image)(resources.GetObject("SocialWindow.Image")));
this.SocialWindow.Location = new System.Drawing.Point(0, 0);
this.SocialWindow.Name = "SocialWindow";
this.SocialWindow.Size = new System.Drawing.Size(344, 440);
this.SocialWindow.TabIndex = 7;
this.SocialWindow.TabStop = false;
this.SocialWindow.Click += new System.EventHandler(this.SocialWindow_Click);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label1.Cursor = System.Windows.Forms.Cursors.Hand;
this.label1.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label1.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label1.Location = new System.Drawing.Point(40, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(184, 16);
this.label1.TabIndex = 8;
this.label1.Text = "★会話する";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label2.Cursor = System.Windows.Forms.Cursors.Hand;
this.label2.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label2.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label2.Location = new System.Drawing.Point(40, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(232, 16);
this.label2.TabIndex = 9;
this.label2.Text = "★ネットワークにアクセスして最新状態を確認";
//
// label3
//
this.label3.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label3.Cursor = System.Windows.Forms.Cursors.Hand;
this.label3.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label3.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label3.Location = new System.Drawing.Point(40, 88);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(184, 16);
this.label3.TabIndex = 10;
this.label3.Text = "★作者サイトにアクセス";
this.label3.Click += new System.EventHandler(this.label3_Click);
//
// label4
//
this.label4.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label4.Cursor = System.Windows.Forms.Cursors.Hand;
this.label4.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label4.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label4.Location = new System.Drawing.Point(192, 384);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 16);
this.label4.TabIndex = 11;
this.label4.Text = "★Halt";
this.label4.Click += new System.EventHandler(this.label4_Click);
//
// label5
//
this.label5.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label5.Cursor = System.Windows.Forms.Cursors.Hand;
this.label5.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label5.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label5.Location = new System.Drawing.Point(192, 360);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 16);
this.label5.TabIndex = 12;
this.label5.Text = "★アバウト";
this.label5.Click += new System.EventHandler(this.label5_Click);
//
// label6
//
this.label6.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label6.Cursor = System.Windows.Forms.Cursors.Hand;
this.label6.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label6.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label6.Location = new System.Drawing.Point(40, 112);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(232, 16);
this.label6.TabIndex = 13;
this.label6.Text = "★バグ・要望を作者に送る";
this.label6.Click += new System.EventHandler(this.label6_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 5000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// cTimer
//
this.cTimer.Interval = 15000;
this.cTimer.Tick += new System.EventHandler(this.cTimer_Tick);
//
// label7
//
this.label7.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label7.Cursor = System.Windows.Forms.Cursors.Hand;
this.label7.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label7.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label7.Location = new System.Drawing.Point(40, 136);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(232, 16);
this.label7.TabIndex = 14;
this.label7.Text = "★ふきだしバルーンを閉じる";
this.label7.Click += new System.EventHandler(this.label7_Click);
//
// label8
//
this.label8.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label8.Cursor = System.Windows.Forms.Cursors.Hand;
this.label8.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label8.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label8.Location = new System.Drawing.Point(192, 312);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(120, 16);
this.label8.TabIndex = 15;
this.label8.Text = "★Windowsの再起動";
this.label8.Click += new System.EventHandler(this.label8_Click);
//
// label9
//
this.label9.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label9.Cursor = System.Windows.Forms.Cursors.Hand;
this.label9.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label9.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label9.Location = new System.Drawing.Point(192, 336);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(96, 16);
this.label9.TabIndex = 16;
this.label9.Text = "★Windowsの終了";
this.label9.Click += new System.EventHandler(this.label9_Click);
//
// label10
//
this.label10.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label10.Cursor = System.Windows.Forms.Cursors.Hand;
this.label10.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label10.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label10.Location = new System.Drawing.Point(40, 160);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(232, 16);
this.label10.TabIndex = 17;
this.label10.Text = "★タスクトレイに格納する";
this.label10.Click += new System.EventHandler(this.label10_Click);
//
// notifyIcon1
//
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "気分はいつもグルグル";
this.notifyIcon1.Visible = true;
this.notifyIcon1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDown);
//
// label11
//
this.label11.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(64)), ((System.Byte)(128)));
this.label11.Cursor = System.Windows.Forms.Cursors.Hand;
this.label11.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(128)));
this.label11.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label11.Location = new System.Drawing.Point(40, 184);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(232, 16);
this.label11.TabIndex = 18;
this.label11.Text = "★スレッドのON/OFF";
this.label11.Click += new System.EventHandler(this.label11_Click);
//
// name_timer
//
this.name_timer.Enabled = true;
this.name_timer.Interval = 1000;
this.name_timer.Tick += new System.EventHandler(this.name_timer_Tick);
//
// timer2
//
this.timer2.Enabled = true;
this.timer2.Interval = 15000;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// Form1
//
this.AcceptButton = this.submit_b;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
this.BackColor = System.Drawing.Color.Blue;
this.ClientSize = new System.Drawing.Size(1008, 440);
this.ControlBox = false;
this.Controls.Add(this.label11);
this.Controls.Add(this.label10);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.SocialWindow);
this.Controls.Add(this.submit_b);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.pictureBox3);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.pictureBox2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.ShowInTaskbar = false;
this.Text = "ieee1421.2c";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);


}
#endregion

/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
[DllImport("kernel32.dll")]
extern static void GlobalMemoryStatus(ref tagMEMORYSTATUS lpBuffer) ;
//******user32.dllの読み込み
[DllImport("user32.dll")]
extern static IntPtr GetForegroundWindow() ;

[DllImport("user32.dll")]
extern static int GetWindowText(IntPtr hWnd, StringBuilder lpStr, int nMaxCount) ;

[DllImport("User32.Dll")]
extern static void SetWindowText(IntPtr hWn, StringBuilder lpStr);

//*****user32.dllの読み込み終わり

public struct tagMEMORYSTATUS
{
public int dwLength ;
public int dwMemoryLoad ;
public int dwTotalPhys ;      // 合計 物理メモリ    
public int dwAvailPhys ;      // 空き 物理メモリ
public int dwTotalPageFile ;  // 合計 ページファイル
public int dwAvailPageFile ;  // 空き ページファイル
public int dwTotalVirtual ;   // 合計 仮想メモリ(2GB 固定?)
public int dwAvailVirtual ;   // 空き 仮想メモリ
}
/// </summary>
[STAThread]
static void Main()
{
if (! PrevInstance())
{
Application.Run(new Form1());
}
else
{
MessageBox.Show("二重起動は推奨されません。\n理由はファイルの競合が発生するからです。\nどうしても二重起動したい場合は違うディレクトリにコピーして起動してください。");
}
}

private void Form1_Load(object sender, System.EventArgs e)
{
//*****オーバーレイの調整
this.SetStyle(
ControlStyles.DoubleBuffer |         // 描画をバッファで実行する
ControlStyles.UserPaint |            // 描画は(OSでなく)独自に行う
ControlStyles.AllPaintingInWmPaint,  // WM_ERASEBKGND を無視する
true                                 // 指定したスタイルを適用「する」
) ;
//*****オーバーレイの調整終わり




//***PerlディレクトリとChaSenディレクトリが存在しているかどうか確認する
//PATHの設定


//***機能ボックスの初期化
this.pictureBox3.Visible=!true;
this.textBox1.Visible=!true;
this.submit_b.Visible=!true;
this.richTextBox1.Visible=!true;
this.pictureBox2.Visible=!true;
//***フォーカスが移動しないようにする
// textBox1 が [Tab] キーによってフォーカス遷移しないようにする
this.textBox1.TabStop = false;

//フォームのある一定の色を透明にする
this.TransparencyKey = Color.Blue;//青 (システム定義色による指定)
/*
((Bitmap)pictureBox1.Image).MakeTransparent(Color.Blue);
((Bitmap)pictureBox2.Image).MakeTransparent(Color.Blue);
((Bitmap)pictureBox3.Image).MakeTransparent(Color.Blue);
((Bitmap)SocialWindow.Image).MakeTransparent(Color.Blue);
pictureBox1.Refresh();
pictureBox2.Refresh();
pictureBox3.Refresh();
SocialWindow.Refresh();
*/
//this.TransparencyKey = Color.FromArgb(0x00, 0x00, 0xFF);  //青 (RGB による指定)
// 解除する場合
//this.AllowTransparency = false;

//*****Pathの設定(有効でないときがある、原因不明)
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
//***茶せんのパスを設定
command = "path=%PATH%;" + nCurrentDir + "\\Chasen";
p.StandardInput.WriteLine(command);
//***PsToolsの設定
command = "path=%PATH%;" + nCurrentDir + "\\PsTool";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
//MessageBox.Show(nCurrentDir);
//*****Pathの設定終わり

//*****プロセスコントローラの読み出し
string tmpMachineName= GetMachineName();
objPcsCrtlMgr=new ProcessControllerManager(lstPcsRun,lstPcs,tmpMachineName);

//****タイマーのイニシャライズ
timer1.Start();
}

private void Form1_Click(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)  
{
/*  左 ボタンの処理 */
m_x=System.Windows.Forms.Cursor.Position.X;
m_y=System.Windows.Forms.Cursor.Position.Y;
this.SetDesktopLocation(m_x-150, m_y-200);

}
else if (e.Button == MouseButtons.Right)  { /*  右 ボタンの処理 */ }
else if (e.Button == MouseButtons.Middle) { /* 中央ボタンの処理 */ }
}

private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
//左クリックの場合のみ位置を記憶
mMousePoint = new Point(-e.X, -e.Y);
}

m_down=true;
}

private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
//フォームの移動
this.SetDesktopLocation(this.Left + mMousePoint.X + e.X, this.Top + mMousePoint.Y + e.Y);
}
if(m_down==true)
{
m_drag=true;
}
}


private void pictureBox1_MouseMove()
{

}

private void Form1_Closed(object sender, System.EventArgs e)
{
// 終了時、「すぐに」アイコンを消す (念のため)
this.notifyIcon1.Visible = false ;
}

private void pictureBox1_Click(object sender, System.EventArgs e)
{
if(m_drag==!true)
{
//SocialWindowを表示する
if(this.SocialWindow.Visible==true)
{
this.SocialWindow.Visible=!true;
this.label1.Visible=!true;
this.label2.Visible=!true;
this.label3.Visible=!true;
this.label4.Visible=!true;
this.label5.Visible=!true;
this.label6.Visible=!true;
this.label7.Visible=!true;
this.label8.Visible=!true;
this.label9.Visible=!true;
this.label10.Visible=!true;
this.label11.Visible=!true;

this.label1.Refresh();
this.label2.Refresh();
this.label3.Refresh();
this.label4.Refresh();
this.label5.Refresh();
this.label6.Refresh();
this.label7.Refresh();
this.label8.Refresh();
this.label9.Refresh();
this.label10.Refresh();
}
else
{
this.SocialWindow.Visible=true;
this.label1.Visible=true;
this.label2.Visible=true;
this.label3.Visible=true;
this.label4.Visible=true;
this.label5.Visible=true;
this.label6.Visible=true;
this.label7.Visible=true;
this.label8.Visible=true;
this.label9.Visible=true;
this.label10.Visible=true;
this.label11.Visible=true;
this.label1.Refresh();
this.label2.Refresh();
this.label3.Refresh();
this.label4.Refresh();
this.label5.Refresh();
this.label6.Refresh();
this.label7.Refresh();
this.label8.Refresh();
this.label9.Refresh();
this.label10.Refresh();
this.label11.Refresh();
}
}
m_drag=false;
m_down=false;


//フォームの位置を変更する
//マウスの座標をゲットする
/*
m_x=System.Windows.Forms.Cursor.Position.X;
m_y=System.Windows.Forms.Cursor.Position.Y;
this.SetDesktopLocation(m_x-150, m_y-200);
*/
}

private void textBox1_TextChanged(object sender, System.EventArgs e)
{

}

private void submit_b_Click(object sender, System.EventArgs e)
{


if(textBox1.Text== "\\e" | textBox1.Text== "exit" )
{
richTextBox1.Text = "会話を終了しますー。\n" + richTextBox1.Text;
richTextBox1.Refresh();
System.Threading.Thread.Sleep(1000);
this.richTextBox1.Visible=!true;
this.pictureBox2.Visible=!true;
this.pictureBox3.Visible=!true;
this.textBox1.Visible=!true;
this.submit_b.Visible=!true;
}
else
{
iTxt=textBox1.Text;
//***リッチテキストの表示
this.richTextBox1.Visible=true;
this.pictureBox2.Visible=true;
this.richTextBox1.Refresh();
this.pictureBox2.Refresh();

//C#で最初に文字をふるいにかける
localString();

if(t2c==1)
{
//outputFile
oFile();
//以下、chasenの起動ルーチン
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
command = "chasen -o oFile_ch oFile";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
//以上、chasenの処理終わり

//以下、perlで文章を生成
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
command = "perl kernel.pl";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
//以上、perlで文章を生成

//inputFile
iFile();

t2c=0;
}
else
{

}

//入力ボックスのクリア
textBox1.Text="";
}
}



//***********以下サブルーチン
//****ファイル書き出しサブルーチン
void oFile()
{
// hStream が破棄されることを保証するために using を使用する
// 指定したパスのファイルを作成する
using (System.IO.FileStream hStream = System.IO.File.Create(@nCurrentDir + "\\oFile"))
{
// 作成時に返される FileStream を利用して閉じる
if (hStream != null)
{
hStream.Close();
}
}
System.IO.StreamWriter wrt;
wrt = new System.IO.StreamWriter(@nCurrentDir + "\\oFile", false, System.Text.Encoding.Default);
wrt.WriteLine(textBox1.Text);
wrt.Close();
}

//****ファイル読み込みサブルーチン
void iFile()
{
// StreamReader の新しいインスタンスを生成する
System.IO.StreamReader hReader = (new System.IO.StreamReader(@nCurrentDir + "\\iFile", System.Text.Encoding.Default));

// ファイルの最後まで読み込む
string nPrompt = hReader.ReadToEnd();

// hReader を閉じる (正しくは オブジェクトの破棄を保証する を参照)
hReader.Close();

// 結果を表示する
richTextBox1.Text = nPrompt + richTextBox1.Text;
}
//******C#で処理できる文章を扱うところ
void localString()
{//C#での基本文字処理
if((iTxt!=iTxt.Replace("氏ね",""))|(iTxt!=iTxt.Replace("死ね",""))|(iTxt!=iTxt.Replace("シネ",""))|(iTxt!=iTxt.Replace("くたばれ",""))|(iTxt!=iTxt.Replace("ちんこ",""))|(iTxt!=iTxt.Replace("チンコ",""))||(iTxt!=iTxt.Replace("チンコ",""))|(iTxt!=iTxt.Replace("まんこ",""))|(iTxt!=iTxt.Replace("マンコ",""))|(iTxt!=iTxt.Replace("マンコ",""))|(iTxt!=iTxt.Replace("うんこ",""))|(iTxt!=iTxt.Replace("ウンコ",""))|(iTxt!=iTxt.Replace("ウンコ",""))|(iTxt!=iTxt.Replace("うんち",""))|(iTxt!=iTxt.Replace("ウンチ",""))|(iTxt!=iTxt.Replace("ウンチ",""))|(iTxt!=iTxt.Replace("ちんぽ",""))|(iTxt!=iTxt.Replace("キンタマ",""))|(iTxt!=iTxt.Replace("きんたま","")))
{
richTextBox1.Text = "第1級禁止ワードが含まれています。あなたの発言は認識されませんでした。\n" + richTextBox1.Text;
}
else if((iTxt!=iTxt.Replace("オナニー",""))|(iTxt!=iTxt.Replace("オナニー",""))|(iTxt!=iTxt.Replace("オメコ",""))|(iTxt!=iTxt.Replace("おめこ","")))
{
richTextBox1.Text = "第2級禁止ワードが含まれています。あなたの発言は認識されませんでした。\n" + richTextBox1.Text;

}
else if((iTxt!=iTxt.Replace("セックス",""))|(iTxt!=iTxt.Replace("セックス",""))|(iTxt!=iTxt.Replace("キチガイ","")))
{
richTextBox1.Text = "第3級禁止ワードが含まれています。あなたの発言は認識されませんでした。\n" + richTextBox1.Text;
}
//**時間、日付、年などを聞かれたとき
if((iTxt!=iTxt.Replace("何時?",""))|(iTxt!=iTxt.Replace("時間を教えて",""))|(iTxt!=iTxt.Replace("何曜日",""))|(iTxt!=iTxt.Replace("何日","")))
{
// 現在の日付と時刻を取得する
DateTime dtNow = DateTime.Now;
// 取得した日付と時刻を表示する
richTextBox1.Text = dtNow.ToString() + "ですよ。\n" + richTextBox1.Text;
return;
}
//**ieeeってなにって聞かれたとき
if((iTxt!=iTxt.Replace("ieeeって?",""))|(iTxt!=iTxt.Replace("ieeeって",""))|(iTxt!=iTxt.Replace("ieeeとは?",""))|(iTxt!=iTxt.Replace("ieeeとは何","")) | iTxt=="ieee" )
{
richTextBox1.Text = "Institute of Electrical and Electronic Engineersのことですよ。\nちなみに、私はバーチャル規格なので実在しないナンバーを使っています。\n" + richTextBox1.Text;
return;
}

//****C#での正規表現
//**ieee1421を聞かれたとき。
Match iMatch;
iMatch = Regex.Match(iTxt,"ieee1421");
if(iMatch.Success == true )
{
richTextBox1.Text = "わたしのナンバリングはお兄ちゃんが適当につけたものです、特に深い意味はありません。\n" + richTextBox1.Text;
}

if(iTxt.EndsWith("。")|iTxt.EndsWith("?"))
{
t2c=1;
}
else
{
richTextBox1.Text = "文章の解析が難しくなるので、文末には必ず「。」か「?」をつけてください。\n" + richTextBox1.Text;
}
}

//****ふきだしのリフレッシュ
void Refresh_hukidasi()
{
this.richTextBox1.Visible=true;
this.pictureBox2.Visible=true;
this.richTextBox1.Refresh();
this.pictureBox2.Refresh();
}
//****特に機能なし
private void SocialWindow_Click(object sender, System.EventArgs e)
{

}
//****会話モードにチェンジ
private void label1_Click(object sender, System.EventArgs e)
{
this.pictureBox3.Visible=true;
this.textBox1.Visible=true;
this.submit_b.Visible=true;
this.richTextBox1.Visible=true;
this.pictureBox2.Visible=true;

//***最初の会話のイニシャライズ
}
//****このアプリの終了受付
private void label4_Click(object sender, System.EventArgs e)
{
// 必要な変数を宣言する
DateTime tNow = DateTime.Now;
// 0 以上 512 未満の乱数を取得する
int iRnd = hRandom.Next(512);

//表示をリフレッシュ
this.pictureBox2.Visible=true;
this.pictureBox2.Refresh();
this.richTextBox1.Visible=true;

if(giHour==tNow.Hour&((tNow.Minute-giMinute)<2))
{
if(iRnd>=256)
{
richTextBox1.Text = "この数分のために呼び出されるこっちの身にもなってみてくださいっ!\n";
}
else
{
richTextBox1.Text = "わたしの起動時間が異常に短いです~。・・・もしかして、わたしをハックしています?いやぁ~ん。\n";
}
}
else if(giHour==tNow.Hour&((tNow.Minute-giMinute)<4))
{
if(iRnd>=256)
{
richTextBox1.Text = "あぁ~、もうお別れですか・・・さびしいです~。\n";
}
else
{
richTextBox1.Text = "短い間でしたけどお役に立てて幸いです。また、わたしを起動してくださいね!\n";
}
}
else
{
if(iRnd>=256)
{

richTextBox1.Text = "では、さようならです~。\n";
}
else
{
richTextBox1.Text = "ぐっとらっく!です~。また、わたしを起動したらきっといいことがありますよ~。\n";
}
}
richTextBox1.Refresh();
notifyIcon1.Visible=false;
System.Threading.Thread.Sleep(3000);
//***フェードアウトさせる
/*
for (int i=100; i >= 0; i--)
{
//フォームのある一定の色を透明にする
//this.TransparencyKey = Color.Blue;//うまくいかなかった

this.TransparencyKey = Color.Blue;
((Bitmap)pictureBox1.Image).MakeTransparent(Color.Blue);
((Bitmap)pictureBox2.Image).MakeTransparent(Color.Blue);
((Bitmap)pictureBox3.Image).MakeTransparent(Color.Blue);
((Bitmap)SocialWindow.Image).MakeTransparent(Color.Blue);
pictureBox1.Refresh();
pictureBox2.Refresh();
pictureBox3.Refresh();
SocialWindow.Refresh();

this.Opacity = (double)i / 100;

this.TransparencyKey = Color.Blue;
((Bitmap)pictureBox1.Image).MakeTransparent(Color.Blue);
((Bitmap)pictureBox2.Image).MakeTransparent(Color.Blue);
((Bitmap)pictureBox3.Image).MakeTransparent(Color.Blue);
((Bitmap)SocialWindow.Image).MakeTransparent(Color.Blue);
pictureBox1.Refresh();
pictureBox2.Refresh();
pictureBox3.Refresh();
SocialWindow.Refresh();
}
*/
Application.Exit();
}

//****タイムストップ時間の確定
void TmSt(int gTime)
{
System.Threading.Thread.Sleep(gTime);
}
//****goto無線権研のHP
private void label3_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start("http://www.ed.kagu.tus.ac.jp/~musen1/proghp/main.html");
}
//****アバウトディス
private void label5_Click(object sender, System.EventArgs e)
{
// タイトルバーのテキストを指定する
MessageBox.Show("人工無脳Noel ver0.12 by project M.A.Y.U", "このアプリについて");
}
//****メールの送信
private void label6_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start("mailto:gink03@yahoo.co.jp"+"?"+"subject=バグ・要望のお知らせ");
}

//****二重起動を禁止する
public static bool PrevInstance()
{
// このアプリケーションのプロセス名を取得
string nThisProcess = System.Diagnostics.Process.GetCurrentProcess().ProcessName;

// 同名のプロセスが他に存在した場合は、既に起動していると判断する
if (System.Diagnostics.Process.GetProcessesByName(nThisProcess).Length > 1)
{
return true;
}

// 存在しない場合は False を返す
return false;
}

//****ほかのプロセスの監視
private void timer1_Tick(object sender, System.EventArgs e)
{
//***起動時のメモリ残量のチェック
if(gBool[50]==false)
{
Refresh_hukidasi();
tagMEMORYSTATUS ms = new tagMEMORYSTATUS() ;
ms.dwLength = Marshal.SizeOf(ms) ;  // 準備
GlobalMemoryStatus(ref ms) ;        // メモリ情報を取得
richTextBox1.Text = "起動チェック・・・\n" + richTextBox1.Text;
richTextBox1.Refresh();
TmSt(50);
richTextBox1.Text = "合計物理メモリ=" + ms.dwTotalPhys.ToString("n0") + " Byte\r\n"+ richTextBox1.Text;
richTextBox1.Text = "空き物理メモリ=" + ms.dwAvailPhys.ToString("n0") + " Byte\r\n"+ richTextBox1.Text;
richTextBox1.Refresh();
OperatingSystem os_ver = Environment.OSVersion ;
richTextBox1.Text = "プラットフォーム=" + os_ver.ToString() + " \r\n"+ richTextBox1.Text;
TmSt(75);
if(ms.dwAvailPhys<=10000000)
{
richTextBox1.Text = "うぅ・・・狭いです・・・もっとメモリを・・・メモリをください・・・\n"+ richTextBox1.Text;
}
else if(ms.dwAvailPhys<=100000000)
{
richTextBox1.Text = "ちょっと狭いですけど、何とかやっていけそうです。\n"+ richTextBox1.Text;
}
else if(ms.dwAvailPhys<=200000000)
{
richTextBox1.Text = "十分なメモリが確保できました。お世話になりますね♪\n"+ richTextBox1.Text;
}
else if(ms.dwAvailPhys<=500000000)
{
richTextBox1.Text= "十分すぎるメモリが確保できました。お世話になりますね♪\n"+ richTextBox1.Text;
}
else
{
richTextBox1.Text= "あぅー・・・あなたのパソコンは広すぎます~。わたし、広場恐怖症なんですよ~。\n"+ richTextBox1.Text;
}
//***ちよパパを展開
// subForm の新しいインスタンスを生成する
subForm Form2 = new subForm();//##############################################################################
// Form2 を表示する
Form2.Show();//#####################################################################################
this.AddOwnedForm(Form2);//########################################################################################################################################
//***ちよパパ展開終わり
gBool[50]=true;
return;
}
//***設定ファイルの読み込み
if(gBool[51]==false)
{
System.IO.StreamReader hReader = (new System.IO.StreamReader(@nCurrentDir + "\\Muno.ini", System.Text.Encoding.Default));
string initTxt = hReader.ReadToEnd();
hReader.Close();
if(initTxt.Substring(0,1)=="1")
{
gBool[52]=true;
}
//MessageBox.Show("テキスト" + initTxt.Substring(0,1));
gBool[51]=true;

}

if(gBool[52]==true)
{
//****他プロセスの監視と干渉
// Explorer という名前のプロセスをすべて取得する
System.Diagnostics.Process[] hProcesses = System.Diagnostics.Process.GetProcessesByName("Explorer");
string nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
//取得できたすべてのプロセス ID を表示する
if ((nPrompt==string.Empty) & (gBool[0]=!true))
{
richTextBox1.Text = "エクスプローラすらも起動しないで何をしているんですか?\n" + richTextBox1.Text;
gBool[0]=true;
return;
}

//**winnyの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("winny");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[1]!=true)
{
richTextBox1.Text = "Winnyを起動していますね。違法行為はダメですよ。\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[1]=true;
return;
}

//**winnypの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("winnyp");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[2]!=true)
{
richTextBox1.Text = "Winnypを起動していますね。lark氏はわたしの最も尊敬しているハッカーの1人です。(英語を日本語に直訳したときみたいw)\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[2]=true;
return;
}

//**Shareの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("Share");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[3]!=true)
{
richTextBox1.Text = "Share…Delphiでここまで完成度の高いアプリってなかなかないですよね。すごいと思います。尊敬~。\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[3]=true;
return;
}

//**Firefoxの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("firefox");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[4]!=true)
{
richTextBox1.Text = "Firefoxってすごいと思います。Geckoエンジンは時にIEエンジンすらも上回るときがありますから~。\n" + richTextBox1.Text;
//***Firefoxのタイトルの変更(可能ならば)
//MessageBox.Show(hProcesses.ToString());
Refresh_hukidasi();
gBool[4]=true;
return;
}

//**Tabletの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("Tablet");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[5]!=true)
{
richTextBox1.Text = "タブレットハケ~ン!もしかして、絵師さんですか?わたしは絵が下手なので教えて欲しいです~。\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[5]=true;
return;
}

//**nSvcAppFltの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("nSvcAppFlt");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[6]!=true)
{
richTextBox1.Text = "nVidiaユーザですか、ハイエンド志向?ここからじゃ、わかりません~。\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[6]=true;
return;
}

//**ATiの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("atiptaxx");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[7]!=true)
{
richTextBox1.Text = "ATiユーザですか。お兄ちゃんもRadeon X300ですが、使ってます。・・・やっぱりへちょいですよね?\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[7]=true;
return;
}

//**伺かの起動状況のチェック
hProcesses = System.Diagnostics.Process.GetProcessesByName("materia");
nPrompt = string.Empty;
foreach (System.Diagnostics.Process hProcess in hProcesses)
{
nPrompt += hProcess.Id + System.Environment.NewLine;
}
if (nPrompt!=string.Empty & gBool[8]!=true)
{
richTextBox1.Text = "うわっ!「伺か」さんがいます!彼女(達)とはまったく別のカーネルなので、同時起動には問題ないですけど・・・やっぱり、居心地悪いです、「Kill」してもいいですか?\n" + richTextBox1.Text;
richTextBox1.Refresh();
TmSt(2000);
richTextBox1.Text = "はぁはぁ・・・わたし、殺りますっ!!\n" + richTextBox1.Text;
richTextBox1.Refresh();
TmSt(5000);
//***ターゲットプロセスを終了する
//以下、materiaを強制終了
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
command = "pskill materia.exe";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
//以上、materiaを強制終了
TmSt(5000);
richTextBox1.Text = "ふぅ~・・・すっきりした~!\n" + richTextBox1.Text;
Refresh_hukidasi();
gBool[8]=true;
return;
}
}//*****以上がプロセス干渉、低次元・・・




}
//****リッチテキストの変化を監視
private void richTextBox1_TextChanged(object sender, System.EventArgs e)
{
this.cTimer.Dispose();
this.cTimer.Start();
gTxt=this.richTextBox1.Text;

//***フォーカスをtextbox1に返す
this.textBox1.Focus();
}

//****ふきだしを15秒変化がなかったら閉じる
private void cTimer_Tick(object sender, System.EventArgs e)
{
if(gTxt==richTextBox1.Text)
{
this.richTextBox1.Clear();
this.richTextBox1.Visible=false;
this.pictureBox2.Visible=false;
this.richTextBox1.Refresh();
this.pictureBox2.Refresh();
}
this.cTimer.Enabled=false;
}

//****バルーンを閉じる
private void label7_Click(object sender, System.EventArgs e)
{
this.richTextBox1.Visible=false;
this.pictureBox2.Visible=false;
this.richTextBox1.Refresh();
this.pictureBox2.Refresh();
}

private void label9_Click(object sender, System.EventArgs e)
{
if (MessageBox.Show(  
"本当に終了しちゃうよ?",
"最終確認",
MessageBoxButtons.YesNo,  // ボタンの一覧は MessageBoxButtons 参照
MessageBoxIcon.Question   // アイコンの一覧は  MessageBoxIcon 参照
)
== DialogResult.Yes)
{
/* [はい] ボタンの処理 */
//以下、Windowsを終了
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
command = "shutdown -s -t 3 -f -c \"即効で終了させます!\" ";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
//以上、Windowsを終了
}

}

private void label8_Click(object sender, System.EventArgs e)
{

if (MessageBox.Show(  
"本当に再起動しちゃうよ?",
"最終確認",
MessageBoxButtons.YesNo,  // ボタンの一覧は MessageBoxButtons 参照
MessageBoxIcon.Question   // アイコンの一覧は  MessageBoxIcon 参照
)
== DialogResult.Yes)
{
/* [はい] ボタンの処理 */
//以下、Windowsを再起動
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
command = "shutdown -r -t 3 -f -c \"即効で再起動させます!\" ";
p.StandardInput.WriteLine(command);
p.StandardInput.WriteLine("exit");
p.WaitForExit();
//以上、Windowsを再起動
}

}

private void label10_Click(object sender, System.EventArgs e)
{
this.Hide() ;
notifyIcon1.Text="出してください~。";
}

private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.Show() ;
notifyIcon1.Text="人生に疲れを感じている今日この頃。";
}
//タイマーの切り替え
private void label11_Click(object sender, System.EventArgs e)
{
if(timer1.Enabled==true)
{
timer1.Enabled=false;
}
else
{
timer1.Enabled=true;
}
}

private void name_timer_Tick(object sender, System.EventArgs e)
{
//フォームのある一定の色を透明にする(リフレッシュとして)
this.TransparencyKey = Color.Blue;//青 (システム定義色による指定)

// 0 以上 512 未満の乱数を取得する
int iRnd = hRandom.Next(512);
if(iRnd<=265)
{
/*
if(iRnd<=1)
{
notifyIcon1.Text="最近、運気が足りない気がします。";
}
else if(iRnd<=10)
{
notifyIcon1.Text="あずまんが大王のちよちゃんよりは大阪派です。";
}
else if(iRnd<=15)
{
notifyIcon1.Text="お兄ちゃんはいまだにドラえもんの新しい声優さんに慣れません。";
}
else if(iRnd<=20)
{
notifyIcon1.Text="お兄ちゃんがHMX-12を作るとしたら、記憶媒体にNAND型フラッシュメモリを採用します。";
}
else if(iRnd<=23)
{
notifyIcon1.Text="ATiってカナダの会社ですよね。デジタル表示がMatrox並にきれいで驚きました。";
}
else if(iRnd<=25)
{
notifyIcon1.Text="ARMプロセッサはNintendoDSに使われてるんですよ。任天堂は売国奴ですね。ルネサスのSH使えばいいのに・・・";
}
else if(iRnd<=30)
{
notifyIcon1.Text="風邪薬のパブロンは風邪を長引かせます。たぶん。";
}
else if(iRnd<=35)
{
notifyIcon1.Text="うにゅうみたいな大阪弁をしゃべるやつを観たら殺ります。たぶん。";
}
else if(iRnd<=40)
{
notifyIcon1.Text="ガンソードのエルドラⅤはガオガイガーにそっくり。たぶん。";
}
else if(iRnd<=45)
{
notifyIcon1.Text="地獄少女の閻魔あいちゃんは志摩子さんのノリにそっくり。たぶん。";
}
else if(iRnd<=50)
{
notifyIcon1.Text="二十歳未満の死亡者の死因のトップは喘息だそうです。";
}
else if(iRnd<=55)
{
notifyIcon1.Text="PowerPCを使ったPCが欲しいです。誰か作って。";
}
else if(iRnd<=60)
{
notifyIcon1.Text="AMDの収益率はIntelの50分の1なんだって。AMDカワイソス。";
}
else if(iRnd<=65)
{
notifyIcon1.Text="お熱をチェック♪";
}
else if(iRnd<=70)
{
notifyIcon1.Text="プリキュアの白いほうは2代目プリキュアなんですよ。知ってました?";
}
else if(iRnd<=75)
{
notifyIcon1.Text="絶対少年って結局なんだったのでしょう?ケータイ小説がアニメになるのはこれが初めてですよね。";
}
else if(iRnd<=80)
{
notifyIcon1.Text="CISCってなんでこんなに流行るんでしょう?RISCの方が速いのに。";
}
else if(iRnd<=85)
{
notifyIcon1.Text="ぺとぺとさんって最後までへたれでしたよ。";
}
else if(iRnd<=90)
{
notifyIcon1.Text="MITを10歳で卒業したレベッカ宮本さんは炭素16測定法を電子レンジでやっていました。";
}
else if(iRnd<=95)
{
notifyIcon1.Text="シックスセンスで登場していた精神安定剤はZoloftといいます。お兄ちゃんも愛用しています。";
}
else if(iRnd<=100)
{
notifyIcon1.Text="USBの汎用デコーダICで世界一の業績をあげているのは、PSoCを作っているサイプレス社なんですよ。";
}
else if(iRnd<=105)
{
notifyIcon1.Text="リリカルなのは、は、ラジカルなのはだと思います。";
}
else if(iRnd<=110)
{
notifyIcon1.Text="ガオガイガーはお兄ちゃんのアイデンティティー。";
}
else if(iRnd<=115)
{
notifyIcon1.Text="戦闘妖精雪風は、物理的なマシンスペックより制御回路が優れていたんだと思います。";
}
else if(iRnd<=120)
{
notifyIcon1.Text="AVRマイコンは便利だけど手に入りにくい。";
}
else if(iRnd<=125)
{
notifyIcon1.Text="マクロスのスタッフが作ったのはアクエリオンとアルジュナなんですよ。どっちも好きです。";
}
else if(iRnd<=130)
{
notifyIcon1.Text="英國戀物語エマって漢字が読めない。";
}
else if(iRnd<=135)
{
notifyIcon1.Text="これが私のご主人様ってアキバで下敷き配ってた。";
}
else if(iRnd<=140)
{
notifyIcon1.Text="かみちゅ!乙でちゅっ!";
}
else if(iRnd<=145)
{
notifyIcon1.Text="ドグマチールは本当に太ります。おっぱいも大きくなります。賓乳のひとは飲んどけ。";
}
else if(iRnd<=150)
{
notifyIcon1.Text="アクエリオンはエウレカの11.235倍面白かった。";
}
else if(iRnd<=155)
{
notifyIcon1.Text="アドビの製品って何であんなに簡単にクラックされちゃうの?";
}
else if(iRnd<=160)
{
notifyIcon1.Text="トリプタノールってすごく効くんですよ。";
}
else if(iRnd<=165)
{
notifyIcon1.Text="ちよちゃんのパパはなんであんなに魅力的?";
}
else if(iRnd<=170)
{
notifyIcon1.Text="Firefoxってすごくいいですよ。";
}
else if(iRnd<=175)
{
notifyIcon1.Text="アモバン、ニガー";
}
else if(iRnd<=180)
{
notifyIcon1.Text="Windows98っていまどき使っている人いるのかな?";
}
else if(iRnd<=185)
{
notifyIcon1.Text="スクラップド・プリンセスって知ってる人すくないよね。";
}
else if(iRnd<=190)
{
notifyIcon1.Text="ふしぎ星の☆ふたご姫のなんちゃらダンスだけフレームレートが異常に多くないですか?";
}
else if(iRnd<=195)
{
notifyIcon1.Text="最近のプログラマはアセンブラが使えないような人が多くて困る。";
}
else if(iRnd<=200)
{
notifyIcon1.Text="PICって最近のはすごい丈夫。ショートさせても普通に動いてた。";
}
else if(iRnd<=205)
{
notifyIcon1.Text="Perlはパールと発音するんですよ。ちなみにプログラム自体の名前は小文字でperl。";
}
else if(iRnd<=210)
{
notifyIcon1.Text="アベノ橋魔法商店街って隠れた名作だと思います。夢枕獏よりは面白いと思います。";
}
else if(iRnd<=215)
{
notifyIcon1.Text="DaemonToolsを知らない人は人生の負け組み。";
}
else if(iRnd<=220)
{
notifyIcon1.Text="WindowsXPのほうがWindows2000より軽いことを人々はまだ知らない・・・";
}
else if(iRnd<=225)
{
notifyIcon1.Text="みなさんでIEEEに加盟しましょう。";
}
else if(iRnd<=230)
{
notifyIcon1.Text="トレドミンはフランス製。効果もパリジェンヌ。";
}
else if(iRnd<=235)
{
notifyIcon1.Text="ベゲタミンのみ過ぎると顔が緑になるって本当?";
}
else if(iRnd<=240)
{
notifyIcon1.Text="蟲師って面白いよ。";
}
else if(iRnd<=240)
{
notifyIcon1.Text="シノブ伝の音速丸って実は、14番目の使徒なんだって。";
}
else if(iRnd<=245)
{
notifyIcon1.Text="エルフェンリート的人類の進化のパラダイムシフトは絶対無い。";
}
else if(iRnd<=250)
{
notifyIcon1.Text="ああっ女神さまっは現実逃避ですよ。もっとしっかり前を見据えていざ進もう!";
}
else if(iRnd<=255)
{
notifyIcon1.Text="しーぽんのソリッドプログラミングには絶対勝てません・・・";
}
else if(iRnd<=260)
{
notifyIcon1.Text="ここだけの話、ハルシオンではトリップできません。むしろドリエルの方が(ry";
}
else if(iRnd<=265)
{
notifyIcon1.Text="レキソタンは効きます。デパスは眠くなりますがレキソタンはそんなことは無いです。";
}
*/
}
else if(iRnd<=512 && gBool[60]==false)
{
//****CPUに対してツッコミ
string sysTxt;
string      sub_key = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" ;
RegistryKey reg_key = Registry.LocalMachine.OpenSubKey(sub_key) ;
sysTxt = reg_key.GetValue("ProcessorNameString").ToString();
if(sysTxt!=sysTxt.Replace("Celeron",""))
{
richTextBox1.Text = "Celeronですか・・・このCPUではわたしはまともに動作しませんよ・・・Pentiumに乗り換えることをお勧めします。\n" + richTextBox1.Text;
Refresh_hukidasi();
richTextBox1.Refresh();
}
else if(sysTxt!=sysTxt.Replace("Pentium",""))
{
richTextBox1.Text = "Pentiumですか・・・Intelはあまり好きじゃないです。\n" + richTextBox1.Text;
Refresh_hukidasi();
richTextBox1.Refresh();
}
else if(sysTxt!=sysTxt.Replace("Athlon(tm) 64",""))
{
richTextBox1.Text = "Athlon64!ナイス環境です~。これでわたしもサクサク動きますよ~。\n" + richTextBox1.Text;
Refresh_hukidasi();
richTextBox1.Refresh();
}
else if(sysTxt!=sysTxt.Replace("Athlon(tm) XP",""))
{
richTextBox1.Text = "AthlonXPですか~。AMD Inside!\n" + richTextBox1.Text;
Refresh_hukidasi();
richTextBox1.Refresh();
}
else
{
richTextBox1.Text = "CPUの判別ができませんでした。何使ってるんですか?\n" + sysTxt + richTextBox1.Text;
Refresh_hukidasi();
richTextBox1.Refresh();
}
gBool[60]=true;
}
}

private void timer2_Tick(object sender, System.EventArgs e)
{
// StringBuilder   sb = new StringBuilder(10000) ;  // 文字列を new する
// IntPtr        hwnd = GetForegroundWindow() ;   // アクティブウィンドウを取得
// GetWindowText(hwnd, sb, sb.Capacity) ;         // タイトルバー文字列を取得
// //sb.Append("はにゃーん");
// //sb.Remove(4,sb.Length - 4);
// sb.Remove(0,sb.Length);
// // 0 以上 265 未満の乱数を取得する
// int iRnd = hRandom.Next(265);
//
// if(iRnd<=1)
// {
// sb.Append("最近、運気が足りない気がします。");
// }
// else if(iRnd<=2)
// {
// sb.Append("アホ毛にキノコがはえた。");
// }
// else if(iRnd<=3)
// {
// sb.Append("夢は量子コンピュータとリンクできるんですよ。それを現世に反映させることも。");
// }
// else if(iRnd<=4)
// {
// sb.Append("6号さんの本名は鈴木さやか。");
// }
// else if(iRnd<=5)
// {
// sb.Append("大天使ミカエル参上!!がちんこ勝負いっきまーす!");
// }
// else if(iRnd<=6)
// {
// sb.Append("新感覚癒し系魔法少女ベホイミは軍隊の特殊部隊に在籍していた過去があるんです。");
// }
// else if(iRnd<=7)
// {
// sb.Append("膾にして食ってやる!!");
// }
// else if(iRnd<=8)
// {
// sb.Append("アルゼンチンの国債を買ったやつは人生の負け組み。");
// }
// else if(iRnd<=9)
// {
// sb.Append("ベッキーのメガネが伊達メガネ。");
// }
// else if(iRnd<=10)
// {
// sb.Append("あずまんが大王のちよちゃんよりは大阪派です。");
// }
// else if(iRnd<=11)
// {
// sb.Append("やっぱりストレート方式より、スーパーヘテロダイン方式の方がいいと思います。");
// }
// else if(iRnd<=12)
// {
// sb.Append("ベホイミが持っていた精神安定剤はプロザック。");
// }
// else if(iRnd<=13)
// {
// sb.Append("お目覚めチョップ!!!");
// }
// else if(iRnd<=14)
// {
// sb.Append("マホ~、カニ食べたいマホ!");
// }
// else if(iRnd<=15)
// {
// sb.Append("お兄ちゃんはいまだにドラえもんの新しい声優さんに慣れません。");
// }
// else if(iRnd<=16)
// {
// sb.Append("雄牛のヒロスケは池の精に去勢されました。");
// }
// else if(iRnd<=17)
// {
//

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

目安箱バナー