As zapacila89 says, you can use the CloseWindow method with p/invoke. This method is located in the user32.dll so it will be availabe. This works from Wndows 95 and Windows NT 3.1.
The method returns a true when if succeeds; otherwise it will return false and you can get the error information with the GetLastError method. But never use GetLastError method with p/invoke but use the GetLastWin32Error method of the Marshal class.
Link Button - Windows ApplicationC# Signatu
jkonair
Yes....like the default minimize button...
David Gutierrez
softer
mks033
The .NET way to do this is simple:
this.WindowState = FormWindowState.Minimized;
Hope that helps,
Thi
Dan_TGT
C# Signature:
[DllImport("user32.dll")]static extern bool CloseWindow(IntPtr hWnd);
The CloseWindow function minimizes (but does not destroy) the specified window.
To destroy a window, an application must use the DestroyWindow function.
Hope This helps
MS Johan Stenberg
Karen Mae Sapla
MVPE
deviao9
This works from Wndows 95 and Windows NT 3.1.
The method returns a true when if succeeds; otherwise it will return false and you can get the error information with the GetLastError method. But never use GetLastError method with p/invoke but use the GetLastWin32Error method of the Marshal class.
Here is a little example:
[DllImport("user32.dll")]
static extern bool CloseWindow(IntPtr hWnd);
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
CloseWindow( this.Handle );
}
myso77
me and PJ. van de Sande gived you the universal answer...
Dishan Fernando
Raghavendra RAV
So,
I just need to import the dll and put CloseWindow(GetForeGroundWindow()); in the lnkbutton event