Win32 API functions are something of Microsoft. They can be called directly in C #, which is helpful in WinForm. Sometimes we can directly call the Win32 API to achieve the desired effect efficiently.
Code Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using System. Runtime. InteropServices;
Namespace WindowsAPI
{
Class CSharp_Win32Api
{
# Region User32.dll Function
/// <Summary>
/// This function retrieves the handle of the client area of a specified window or the display context of the entire screen. This handle can be used in the GDI function to draw in the context of the device. HWnd: handle of the window retrieved in the device context
/// </Summary>
[DllImport ("user32.dll", CharSet = CharSet. Auto)]
Public static extern IntPtr GetDC (IntPtr hWnd );
/// <Summary>
/// Function to release the device context (DC) for use by other applications.
/// </Summary>
Public static extern int ReleaseDC (IntPtr hWnd, IntPtr hDC );
/// <Summary>
/// This function returns the handle of the desktop window. The desktop window overwrites the entire screen.
/// </Summary>
Static public extern IntPtr getasktopwindow ();
/// <Summary>
/// This function sets the display status of the specified window.
/// </Summary>
Static public extern bool ShowWindow (IntPtr hWnd, short State );
/// <Summary>
/// Send the re-painting message WM_PAINT to the target form to update the invalid region of the target form customer area.
/// </Summary>
Static public extern bool UpdateWindow (IntPtr hWnd );
&