TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Paul Edwards
date: 1996-11-14 22:51:02
subject: sticky dialog

I know this is a basic question, but that's where I am at at the moment. 
The following program works, and opens a main window, loads the dialog, but
unfortunately the dialog is displayed in a separate window, instead of
being associated with the main window.

ie I basically want the dialog to take up all the client space of the first
window, and if I move the main window, the dialog moves with it.

I have already tried the obvious thing of replacing HWND_DESKTOP with hwnd,
but that makes the dialog window disappear!  Any ideas? Thanks + bye. 
Paul.


#define INCL_WIN
#define INCL_GPICONTROL
#define INCL_DOSPROCESS
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#define INCL_DOSMISC

#include 
#include 
#include 
#include "fred.h"

static HWND hwndListBox;

/* function prototypes */
MRESULT EXPENTRY ClientWndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;

int main( void)
{
    HAB hab ;
    CHAR szClassName[] = "fred" ;
    ULONG createFlags = FCF_SYSMENU | FCF_TITLEBAR |
                        FCF_SIZEBORDER | FCF_SHELLPOSITION ;
    HMQ hmq ;
    HWND hwndClient;
    QMSG qmsg ;
    HACCEL haccel ;

    hab = WinInitialize( 0) ;
    hmq = WinCreateMsgQueue( hab, 0L) ;

    WinRegisterClass(   hab, szClassName,
                        ClientWndProc,
                        CS_SIZEREDRAW, 0L) ; 
                        
    WinCreateStdWindow(HWND_DESKTOP,
                       WS_VISIBLE,
                       &createFlags,
                       szClassName,
                       (PSZ)"fred program",
                       (ULONG)0,
                       NULLHANDLE,
                       (ULONG)0,
                       &hwndClient);

    while( WinGetMsg( hab, &qmsg, NULLHANDLE, 0L, 0L))
        WinDispatchMsg( hab, &qmsg) ;

    WinDestroyWindow( hwndClient) ;
    WinDestroyMsgQueue( hmq) ;
    WinTerminate( hab) ;

    return 0L ;
}

MRESULT EXPENTRY ClientWndProc( HWND hwnd,
                                ULONG msg,
                                MPARAM mp1,
                                MPARAM mp2)
{
HWND hwndFrame;


    switch( msg)
    {
        case WM_CREATE:
            hwndFrame = WinLoadDlg( HWND_DESKTOP, hwnd,
                                    NULL,
                                    NULLHANDLE, ID_DIALOG,
                                    NULL) ;

            break;
        
        case WM_COMMAND:
            switch( COMMANDMSG( &msg) -> cmd)
            {
                case ID_STARTUP:
                {
                    /* retrieve control handle */
                    hwndListBox = WinWindowFromID( hwnd, ID_LISTBOX) ;
                }
                    break ;
            }                
            break;


        case WM_PAINT:
        {
            HPS hps ;

            hps = WinBeginPaint( hwnd, NULLHANDLE, NULL) ;
            GpiErase( hps) ;
            WinEndPaint( hps) ;
        }
            break ;

        default:
            break;
    }
    return WinDefWindowProc( hwnd, msg, mp1, mp2) ;
}
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.