W
webbertsolutions
I am trying to hide >> JUST << the Maximize button.
I want the Minimize and Close to still show up and work.
This is what I tried. The call to GetWindowLong() always
returns Zero as the value.
Thanks,
Dave
// ------------------------------------------
[DllImport("user32.dll")]
static extern long GetWindowLong(long hwnd, long nIndex);
[DllImport("user32.dll")]
static extern long SetWindowLong(long hwnd, long nIndex, long dwNewLong);
// ------------------------------------------
private void mainForm_Load(object sender, System.EventArgs e)
{
// Set up additional information
InitializeForm();
}
// ------------------------------------------
private void InitializeForm()
{
const int WS_MAXIMIZEBOX = 0x10000;
const long GWL_STYLE = -16;
long hWnd = this.Handle.ToInt32();
long style = GetWindowLong(hWnd, GWL_STYLE);
style = style & ~WS_MAXIMIZEBOX;
SetWindowLong(hWnd, GWL_STYLE, style);
this.Invalidate();
}
// ------------------------------------------
I want the Minimize and Close to still show up and work.
This is what I tried. The call to GetWindowLong() always
returns Zero as the value.
Thanks,
Dave
// ------------------------------------------
[DllImport("user32.dll")]
static extern long GetWindowLong(long hwnd, long nIndex);
[DllImport("user32.dll")]
static extern long SetWindowLong(long hwnd, long nIndex, long dwNewLong);
// ------------------------------------------
private void mainForm_Load(object sender, System.EventArgs e)
{
// Set up additional information
InitializeForm();
}
// ------------------------------------------
private void InitializeForm()
{
const int WS_MAXIMIZEBOX = 0x10000;
const long GWL_STYLE = -16;
long hWnd = this.Handle.ToInt32();
long style = GetWindowLong(hWnd, GWL_STYLE);
style = style & ~WS_MAXIMIZEBOX;
SetWindowLong(hWnd, GWL_STYLE, style);
this.Invalidate();
}
// ------------------------------------------