TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: John Beal
from: Peter Fitzsimmons
date: 1995-11-13 01:03:20
subject: Initial Window Size

PF> Don't call WinCreateStdWindow() -- call WinCreateWindow() PF>
with a class of WC_FRAME.

 JB> I get unusual results from this.  When I call WinCreateWindow(),
 JB> it gives me what I'm after except that the titlebar and menu do
 JB> not appear until after I resize the border.  I can use the menu
 JB> keys to get the submenus to display while the menu is not
 JB> displayed.

 JB> I've tried WinShowWindow() and WinSetWindowPos() to cause these
 JB> controls to display, but haven't had any success.  Any clues as to
 JB> what Frame Control flags, API functions to call, etc, to have this
 JB> come up correctly w/out having to resize it?

Are you WinShow'ing the frame handle,  or the client?

Here's a small sample that works.  It doesn't have a menu,  but the
titlebar always appears.

 #define INCL_WIN
 #include 

 // icc /Ss /Rn /O /W3 work.c /b"/pm:pm"

 #define MYCLASS "MyWindowClass"

 MRESULT EXPENTRY MyWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
     switch (msg) {
             case WM_ERASEBACKGROUND:
             break;
         default:
             return WinDefWindowProc(hwnd, msg, mp1, mp2);
     }
     return 0;
 }

 int main(int argc, char **argv)
 {
     HAB hab;
     HMQ hmq;
     HWND hwndFrame;
     HWND hwndClient;
     QMSG qmsg;
     FRAMECDATA fcdata;

     if (!(hab = WinInitialize(0)))
         return 1;

     if (!(hmq = WinCreateMsgQueue(hab, 0)))
         return 1;

     if (!WinRegisterClass(hab, MYCLASS, (PFNWP) MyWindowProc, 0, 0))
         return 1;

     /* Create frame window */
     fcdata.cb = sizeof(FRAMECDATA);
     fcdata.flCreateFlags = FCF_SHELLPOSITION | FCF_SIZEBORDER |
         FCF_TASKLIST | FCF_MINMAX | FCF_SYSMENU | FCF_TITLEBAR;


     fcdata.hmodResources = 0;           /* Resource file not in DLL. */
     fcdata.idResources = 1;

     hwndFrame = WinCreateWindow( HWND_DESKTOP, WC_FRAME, NULL, 0, 0, 0,
                                 0, 0, NULLHANDLE, HWND_TOP,
                                 fcdata.idResources, &fcdata, NULL);
     if (!hwndFrame)
         return 1;

     hwndClient = WinCreateWindow( hwndFrame, MYCLASS, NULL, WS_VISIBLE,
                                  0, 0, 0, 0, hwndFrame, HWND_TOP,
                                  2,     //window id
                                  NULL,  // creation data
                                  NULL);
     if (!hwndClient)
         return 1;

     WinShowWindow(hwndFrame, TRUE);

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

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

     return 0;
 }



--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

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™.