Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can add minimizing and maximising buttons to a dialog?

Status
Not open for further replies.

kaya17

Programmer
Feb 9, 2004
78
SG
hi,
is it possible that i can add minimizing and maximising buttons to a dialog like the one appeared in documents?


if so, how to do it?

your help is really very much appreciated!
and thanks so much!


regards,
kaya
 
yes it is possible, you need to add in the flags when you call CreateWindow()

i cant remember them off the top of my head but take a look in MSDN

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Well if you are creating the dialog from a resource you should just be able to change the properties so that it has them. Look under the "Styles" tab.
 
hi,i tried the style tab, but the problem is only the dialog is changing, well the list inside still remains the same size. what should i do to make the list and everything inside the dialog also enlarge together?

thanks in advance!!!

kaya
 
Just add a message handler for WM_SIZE for the dialog, and in that call SetWindowPos for the list control to update the size so it matches the dialog.
 
i am sorry, because i just started learning MFC, i have no idea how to build a message handler.how to use the WM_SIZE? i am so sorry, but really need your help....


kaya
 
Hit Ctrl+W to bring up the class wizard. On the "Message Maps" tab, select your dialog class (it is probably already selected), and find WM_SIZE in the Messages list box. Click it and hit OK to create the new handler. In the handler, do something like this:

void CMyDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);

// TODO: Add your message handler code here

GetDlgItem(IDC_LIST)->SetWindowPos(NULL, 0, 0, cx - 5, cy - 5, SWP_NOMOVE | SWP_NOZORDER);
}

 
hi, i tried your code, but it gave an assertion error, saying something that memory could not be "read"...

anything wrong ?

kaya
 
and when i click CANCEL to debug it, it saying something
"unhandled exception in EIFScan.exe ....Access Violation"

and the error arrow points to a line:
ASSERT:):IsWindow(m_hnd));


:(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top