9. 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 10. How do I obtain the running processes 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 [I]. ProcessName; Int iProcID = procList [I]. 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. 11. How to 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 "); 12. 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 ); ................ PlaySound (szWavFileName, 0, 0 ); |