Dialog box as a main window in windows 95, using Win32 SDK only (MSVC 5.00) 
Author Message
 Dialog box as a main window in windows 95, using Win32 SDK only (MSVC 5.00)

Hello All,

I've been searching for the correct way to program an application so
that it's main window will be a dialog box which I created using the
resource editor.

My problem is: how can I accomplish this ?

The help of MSVC isn't exactly clear about this, IMHO.

Any help would be greatly appreciated, I'm going nuts :)).

Kind regards,
Bob Soeters



Wed, 15 Nov 2000 03:00:00 GMT  
 Dialog box as a main window in windows 95, using Win32 SDK only (MSVC 5.00)


Quote:
Soeters) writes:

>I've been searching for the correct way to program an application so
>that it's main window will be a dialog box which I created using the
>resource editor.

>My problem is: how can I accomplish this ?

>The help of MSVC isn't exactly clear about this, IMHO.

>Any help would be greatly appreciated, I'm going nuts :)).

Basically you just call DialogBox() directly from WinMain().

int Pascal WinMain(HINSTANCE hiCurrent, HINSTANCE hiPrevious,
   LPSTR lpszCmdLine, int nCmdShow )
{
   DialogBox( hiCurrent, "DialogName", NULL, (DLGPROC)DialogProc);
   return 0;

Quote:
}

Roger Abbott,
RHA (Minisystems) Ltd
http://users.aol.com/rogerha   DDE tools, Algol60 downloads


Thu, 16 Nov 2000 03:00:00 GMT  
 Dialog box as a main window in windows 95, using Win32 SDK only (MSVC 5.00)

Quote:
>Basically you just call DialogBox() directly from WinMain().

>int PASCAL WinMain(HINSTANCE hiCurrent, HINSTANCE hiPrevious,
>   LPSTR lpszCmdLine, int nCmdShow )
>{
>   DialogBox( hiCurrent, "DialogName", NULL, (DLGPROC)DialogProc);
>   return 0;
>}

>Roger Abbott,
>RHA (Minisystems) Ltd
>http://users.aol.com/rogerha   DDE tools, Algol60 downloads

Hello Roger,

Your solution makes sense, but what if I want to register a window
class on my own for dialog boxes and then use that class for my dialog
box, so I can add an icon ?

I've already tried several approaches, done everything exactly as the
help and KB of MicroSoft suggested, and it still doesn't work. I don't
know if or what I'm doing wrong.

Kind regards,
Bob Soeters



Fri, 17 Nov 2000 03:00:00 GMT  
 Dialog box as a main window in windows 95, using Win32 SDK only (MSVC 5.00)

Quote:

>Your solution makes sense, but what if I want to register a window
>class on my own for dialog boxes and then use that class for my dialog
>box, so I can add an icon ?

So then register it:

-add a CLASS "MyDialogClass" line to your dialog script resource
-register your private dialog class using DefDialogProc as the lpfnWndProc
member and DLGWINDOWEXTRA for the cbWndExtra member
-use CreateDialog to create the dialog
-call IsDialogMessage in your message pump like so:

    while ( GetMessage(&msg, NULL, 0, 0) > 0 ) {
        if ( !hwndDialog || !IsDialogMessage(hwndDialog, &msg) ) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

- return either TRUE or FALSE from your DialogFunc passed to CreateDialog as
the lpDialogFunc parameter

You need to call IsDialogMessage to get the functionality offered by Windows
for dialogs, otherwise it pretty much behaves like a standard window.

Jeremy



Fri, 17 Nov 2000 03:00:00 GMT  
 Dialog box as a main window in windows 95, using Win32 SDK only (MSVC 5.00)



Quote:

>>Your solution makes sense, but what if I want to register a window
>>class on my own for dialog boxes and then use that class for my dialog
>>box, so I can add an icon ?

>So then register it:

>-add a CLASS "MyDialogClass" line to your dialog script resource
>-register your private dialog class using DefDialogProc as the lpfnWndProc
>member and DLGWINDOWEXTRA for the cbWndExtra member
>-use CreateDialog to create the dialog
>-call IsDialogMessage in your message pump like so:

>    while ( GetMessage(&msg, NULL, 0, 0) > 0 ) {
>        if ( !hwndDialog || !IsDialogMessage(hwndDialog, &msg) ) {
>            TranslateMessage(&msg);
>            DispatchMessage(&msg);
>        }
>    }

>- return either TRUE or FALSE from your DialogFunc passed to CreateDialog as
>the lpDialogFunc parameter

>You need to call IsDialogMessage to get the functionality offered by Windows
>for dialogs, otherwise it pretty much behaves like a standard window.

>Jeremy

Hello Jeremy,

Thank you for this reply. I tried to do it like you suggested, and I
still not able to accomplish the wanted result.

Perhaps someone can send me some working example of a program which
consists of only one dialog box ? I'd be very pleased...

Kind Regards,
Bob Soeters



Sat, 18 Nov 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Windows 95 question about dialog box

2. Dialog as main windows under SDK (not MFC)

3. Windows SDK or Win32 SDK?

4. main dialog window is blocked by second dialog window

5. Acessing windows 95 long file names entries from msvc 1.5

6. MSVC 1.0 (16-bit) in Windows 95

7. WTB: Microsoft Visual C++ 2.2 and/or Windows 95 SDK

8. displaying dialog box with my main window..

9. Dialog Box as Main Window/No debugger /4.0

10. Displaying Dialog Box On the Main Window

11. How to describe a new main window forcurrent Dialog Box application

12. Detection of TCP/IP on Windows 95 with Win32

 

 
Powered by phpBB® Forum Software