Using a dialog box resource as main window?

Using a dialog box resource as main window?

Post by William Ro » Tue, 15 Nov 1994 20:47:13





>Subject: Using a dialog box resource as main window?
>Date: Mon, 14 Nov 1994 14:12:39 GMT
>Hi
>I can't seem to work out how to use a dialog box resource I create with
>App Studio as the application's main window.  CreateWindow() doesn't want
>to take a resource ID, and DialogBox() seems to be for modal windows only.
>Am I missing something, or is it not possible to use the designer in App
>Studio to create an application's main window?

DoModal will work just fine. Call it in InitInstance(), and it will come right
up. Just don't try to associate the dialog with any functions that deal with
regular windows, like CreateWindow(), as they just don't fit for a dialog.

A modal dialog is just fine, unless you plan to put other dialogs in there
somehow, in which case you will need to call it as modeless, and blast it but
I forgot how!!!

Oh, well, back to the grind.

 
 
 

Using a dialog box resource as main window?

Post by Harvey Brydon (9 » Wed, 16 Nov 1994 21:53:08




>I can't seem to work out how to use a dialog box resource I create with
>App Studio as the application's main window.  CreateWindow() doesn't want
>to take a resource ID, and DialogBox() seems to be for modal windows only.
>Am I missing something, or is it not possible to use the designer in App
>Studio to create an application's main window?

This capability is builtin to MSVC 2.0 (App Wizard and friends).  I use it in
one of my programs and it works well.  It doesn't support CDocument though
(which depends on a view).  I had to hack around that one...
_______________________________________________________________

Schlumberger Dowell   | P.O.T.S.:   (918)250-4312
  Beware of Physics PhDs doing programming.
  Beware of programmers carrying screwdrivers.

 
 
 

Using a dialog box resource as main window?

Post by Ian Cha » Tue, 15 Nov 1994 23:12:39


Hi

I can't seem to work out how to use a dialog box resource I create with
App Studio as the application's main window.  CreateWindow() doesn't want
to take a resource ID, and DialogBox() seems to be for modal windows only.
Am I missing something, or is it not possible to use the designer in App
Studio to create an application's main window?

Cheers
Ian

--
[       Ian Chard, HBM Ltd       |  "...but the day I totally give up will be ]


[  PGP 2.6 available on request  |   doesn't prove his own non-existence..."  ]

 
 
 

Using a dialog box resource as main window?

Post by Eric Bohlm » Wed, 16 Nov 1994 01:40:50


: Hi

: I can't seem to work out how to use a dialog box resource I create with
: App Studio as the application's main window.  CreateWindow() doesn't want
: to take a resource ID, and DialogBox() seems to be for modal windows only.
: Am I missing something, or is it not possible to use the designer in App
: Studio to create an application's main window?

You could use CreateDialog to make a modeless dialog.  If the dialog is
going to be your app's *only* top-level window, then it doesn't really
matter whether it's modal or modeless.

 
 
 

Using a dialog box resource as main window?

Post by Mike Churchwa » Sat, 19 Nov 1994 05:20:07




>I can't seem to work out how to use a dialog box resource I create with
>App Studio as the application's main window.  CreateWindow() doesn't want
>to take a resource ID, and DialogBox() seems to be for modal windows only.
>Am I missing something, or is it not possible to use the designer in App
>Studio to create an application's main window?

If I'm reading this right, I just did the same thing. When I created the App
using App Wizard, I specified "CFormView" instead of "CView" as the main window.
This allows the dialog to be the main, and initial window.

Mike.

 
 
 

1. Using accelerators when a modeless dialog box is the main window

I'm writing a control panel that uses a modeless dialog box as its main
window.  Somehow I can't seem to trap the accelerator keys.  Here's the
beginning part:

case CPL_DBLCLK:
        CreateDialog(hinst, MAKEINTRESOURCE(IDD_MAIN), hwndCPl,
(DLGPROC)DialogProc);
        hAccelTable = LoadAccelerators(hinst, MAKEINTRESOURCE(IDR_ACCELERATOR));
        while (GetMessage(&msg, NULL, 0, 0))
        {
                if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
                {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                }
        }
        break;

Then in the DialogProc, I try to get the message:

switch(uMsg)
{
        .
        .
        case WM_COMMAND:
                switch(LOWORD(wParam))
                {
                        .
                        .
                        case IDM_MYMENUITEM:
                                MessageBox(GetFocus(), "Hello", "Test", MB_OK);
                                break;
                }
                break;

It doesn't work, though.  What am I missing?

Thanks,
Dave Herman

http://www.microcosm.com/~dave

To e-mail me, delete the underscore
at the end of my e-mail address.

2. SCO email to Internet Provider & viceversa

3. Using Dialog Box as Main Window - How?

4. New ship.c

5. TAB doesn't work when using dialog box as main window

6. Odyssey^2 and Odyssey^3 videogame FAQ

7. Problem: Using a dialog-box as main window.

8. Why doesn't Microsoft's identity transform example work?

9. Dialog box as main window, using VC++

10. Problem using dialog box as main window

11. Dialog box as main window, how to in Windows 3.1?

12. Make a dialog resource the main window of a application

13. How to change a size of edit box while sizing main dialog box?