View Full Version : ?? cần kill process notepad.exe trong VB.NET 2005 ??
khigiadano
18-01-2009, 22:04
Giả sử mình có ứng dụng notepad.exe đang chạy
Muốn tạo sự kiện cho button là tắt notepad.exe thì phải làm thế nào nhỉ ?? :w00t:
Rồi xác định thư mục hệ thống như thế nào nhỉ ??
%dirsystem% <-- cái này ko đc :lick:
duongdragonxxx
19-01-2009, 00:43
System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcesses();
for (int i = 0; i < process.Length; i++)
{
if (process[i].ProcessName == "notepad.exe")
{
process[i].Kill();
break;
}
}
private string GetSystemSpecialFolderDirectory()
{
//Program files
string sProgramFilesFolder = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ProgramFiles);
//Personal
string sPersonalFolder = System.Environment.GetFolderPath (
System.Environment.SpecialFolder.Personal);
//Desktop
string sDesktopFolder = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.DesktopDirectory) ;
//Application Data
string sApplicationDataFolder = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ApplicationData);
//System:
string sSystemFolder = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.System);
MessageBox.Show("Program files: " + sProgramFilesFolder +
"\r\nPersonal: " + sPersonalFolder +
"\r\nDesktop: " + sDesktopFolder +
"\r\nApplication Data: " + sApplicationDataFolder +
"\r\nSystem: " + sSystemFolder);
}
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.