Dec 082017
 
Example of creating an expanding dialog box. C source code.
File EXPAND.ZIP from The Programmer’s Corner in
Category C Source Code
Example of creating an expanding dialog box. C source code.
File Name File Size Zip Size Zip Type
EXPAND.C 5977 1918 deflated
EXPAND.DEF 230 172 deflated
EXPAND.DOC 1093 549 deflated
EXPAND.EXE 5296 2184 deflated
EXPAND.H 259 158 deflated
EXPAND.ICO 1038 61 deflated
EXPAND.MAK 385 204 deflated
EXPAND.RC 862 400 deflated

Download File EXPAND.ZIP Here

Contents of the EXPAND.DOC file


Question: How can I make a Dialog Box expand like Excel uses for
it's Fonts Dialog Box?

Answer:
Here are the steps necessary in order to do this.

1] Make your dialog box in the RC file smaller than what
it should be so that it not show, "hide", the other controls.
2] Disable the "hidden" controls in the RC file so that using
the TAB key or other neumonic keys will not give them the focus.

When the person presses the desired "expand" key:

3] Disable the "expand" key.
4] Enable the other controls.
5] Set the focus on the control you want to now have the focus.
6] Use the following function to get the current origin of the Dialog.
GetWindowRect(hWndDlg,(LPRECT)&r);
] Use the following function to then expand the dialog to it's
new size.
MoveWindow(hWndDlg, r.left,r.top, r.right-r.left,
(r.bottom-r.top)+14, TRUE );
] Replace the "+14" with the desired depth.

That is all that is necessary. Note that you can also expand
in any direction that you want with the MoveWindow function.



 December 8, 2017  Add comments

Leave a Reply