C # Block module ABC (III)

Source: Internet
Author: User
How to load the waiting cursor?
The cursor is part of the Drawing namespace. To display a specific cursor, you can view the document to obtain all available types. To display the waiting cursor, try the following code:
ComponentsName. Cursor = System. Drawing. Cursors. WaitCursor;
// Back to arrow
Cursor = Cursors. Arrow
How do I obtain a running process on the machine?
You can use the System. Diagnostics. Process class to start and stop System processes. The GetProcesses function returns all processes running on the machine. It has two definitions: one for the local machine and the other for the remote machine.
If you want to obtain the running processes on the local machine, use GetProcesses (); otherwise, use GetProcesses (string machinename ):
Public static Process [] GetProcesses ();
Public static Process [] GetProcesses (string );
For example:
Process [] procList = new Process [100];
ProcList = Process. GetProcesses ();
For (int I = 0; I <20; I ++)
{
String strProcName = procList. ProcessName;
Int iProcID = procList. Id ;;
}
Do not forget to reference System. Diagnostic and write the following line of code in the using list:
Using System. Diagnostics;
By using the Process class, we can even start, stop, or cancel a Process.
How can I open a browser in an application?
You can use the System. Diagnostics. Process class to Start and stop programs. The Start function of this class can be used to Start an exe file. For example, if you want to open a URL in a browser, you can pass the URL as a parameter to the Start function:
System. Diagnostics. Process. Start ("http://www.c-sharpcorner.com ");
How to open a Wav file?
PlaySound APIs can be used to play a wav file. Use sysimport to introduce a DLL and define this API as global before use. See the following code for calling an API:
[Sysimport (dll = "winmm. dll")]
Public static extern long PlaySound (String lpszName, long hModule, long dwFlags );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.