⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.cs

📁 C sharp 调用WindowsAPI的平台调用例子
💻 CS
📖 第 1 页 / 共 5 页
字号:
//Copyright (C) 2002 Microsoft Corporation
//All rights reserved.
//THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
//EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF 
//MERCHANTIBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//Requires the Trial or Release version of Visual Studio .NET Professional (or greater).

using System;
using System.Windows.Forms;
using System.Text;
using System.Runtime.InteropServices;

public class frmMain : System.Windows.Forms.Form
{
    const int STRING_BUFFER_LENGTH = 255;

#region " Windows Form Designer generated code "

	/// <summary>
	/// The main entry point for the application.
	/// </summary>
	[STAThread]
	static void Main() 
	{
		Application.Run(new frmMain());
	}

    public frmMain() 
	{
        //This call is required by the Windows Form Designer.
        InitializeComponent();
        //Add any initialization after the InitializeComponent() call
        // So that we only need to set the title of the application once,
        // we use the AssemblyInfo class (defined in the AssemblyInfo.cs file)
        // to read the AssemblyTitle attribute.
        AssemblyInfo ainfo = new AssemblyInfo();
        this.Text = ainfo.Title;
        this.mnuAbout.Text = string.Format("&About {0} ...", ainfo.Title);
    }

    //Form overrides dispose to clean up the component list.
    protected override void Dispose(bool disposing) {
        if (disposing) {
            if (components != null) {
                components.Dispose();
            }
        }
        base.Dispose(disposing);
    }
    //Required by the Windows Form Designer
    private System.ComponentModel.IContainer components = null;
    //NOTE: The following procedure is required by the Windows Form Designer
    //It can be modified using the Windows Form Designer.  
    //Do not modify it using the code editor.

    private System.Windows.Forms.MainMenu mnuMain;

    private System.Windows.Forms.MenuItem mnuFile;

    private System.Windows.Forms.MenuItem mnuExit;

    private System.Windows.Forms.MenuItem mnuHelp;

    private System.Windows.Forms.MenuItem mnuAbout;

    private System.Windows.Forms.ListView lvwProcessList;

    private System.Windows.Forms.ColumnHeader WindowsTitle;

    private System.Windows.Forms.ColumnHeader ClassName;

    private System.Windows.Forms.ColumnHeader WindowsHandle;

    private System.Windows.Forms.Label Label2;

    private System.Windows.Forms.TabControl MainTabControl;

    private System.Windows.Forms.TabPage tpActiveProcesses;

    private System.Windows.Forms.TabPage tpActiveWindows;

    private System.Windows.Forms.Label Label1;

    private System.Windows.Forms.Button btnRefreshActiveWindows;

    private System.Windows.Forms.ListBox lbActiveWindows;

    private System.Windows.Forms.TabPage tpShowWindow;

    private System.Windows.Forms.Label Label3;

    private System.Windows.Forms.Label Label4;

    private System.Windows.Forms.Label Label5;

    private System.Windows.Forms.Label Label6;

    private System.Windows.Forms.Button btnShow;

    private System.Windows.Forms.TextBox txtWindowCaption;

    private System.Windows.Forms.TextBox txtClassName;

    private System.Windows.Forms.Label lblFunctionCalled;

    private System.Windows.Forms.Button btnRefreshActiveProcesses;

    private System.Windows.Forms.TabPage tpAPICalls;

    private System.Windows.Forms.Label Label8;

    private System.Windows.Forms.Button btnGetFreeSpace;

    private System.Windows.Forms.TextBox txtDriveLetter;

    private System.Windows.Forms.TextBox txtFunctionOutput;

    private System.Windows.Forms.Button btnGetDiskFreeSpaceEx;

    private System.Windows.Forms.Button btnGetDriveType;

    private System.Windows.Forms.GroupBox DriveGroupBox;

    private System.Windows.Forms.Button btnCreateDirectory;

    private System.Windows.Forms.TextBox txtDirectory;

    private System.Windows.Forms.GroupBox DirectoryGroupBox;

    private System.Windows.Forms.GroupBox MiscGroupBox;

    private System.Windows.Forms.Button btnGetOSVersion;

    private System.Windows.Forms.Label Label9;

    private System.Windows.Forms.Button btnHibernate;

    private System.Windows.Forms.Button btnBeep;

    private System.Windows.Forms.RadioButton rbAuto;

    private System.Windows.Forms.RadioButton rbANSI;

    private System.Windows.Forms.RadioButton rbUnicode;

    private System.Windows.Forms.RadioButton rbDLLImport;

    private System.Windows.Forms.RadioButton rbDeclare;

    private System.Windows.Forms.GroupBox MouseGroupBox;

    private System.Windows.Forms.Button btnResetMouseButton;

    private System.Windows.Forms.Button btnSwapMouseButton;

    private System.Windows.Forms.GroupBox CallingVariationGroupBox;

