callingvariations.cs
来自「C sharp 调用WindowsAPI的平台调用例子」· CS 代码 · 共 38 行
CS
38 行
using System;
using System.Runtime.InteropServices;
// This class encapsulates the calling variations of the function Beep
public class CallingVariations
{
// Declare version
[DllImport("kernel32.dll", EntryPoint="Beep")]
public static extern int DeclareBeep(int dwFreq, int dwDuration);
// DLLImport version
[DllImport("kernel32.dll", EntryPoint="Beep")]
public static extern int DLLImportBeep(int dwFreq, int dwDuration);
// Specifying Unicode
[DllImport( "Kernel32.dll", EntryPoint="Beep", CharSet=CharSet.Unicode )]
public static extern int UnicodeBeep(int dwFreq, int dwDuration);
// Specifying Ansi
[DllImport( "Kernel32.dll", EntryPoint="Beep", CharSet=CharSet.Ansi )]
public static extern int ANSIBeep(int dwFreq, int dwDuration);
// Specifying Auto
[DllImport( "Kernel32.dll", EntryPoint="Beep", CharSet=CharSet.Auto )]
public static extern int AutoBeep(int dwFreq, int dwDuration);
// Using Exact Spelling
// Default is FALSE
// if FALSE an A is appended under ANSI and a W under Unicode so MessageBox becomes
// MessageBoxW
[DllImport("kernel32.dll", EntryPoint="Beep", ExactSpelling=true, CharSet=CharSet.Ansi)]
public static extern int ExactSpellingBeep(int dwFreq, int dwDuration);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?