Disable Minimize and Maximize Box
-
Hi, I want to remove or disable Minimize and Maximize box from SDI Frame... Please anybody help me.... usha
Hi, The CWnd::OnCreate() method is used to create a window and it is usually meant to do this using its default configured features. Therefore, anything you want to display on the frame when the application displays, you can do so when creating the application. Therefore, the frame is typically used to create and display the toolbar(s), dialog bar(s), and status bar. After the frame has been created, if you want to modified something on it, you can do so after it has been created but before it is displayed to the user. To do this, you can use the PreCreateWindow() method of the CWnd class. Its syntax is:
virtual void PreCreateWindow(CREATESTRUCT& cs);
This method takes a reference to CREATESTRUCT class, modifies and returns it with the new characteristics. For example, you can use this method to remove the Minimize and the Maximize system buttons on the title bar as follows:BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
return CFrameWnd::PreCreateWindow(cs);
}Hope this help you..! Good Luck..:rose:
:rose: Jagdish Bhimbha S/W Developer :-O
-
Hi, The CWnd::OnCreate() method is used to create a window and it is usually meant to do this using its default configured features. Therefore, anything you want to display on the frame when the application displays, you can do so when creating the application. Therefore, the frame is typically used to create and display the toolbar(s), dialog bar(s), and status bar. After the frame has been created, if you want to modified something on it, you can do so after it has been created but before it is displayed to the user. To do this, you can use the PreCreateWindow() method of the CWnd class. Its syntax is:
virtual void PreCreateWindow(CREATESTRUCT& cs);
This method takes a reference to CREATESTRUCT class, modifies and returns it with the new characteristics. For example, you can use this method to remove the Minimize and the Maximize system buttons on the title bar as follows:BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
return CFrameWnd::PreCreateWindow(cs);
}Hope this help you..! Good Luck..:rose:
:rose: Jagdish Bhimbha S/W Developer :-O
-
Hi Usha, The solution i gave you must be working, might be there you are doing some mistake in implementing this technique. Do u getting any error message..? Please put this code at approprite place, & with proper arguments. & sorry, i looked for other solution but failed to found..!:confused: Better Luck this Time..:rose::rose:
:rose: Jagdish Bhimbha S/W Developer :-O
-
Hi Usha, The solution i gave you must be working, might be there you are doing some mistake in implementing this technique. Do u getting any error message..? Please put this code at approprite place, & with proper arguments. & sorry, i looked for other solution but failed to found..!:confused: Better Luck this Time..:rose::rose:
:rose: Jagdish Bhimbha S/W Developer :-O
Do edit your CMainFrame::PreCreateWindow function not the one which is inside your view class and the statement will work... BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style &= ~(WS_MAXIMIZEBOX); return TRUE; }
dev BGH visit www.mastersoft.at