[comp.windows.ms.programmer] Dialog Boxes

hall@ucscb.ucsc.edu (60265000) (01/23/91)

Name: hall@ucscb.ucsc.edu

I was wondering if there was a way to make a dialog box the main
window of a program and be able to minimize the dialog box into
an icon.  I know it is possible if you make your own controls, but
is it possible with a dialog resource script?

Thanks in advance,

Christopher Hall

gpsteffl@sunee.waterloo.edu (Glenn Patrick Steffler) (01/24/91)

In article <11395@darkstar.ucsc.edu> hall@ucscb.ucsc.edu (60265000) writes:
>
>Name: hall@ucscb.ucsc.edu
>
>I was wondering if there was a way to make a dialog box the main
>window of a program and be able to minimize the dialog box into

Hey Chris, ever seen the Windows task list program?  (hint)

Just do a create dialog.  Means you have to have a main message loop, but
all of the control creation, and handling is done by windows.

>an icon.  I know it is possible if you make your own controls, but
>is it possible with a dialog resource script?

I wrote code to take in a dialog resource script and create the controls
in a popup window.  Not hard, just read the docs.  I needed it for a 
utility that "adds" popup windows to other applications to control
DDE and stuff.  Kinda neat...but generally esoteric.

>Thanks in advance,
>
>Christopher Hall

-- 
Co-Op Scum                            "Bo doesn't know software" - George Brett

"The galaxial hearth steams the sea as the sky blood red embrasses darkness"
-John Constantine (HellBlazer)                          Glenn Steffler

robert@newmedia.UUCP (Bob Wiener) (01/24/91)

What you can do is make your dialog box a child window of your main window.
The controls will then look like they are part of the main window.
You will need a separate DialogProc to handle the controls  while the 
windowProc handles messages sent to menus and moving the main window around.


Hope this helps,
Robert Wiener

rkt@bjcong.bj.co.uk (RAKESH TANDON) (01/25/91)

In article <11395@darkstar.ucsc.edu>, hall@ucscb.ucsc.edu (60265000) writes:
> 
> Name: hall@ucscb.ucsc.edu
> 
> I was wondering if there was a way to make a dialog box the main
> window of a program and be able to minimize the dialog box into
> an icon.  I know it is possible if you make your own controls, but
> is it possible with a dialog resource script?
> 

Instead of doing a CreateWindow call do a CreateDialog call, This create
the Dialog box as the main window.

N.B.
Define your template in the resource file as normal but give it a CLASS,
You then have to Register that class and then call 
CreateDialog (hInst, <dialog template name>, 0, NULL) ;

You can define the icon, menu, window proc for the class just as you 
do for a normal window. You must set cbWndExtra to DLGWINDOWEXTRA in your
class structure.

If you get stuck I can email some sample code to help you out

-- 
Rakesh Kumar Tandon 	            : email   : rkt@bj.co.uk
Boldon James Limited	            : phone   : 0260 280465
Damian House, West Street           : fax     : 0260 298030
CONGLETON, Cheshire                 : UUCP    : ..!mcsun!ukc!pyrltd!bjcong!rkt

alan@comp.lancs.ac.uk (Alan Phillips) (01/26/91)

In article <1120@bjcong.bj.co.uk> rkt@bjcong.bj.co.uk (RAKESH TANDON) writes:
>Instead of doing a CreateWindow call do a CreateDialog call, This create
>the Dialog box as the main window.

The process is fully covered in Petzold's book Programming Windows, where
he shows how to write a hex calculator as a dialog box. (In edition 1, he
omits the essential step of using DLGWNDEXTRA to get extra space in the
window control struct)