Hiển thị kết quả từ 1 đến 2 / 2
  1. #1
    Tham gia
    28-02-2008
    Bài viết
    248
    Like
    50
    Thanked 6 Times in 6 Posts

    Câu hỏi, cần giúp đỡ ?? cần kill process notepad.exe trong VB.NET 2005 ??

    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ỉ ??

    Rồi xác định thư mục hệ thống như thế nào nhỉ ??

    %dirsystem% <-- cái này ko đc
    Quote Quote

  2. #2
    Tham gia
    09-10-2003
    Location
    HN
    Bài viết
    853
    Like
    0
    Thanked 6 Times in 6 Posts
    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);
    }

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •