Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 2 của 2
  1. #1
    Ngày tham gia
    Sep 2015
    Bài viết
    0

    Hỏi cách gọi Windows Process để mở ứng dụng Windows Media Player.

    Tình hình là mình muốn mở Windows Media Player bằng cách click chuột vào 1 button của windows form nhưng làm chưa dk mình làm thế này. ai biết xin chỉ giáo nha.
    Mã:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    
    namespace aa
    {
        public partial class Form1 : Form
        {
            [DllImport("Kernel32.dll")]
            [DllImport("wmp.dll")]
            public static extern uint WinExec(string path, uint uCmdShow);
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                WinExec("wmplayer.exe", 1);
            }
        }
    }
    Sao thằng bạn nó mở Remote Desktop Conection dk nhỉ,code của nó.
    Mã:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    
    namespace aa
    {
        public partial class Form1 : Form
        {
            [DllImport("Kernel32.dll")]
            public static extern uint WinExec(string path, uint uCmdShow);
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                WinExec("mstsc.exe", 1);
            }
        }
    }

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    Không cần phải import dll phức tạp thế đâu bạn, thử http://www.dotnetperls.com/process-start xem.

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • 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
  •