    private void InitializeComponent() {

        System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));

        this.mnuMain = new System.Windows.Forms.MainMenu();

        this.mnuFile = new System.Windows.Forms.MenuItem();

        this.mnuExit = new System.Windows.Forms.MenuItem();

        this.mnuHelp = new System.Windows.Forms.MenuItem();

        this.mnuAbout = new System.Windows.Forms.MenuItem();

        this.MainTabControl = new System.Windows.Forms.TabControl();

        this.tpActiveProcesses = new System.Windows.Forms.TabPage();

        this.Label2 = new System.Windows.Forms.Label();

        this.btnRefreshActiveProcesses = new System.Windows.Forms.Button();

        this.lvwProcessList = new System.Windows.Forms.ListView();

        this.WindowsTitle = new System.Windows.Forms.ColumnHeader();

        this.ClassName = new System.Windows.Forms.ColumnHeader();

        this.WindowsHandle = new System.Windows.Forms.ColumnHeader();

        this.tpActiveWindows = new System.Windows.Forms.TabPage();

        this.btnRefreshActiveWindows = new System.Windows.Forms.Button();

        this.Label1 = new System.Windows.Forms.Label();

        this.lbActiveWindows = new System.Windows.Forms.ListBox();

        this.tpShowWindow = new System.Windows.Forms.TabPage();

        this.lblFunctionCalled = new System.Windows.Forms.Label();

        this.btnShow = new System.Windows.Forms.Button();

        this.Label6 = new System.Windows.Forms.Label();

        this.txtClassName = new System.Windows.Forms.TextBox();

        this.txtWindowCaption = new System.Windows.Forms.TextBox();

        this.Label5 = new System.Windows.Forms.Label();

        this.Label4 = new System.Windows.Forms.Label();

        this.Label3 = new System.Windows.Forms.Label();

        this.tpAPICalls = new System.Windows.Forms.TabPage();

        this.CallingVariationGroupBox = new System.Windows.Forms.GroupBox();

        this.btnBeep = new System.Windows.Forms.Button();

        this.rbAuto = new System.Windows.Forms.RadioButton();

        this.rbANSI = new System.Windows.Forms.RadioButton();

        this.rbUnicode = new System.Windows.Forms.RadioButton();

        this.rbDLLImport = new System.Windows.Forms.RadioButton();

        this.rbDeclare = new System.Windows.Forms.RadioButton();

        this.Label9 = new System.Windows.Forms.Label();

        this.DirectoryGroupBox = new System.Windows.Forms.GroupBox();

        this.txtDirectory = new System.Windows.Forms.TextBox();

        this.btnCreateDirectory = new System.Windows.Forms.Button();

        this.MouseGroupBox = new System.Windows.Forms.GroupBox();

        this.btnResetMouseButton = new System.Windows.Forms.Button();

        this.btnSwapMouseButton = new System.Windows.Forms.Button();

        this.DriveGroupBox = new System.Windows.Forms.GroupBox();

        this.Label8 = new System.Windows.Forms.Label();

        this.txtDriveLetter = new System.Windows.Forms.TextBox();

        this.btnGetDriveType = new System.Windows.Forms.Button();

        this.btnGetDiskFreeSpaceEx = new System.Windows.Forms.Button();

        this.btnGetFreeSpace = new System.Windows.Forms.Button();

        this.txtFunctionOutput = new System.Windows.Forms.TextBox();

        this.MiscGroupBox = new System.Windows.Forms.GroupBox();

        this.btnHibernate = new System.Windows.Forms.Button();

        this.btnGetOSVersion = new System.Windows.Forms.Button();

        this.MainTabControl.SuspendLayout();

        this.tpActiveProcesses.SuspendLayout();

        this.tpActiveWindows.SuspendLayout();

        this.tpShowWindow.SuspendLayout();

        this.tpAPICalls.SuspendLayout();

        this.CallingVariationGroupBox.SuspendLayout();

        this.DirectoryGroupBox.SuspendLayout();

        this.MouseGroupBox.SuspendLayout();

        this.DriveGroupBox.SuspendLayout();

        this.MiscGroupBox.SuspendLayout();

        this.SuspendLayout();

        //

        //mnuMain

        //

        this.mnuMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.mnuFile, this.mnuHelp});

        this.mnuMain.RightToLeft = (System.Windows.Forms.RightToLeft) resources.GetObject("mnuMain.RightToLeft");

        //

        //mnuFile

        //

        this.mnuFile.Enabled = (bool) resources.GetObject("mnuFile.Enabled");

        this.mnuFile.Index = 0;

        this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.mnuExit});

        this.mnuFile.Shortcut = (System.Windows.Forms.Shortcut) resources.GetObject("mnuFile.Shortcut");

        this.mnuFile.ShowShortcut = (bool) resources.GetObject("mnuFile.ShowShortcut");

        this.mnuFile.Text = resources.GetString("mnuFile.Text");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -