About C # medium adjustment beep ()

xiaoxiao2021-03-06  38

When writing a program at the C #, beep (), when you want to pop up the prompt window, find that there is no Beep () function. I checked it online and found this. The support of multi-coal bodies is very weak in FCL.

Solution 1: You can call the Win32 API:

[System.Runtime.InteropServices.dllimport ("User32.dll")] public static extern bool messagebeep (uint utype); messagebeep (1);

Workaround 2: Calling Beep in Microsoft.viualBase ():

1. First introduced the namespace: USING Microsoft.VisualBasic;

2. Call: interaction.beep ();

Pay attention to the Microsoft.visualBasic.dll assembly when compiling, otherwise compile cannot pass.

In addition, if it is a Console application, you can use console.writeline ("/ a") to instead of Beep ().

转载请注明原文地址:https://www.9cbs.com/read-63707.html

New Post(0)