Annotation of pmsdk/samples/mdi/appinit.c, revision 1.1

1.1     ! root        1: /*
        !             2:     mdiinit.c - MDI initialization funtions.
        !             3:     Created by Microsoft Corporation, 1989
        !             4: */
        !             5: #define INCL_WINSYS
        !             6: #define INCL_WINCOMMON
        !             7: #define INCL_WINMESSAGEMGR
        !             8: #define INCL_WINPOINTERS
        !             9: #define INCL_WININPUT
        !            10: #define INCL_WINMENUS
        !            11: #define INCL_WINFRAMEMGR
        !            12: #define INCL_WINWINDOWMGR
        !            13: #define INCL_WINRECTANGLES
        !            14: #define INCL_WINHEAP
        !            15: #define INCL_GPIBITMAPS
        !            16: #define INCL_GPILCIDS
        !            17: #define INCL_DEV
        !            18: 
        !            19: #include <os2.h>
        !            20: #include "app.h"
        !            21: #include "appdata.h"
        !            22: #include "mdi.h"
        !            23: #include "mdidata.h"
        !            24: 
        !            25: /* Function prototypes */
        !            26: BOOL RegisterWindowClasses(VOID);
        !            27: VOID InitSysValues(VOID);
        !            28: 
        !            29: 
        !            30: BOOL AppInit(VOID)
        !            31: {
        !            32:     ULONG ctlData;
        !            33:     HPS hps;
        !            34:     HDC hdc;
        !            35: 
        !            36:     hab = WinInitialize(0);
        !            37: 
        !            38:     hmqMDI = WinCreateMsgQueue(hab, 0);
        !            39: 
        !            40:     if (!RegisterWindowClasses())
        !            41:         return(FALSE);
        !            42: 
        !            43:     ctlData = FCF_TITLEBAR | FCF_MINMAX | FCF_SIZEBORDER | FCF_SYSMENU |
        !            44:             FCF_MENU | FCF_TASKLIST | FCF_SHELLPOSITION | FCF_ICON;
        !            45: 
        !            46:     hwndMDIFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
        !            47:             (VOID FAR *)&ctlData, szMDIClass, (PSZ)NULL,
        !            48:             WS_VISIBLE | WS_CLIPCHILDREN, NULL, IDR_MDI,
        !            49:             (HWND FAR *)&hwndMDI);
        !            50: 
        !            51:     if (hwndMDIFrame == NULL)
        !            52:         return(FALSE);
        !            53: 
        !            54:     hHeap = WinCreateHeap(0, 0, 0, 0, 0, 0);
        !            55: 
        !            56:     if (hHeap == NULL)
        !            57:         return(FALSE);
        !            58: 
        !            59:     hps = WinGetPS(hwndMDI);
        !            60: 
        !            61:     hdc = GpiQueryDevice(hps);
        !            62:     DevQueryCaps(hdc, CAPS_FAMILY, CAPS_VERTICAL_FONT_RES, (PLONG)rglDevCaps);
        !            63: 
        !            64:     WinReleasePS(hps);
        !            65: 
        !            66:     InitSysValues();
        !            67: 
        !            68:     return(TRUE);
        !            69: }
        !            70: 
        !            71: 
        !            72: VOID InitSysValues(VOID)
        !            73: {
        !            74:     cyTitlebar = (SHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
        !            75:     cyIcon = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYICON);
        !            76: 
        !            77:     cxBorder = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
        !            78:     cyBorder = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
        !            79: 
        !            80:     cxSizeBorder = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER);
        !            81:     cySizeBorder = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
        !            82: 
        !            83:     cxByteAlign = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CXBYTEALIGN);
        !            84:     cyByteAlign = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYBYTEALIGN);
        !            85: 
        !            86:     cxVScroll = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
        !            87:     cyVScrollArrow = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
        !            88:     cyHScroll = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
        !            89: 
        !            90:     cxScreen = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
        !            91:     cyScreen = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
        !            92: 
        !            93:     cxMinmaxButton = (USHORT)WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON);
        !            94: }
        !            95: 
        !            96: 
        !            97: BOOL RegisterWindowClasses(VOID)
        !            98: {
        !            99:     if (!WinRegisterClass(NULL, szMDIClass, (PFNWP)MDIWndProc,
        !           100:             CS_SYNCPAINT, 0))
        !           101:         return(FALSE);
        !           102: 
        !           103:     if (!WinRegisterClass(NULL, szDocClass, (PFNWP)DocWndProc,
        !           104:             0L, sizeof(NPVIEW)))
        !           105:         return(FALSE);
        !           106: 
        !           107:     return(TRUE);
        !           108: }
        !           109: 
        !           110: 
        !           111: VOID AppTerminate(VOID)
        !           112: {
        !           113:     WinDestroyWindow(hwndMDIFrame);
        !           114: 
        !           115:     WinDestroyHeap(hHeap);
        !           116: 
        !           117:     WinDestroyMsgQueue(hmqMDI);
        !           118: 
        !           119:     WinTerminate(hab);
        !           120: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.