Generated Image

如何启动系统的控制面板等......

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; 
namespace WindowsApplication1
{
    public partial class Form1 : System.Windows.Forms.Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        [DllImport("kernel32.dll")]
        public static extern bool WinExec(string CmdLine, int uCmdShow);
        public const int SW_RESTORE = 9;
 
        private void button1_Click(object sender, EventArgs e)
        {
            WinExec("rundll32.exe shell32.dll,Control_RunDLL", SW_RESTORE);        
        }
 
 
 
 
        private void button2_Click(object sender, EventArgs e)
        {
            WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0", SW_RESTORE);
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1", SW_RESTORE);    
        }
 
        private void button4_Click(object sender, EventArgs e)
        {
            WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3", SW_RESTORE);
        }
    }
 
}

使用了WIN32API函数

public sealed class DllImportAttribute : System.Attribute
    System.Runtime.InteropServices 的成员
 
摘要:
 指示该属性化方法由非托管动态链接库 (DLL) 作为静态入口点公开。  
posted @ 2007-02-12 21:28  桂圆  阅读(473)  评论(0编辑  收藏  举报