Automatically Minimizing Window
-
Hello. I'm just starting out in VC 6.0. I'm using MFC Appwizard, and have created a test program. I've got it so far where you click on a button and a MessageBox pops up. I was wondering, I want to add some code in there that will automatically Minimize the current window. So, you'll click on my "test" button, and it will automatically minimize the window. Can anyone please point me in the correct direction?
-
Hello. I'm just starting out in VC 6.0. I'm using MFC Appwizard, and have created a test program. I've got it so far where you click on a button and a MessageBox pops up. I was wondering, I want to add some code in there that will automatically Minimize the current window. So, you'll click on my "test" button, and it will automatically minimize the window. Can anyone please point me in the correct direction?
First off you might want to use AfxGetMainWnd(), which returns a pointer to the main application window. You could then use CWnd::ShowWindow( SW_MINIMIZE ) to minimize it. So all together you've got:
CWnd *pMainWnd;
pMainWnd = AfxGetMainWnd();
pMainWnd->ShowWindow( SW_MINIMIZE );Tada!:-D Hope that helps, Pete
-
Hello. I'm just starting out in VC 6.0. I'm using MFC Appwizard, and have created a test program. I've got it so far where you click on a button and a MessageBox pops up. I was wondering, I want to add some code in there that will automatically Minimize the current window. So, you'll click on my "test" button, and it will automatically minimize the window. Can anyone please point me in the correct direction?
Yep:
CMyDialog::OnTestBtn()
{
ShowWindow(SW_MINIMIZE);
}Hope this helps. ------------------------ Derek Waters derek@lj-oz.com