TIPS/Programming

Visual C++ 2008逕ィ 繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ/繝ャ繧ク繧ケ繝医Μ繧「繧ッ繧サ繧ケ 繧オ繝ウ繝励Ν

讎りヲ

縺薙ョ繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ縺ッ縲`icrosoft Visual C++ 2008 縺ァ

  • 繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ縺ョ菴ソ逕ィ
  • 繝ャ繧ク繧ケ繝医Μ縺ク縺ョ繧「繧ッ繧サ繧ケ

繧貞ョ溽樟縺吶k縺溘a縺ョ繧オ繝ウ繝励Ν繝励Ο繧ー繝ゥ繝縺ァ縺吶

蝓コ譛ャ蜍穂ス懊サ讖溯ス

縺薙ョ繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ縺ッ縲∽ク玖ィ倥ョ讖溯ス繧呈戟縺」縺ヲ縺縺セ縺吶

  • 繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ縺ョ菴ソ逕ィ
    • 繧ソ繧ケ繧ッ繝舌シ縺ク縺ョ繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ縺ョ逋サ骭イ
    • 繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ縺ョ蜿ウ繧ッ繝ェ繝繧ッ縺ァ繧ウ繝ウ繝繧ュ繧ケ繝医Γ繝九Η繝シ繧定。ィ遉コ
    • 繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ縺ョ繝繝悶Ν繧ッ繝ェ繝繧ッ縺励※縲√Γ繧、繝ウ繧ヲ繧」繝ウ繝峨え繧定。ィ遉コ
    • 繧ソ繧ケ繧ッ繝医Ξ繧、繧「繧、繧ウ繝ウ縺ョ繧ウ繝ウ繝繧ュ繧ケ繝医Γ繝九Η繝シ繧医j縲√Γ繧、繝ウ繧ヲ繧」繝ウ繝峨え繧定。ィ遉コ
    • 繝。繧、繝ウ繧ヲ繧」繝ウ繝峨え縺ョ譛蟆丞喧繝サテ励懊ち繝ウ縺ァ縲√Γ繧、繝ウ繧ヲ繧」繝ウ繝峨え繧偵ち繧ケ繧ッ繝医Ξ繧、縺ォ蜿守エ
    • 繧ウ繝ウ繝繧ュ繧ケ繝医Γ繝九Η繝シ縺ョ縲檎オゆコ縲阪〒繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ繧堤オゆコ
  • 繝ャ繧ク繧ケ繝医Μ縺ク縺ョ繧「繧ッ繧サ繧ケ
    • 繝繧ュ繧ケ繝医懊ャ繧ッ繧ケ縺ィ縲∽コ後▽縺ョ繝√ぉ繝繧ッ繝懊ャ繧ッ繧ケ縺ョ險ュ螳壼、繧偵Ξ繧ク繧ケ繝医Μ縺ク菫晏ュ
    • 繝ャ繧ク繧ケ繝医Μ繧医j縲√ユ繧ュ繧ケ繝医懊ャ繧ッ繧ケ縺ィ縲∽コ後▽縺ョ繝√ぉ繝繧ッ繝懊ャ繧ッ繧ケ縺ョ險ュ螳壼、繧定ェュ縺ソ蜃コ縺励∝セゥ蜈

謚陦

縺薙ョ繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ縺ッ縲∽ク玖ィ倥ョ謚陦鍋噪隕∫エ繧剃スソ逕ィ縺励※縺縺セ縺吶

  • notifyIcon 繧ウ繝ウ繝医Ο繝シ繝ォ縺ョ菴ソ逕ィ
    • 繝。繧、繝ウ繧ヲ繧」繝ウ繝峨え縺ク縺薙ョ繧ウ繝ウ繝医Ο繝シ繝ォ繧定イシ繧贋サ倥¢繧
    • 繧ソ繧ケ繧ッ繝医Ξ繧、縺ク縺ョ繧「繧、繧ウ繝ウ縺ョ逋サ骭イ縲√さ繝ウ繝繧ュ繧ケ繝医Γ繝九Η繝シ縺ョ陦ィ遉コ
  • RegistryKey 繧ッ繝ゥ繧ケ縺ョ菴ソ逕ィ
    • 繝ャ繧ク繧ケ繝医Μ縺ョ繧「繧ッ繧サ繧ケ縺ョ縺溘a縺ォ菴ソ逕ィ縺吶k縲

螳溯。檎腸蠅(遘√′繝繧」繝舌ャ繧ー縺励※縺縺溽腸蠅縺ァ縺)

  • OS: WindowsXP SP3
  • 髢狗匱迺ー蠅シ Microsoft Visual C++ 2008 Express Edition

繝繧ヲ繝ウ繝ュ繝シ繝

荳玖ィ倥ョ繝輔ぃ繧、繝ォ繧偵ム繧ヲ繝ウ繝ュ繝シ繝峨@縺ヲ縺上□縺輔>縲 Visual C++ 2008 縺ョ繧オ繝ウ繝励Ν繝励Ο繧ク繧ァ繧ッ繝医r荳ク縺斐→ZIP縺励※縺縺セ縺吶ゅム繧ヲ繝ウ繝ュ繝シ繝牙セ後∬ァ」蜃阪@縺ヲ繧ス繝ェ繝・繝シ繧キ繝ァ繝ウ繝輔ぃ繧、繝ォ繧帝幕縺縺ヲ縺上□縺輔>縲

TaskTray_Registry100.zip(18kB)

繧ス繝シ繧ケ繧ウ繝シ繝蛾幕險ュ

荳玖ィ倥↓縲∽ク驛ィ縺ョ驥崎ヲ√↑繧ス繝シ繧ケ繧ウ繝シ繝峨r遉コ縺励∪縺吶

	private: System::Void buttonReferenceFolder_Click(System::Object^  sender, System::EventArgs^  e) {
					//繝輔か繝ォ繝險ュ螳壹ム繧、繧「繝ュ繧ー繧帝幕縺
					 folderBrowserDialog->ShowDialog(this);
					 if(folderBrowserDialog->SelectedPath != ""){
						 textFolderDestination->Text = folderBrowserDialog->SelectedPath;
					 }
			 }
	private: System::Void Form1_FormClosing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) {
			//縲碁哩縺倥k縲阪懊ち繝ウ縺ァ髢峨§繧峨l縺溘→縺阪ッ縲∫オゆコ縺輔○縺ェ縺縲ゅ◎縺ョ縺サ縺九ョ譎ゅッ邨ゆコ縺輔○繧九
			 if(e->CloseReason == System::Windows::Forms::CloseReason::UserClosing) {
				e->Cancel = true;
				 this->Visible = false;
				}
		 }
	private: System::Void 邨ゆコToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			//繝。繝九Η繝シ縺九i邨ゆコ縺碁∈縺ー繧後◆縲
			notifyIcon->Visible = false;
			Application::Exit();
		 }
	private: System::Void 繧ソ繧ケ繧ッ繝医Ξ繧、縺ォ蜿守エ控oolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			//繝。繧、繝ウ繝輔か繝シ繝繧帝撼陦ィ遉コ縺ク
			 this->Visible = false;
		 }
	private: System::Void 繧ヲ繧」繝ウ繝峨え繧定。ィ遉コToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 this->Visible = true;	//繝。繧、繝ウ繝輔か繝シ繝縺ョ陦ィ遉コ
			if(this->WindowState != System::Windows::Forms::FormWindowState::Normal){
				this->WindowState = FormWindowState::Normal;
			}
		 }
	private: System::Void notifyIcon_DoubleClick(System::Object^  sender, System::EventArgs^  e) {
			 this->Visible = true;	//繝。繧、繝ウ繝輔か繝シ繝縺ョ陦ィ遉コ
			if(this->WindowState != System::Windows::Forms::FormWindowState::Normal){
				this->WindowState = FormWindowState::Normal;
			}
		 }
	private: System::Void 繝舌シ繧ク繝ァ繝ウ諠蝣アToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 formVersonInformation^	VersionInformation = gcnew	formVersonInformation();
			//繝舌シ繧ク繝ァ繝ウ諠蝣ア繝繧、繧「繝ュ繧ー繧定。ィ遉コ縺励∪縺吶
			VersionInformation->ShowDialog();
		 }
	private: System::Void Form1_Resize(System::Object^  sender, System::EventArgs^  e) {
			 //譛蟆丞喧縺輔l縺溘i縲√ち繧ケ繧ッ縺ィ萓九↓蜿守エ 竊偵繝輔か繝シ繝繧帝撼陦ィ遉コ
			 if(this->WindowState == System::Windows::Forms::FormWindowState::Minimized){
				 this->Visible = false;	//繝輔か繝シ繝縺ョ陦ィ遉コ
				 this->WindowState = FormWindowState::Normal;	//谺。陦ィ遉コ縺吶k縺ィ縺阪ョ縺溘a縺ォ縲騾壼クク繧オ繧、繧コ縺ォ謌サ縺励※縺翫¥縲
			}
		 }
	private: System::Void 繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ繧堤オゆコToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 notifyIcon->Visible = false;	//繧「繝励Μ繧堤オゆコ縺励※繧ゅ√い繧、繧ウ繝ウ縺梧ョ九k縺薙→縺後≠繧九ョ縺ァ縲∵守、コ逧縺ォ豸医☆縲
			 Application::Exit();			//繧「繝励Μ縺ョ邨ゆコ縲
		 }
	private: System::Void 繝舌シ繧ク繝ァ繝ウ諠蝣ア繧定。ィ遉コToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			formVersonInformation^	VersionInformation = gcnew	formVersonInformation();
			VersionInformation->ShowDialog();	//繝。繝九Η繝シ縺九i繝舌シ繧ク繝ァ繝ウ諠蝣ア繧ヲ繧」繝ウ繝峨え縺ョ陦ィ遉コ
		 }
	private: System::Void 繝。繝繧サ繝シ繧ク繝懊ャ繧ッ繧ケ繧定。ィ遉コToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
			//繧ヲ繧」繝ウ繝峨え繧定。ィ遉コ縺励↑縺上※繧ゅ>縺縲
			 MessageBox::Show("繝。繝繧サ繝シ繧ク繝懊ャ繧ッ繧ケ蜊倅ス薙ョ陦ィ遉コ繧ゅ〒縺阪k縲", "縺溘→縺医ー");
		 }
	private: System::Void buttonReadFromRegistory_Click(System::Object^  sender, System::EventArgs^  e) {
			String^	stringFolderDestination;
			int	boolSetting1;
			int	boolSetting2;
			//RegistryKey縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ繧剃ス懈舌√→蜷梧凾縺ォ繧オ繝悶く繝シ繧帝幕縺上りェュ縺ソ霎シ縺ソ蜃コ譚・繧九Δ繝シ繝峨〒縲
			RegistryKey^	ReadRegistryKey = Registry::CurrentUser->CreateSubKey("Software\\TaskTary_Registry");
			//繧ウ繝ウ繝医Ο繝シ繝ォ縺ォ縺ッ逶エ謗・險ュ螳壹○縺壹↓縲∝、画焚繧堤オ檎罰縺輔○繧九
			stringFolderDestination	= (String^)ReadRegistryKey->GetValue("stringFolderDestination","");
			boolSetting1			= (int)ReadRegistryKey->GetValue("boolSetting1",safe_cast<System::Object^>(0));
			boolSetting2			= (int)ReadRegistryKey->GetValue("boolSetting2",safe_cast<System::Object^>(0));
			//隱ュ縺ソ霎シ繧薙□蛟、繧偵さ繝ウ繝医Ο繝シ繝ォ縺ォ險ュ螳壹
			textFolderDestination->Text	= stringFolderDestination;
			checkSetting1->Checked		= (bool)boolSetting1;
			checkSetting2->Checked		= (bool)boolSetting2;	
		 }
	private: System::Void buttonWriteToRegistory_Click(System::Object^  sender, System::EventArgs^  e) {
			 //RegistryKey縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ繧剃ス懈舌√→蜷梧凾縺ォ繧オ繝悶く繝シ繧帝幕縺上りェュ縺ソ譖ク縺阪′蜃コ譚・繧九Δ繝シ繝峨〒縲
			 //繧オ繝悶く繝シ縺悟ュ伜惠縺励↑縺蝣エ蜷医ッ縲∽ス懈舌&繧後k縲
			RegistryKey^	WriteRegistryKey = Registry::CurrentUser->CreateSubKey("Software\\TaskTary_Registry",RegistryKeyPermissionCheck::ReadWriteSubTree);
			//繧ュ繝シ蜷阪→蛟、縺ィ繝繝シ繧ソ蝙九r謖螳壹@縺ヲ縲√Ξ繧ク繧ケ繝医Μ縺ォ譖ク縺崎セシ縺ソ縲
			//繧ュ繝シ蜷阪′蟄伜惠縺励↑縺蝣エ蜷医ッ縲∵眠縺溘↓菴懈舌&繧後∵里蟄倥ョ繧ュ繝シ縺後≠繧後ー縲∽ク頑嶌縺阪&繧後k縲
			WriteRegistryKey->SetValue("stringFolderDestination",	textFolderDestination->Text->ToString()	,RegistryValueKind::String);
			WriteRegistryKey->SetValue("boolSetting1",checkSetting1->Checked,RegistryValueKind::DWord);
			WriteRegistryKey->SetValue("boolSetting2",checkSetting2->Checked,RegistryValueKind::DWord);
		 }

繝医ャ繝   蟾ョ蛻 繝舌ャ繧ッ繧「繝繝 繝ェ繝ュ繝シ繝   荳隕ァ 蜊倩ェ樊、懃エ「 譛邨よ峩譁ー   繝倥Ν繝   譛邨よ峩譁ー縺ョRSS
Last-modified: 2009-05-23 (蝨) 19:55:53 (3070d)