home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xceptn.zip / Support.C < prev    next >
C/C++ Source or Header  |  1994-08-23  |  19KB  |  565 lines

  1. #pragma    title("Exception Example  --  Version 1.0  --  (Support.C)")
  2. #pragma    subtitle("   Module Purpose - Interface Definitions")
  3.  
  4. #define    INCL_DOS           /* Include OS/2 PM DOS Interface    */
  5. #define    INCL_GPI           /* Include OS/2 PM GPI Interface    */
  6. #define    INCL_WIN           /* Include OS/2 PM Windows Interface    */
  7.  
  8. #pragma    info(noext)
  9.  
  10. #include <os2.h>
  11.  
  12. #include <string.h>
  13. #include "appdefs.h"
  14. #include "except.h"
  15.  
  16. /* This    module contains    routine    used to    load a dialogue    template from    */
  17. /* the applications resource and place the controls within a specified    */
  18. /* window, create a window in a    specific location and to perform    */
  19. /* application initialization.                        */
  20.  
  21. /* Filename:   Support.C                        */
  22.  
  23. /*  Version:   1.0                            */
  24. /*  Created:   1994-08-23                        */
  25. /*  Revised:   1994-08-23                        */
  26.  
  27. /* Routines:   VOID PDSGetTemplate(HWND    hWnd, ULONG idDlg);        */
  28. /*           MRESULT PDSKeyProc(HWND hWnd, ULONG msg,    MPARAM mp1,    */
  29. /*                  MPARAM mp2);                */
  30. /*           VOID InitApp(HWND hwndFrame, HWND hwndClient,        */
  31. /*                PSZ    pszWindowListTitle);            */
  32. /*           HWND CreateStdWindow(HWND hwndParent, ULONG flStyle,    */
  33. /*                    ULONG flCreateFlags,        */
  34. /*                    PSZ    pszClientClass,    PSZ pszTitle,    */
  35. /*                    ULONG styleClient, HMODULE hmod,    */
  36. /*                    ULONG idResources,            */
  37. /*                    PHWND phwndClient, LONG x, LONG y,    */
  38. /*                    LONG cx, LONG cy);            */
  39.  
  40.  
  41. /* Copyright ╕ 1994, 1995  Prominare Inc.  All Rights Reserved.        */
  42.  
  43. /* --------------------------------------------------------------------    */
  44.  
  45. static INTERNALADDRESSLIST aial[ ] = { { (PFNINTADD)PDSGetTemplate,  "PDSGetTemplate"  },
  46.                        { (PFNINTADD)PDSKeyProc,         "PDSKeyProc"      },
  47.                        { (PFNINTADD)InitApp,         "InitApp"           },
  48.                        { (PFNINTADD)CreateStdWindow, "CreateStdWindow" },
  49.                        { NULL, NULL } };
  50.  
  51. INTERNALADDRESS    intaddSupport =     { __FILE__, 0,    aial };
  52.  
  53. /* -- Standard Window Classes -----------------------------------------    */
  54.  
  55. #define    WINCLASS_FRAME           0x00000001L
  56. #define    WINCLASS_COMBOBOX       0x00000002L
  57. #define    WINCLASS_BUTTON           0x00000003L
  58. #define    WINCLASS_MENU           0x00000004L
  59. #define    WINCLASS_STATIC           0x00000005L
  60. #define    WINCLASS_ENTRYFIELD       0x00000006L
  61. #define    WINCLASS_LISTBOX       0x00000007L
  62. #define    WINCLASS_SCROLLBAR       0x00000008L
  63. #define    WINCLASS_TITLEBAR       0x00000009L
  64. #define    WINCLASS_MLE           0x0000000AL
  65. /* 000B    to 000F    reserved */
  66. #define    WINCLASS_APPSTAT       0x00000010L
  67. #define    WINCLASS_KBDSTAT       0x00000011L
  68. #define    WINCLASS_PECIC           0x00000012L
  69. #define    WINCLASS_DBE_KKPOPUP       0x00000013L
  70. /* 0014    to 001F    reserved */
  71. #define    WINCLASS_SPINBUTTON       0x00000020L
  72. /* 0021    to 0024    reserved */
  73. #define    WINCLASS_CONTAINER       0x00000025L
  74. #define    WINCLASS_SLIDER           0x00000026L
  75. #define    WINCLASS_VALUESET       0x00000027L
  76. #define    WINCLASS_NOTEBOOK       0x00000028L
  77. #define    WINCLASS_HWXENTRY       0x00000029L
  78. #define    WINCLASS_SKETCH           0x0000002aL
  79. /* 002b    to 0030    reserved */
  80. /* 0030    to 003F    reserved */
  81. #define    WINCLASS_GRAPHICBUTTON       0x00000040L
  82. #define    WINCLASS_CIRCULARSLIDER       0x00000041L
  83.  
  84. #if !defined(WC_HWXENTRY)
  85. #define    WC_HWXENTRY         ((PSZ)0xffff0029L)
  86. #endif
  87.  
  88. #if !defined(WC_SKETCH)
  89. #define    WC_SKETCH         ((PSZ)0xffff002aL)
  90. #endif
  91.  
  92. #if !defined(WC_GRAPHICBUTTON)
  93. #define    WC_GRAPHICBUTTON     ((PSZ)0xffff0040L)
  94. #endif
  95.  
  96. #if !defined(WC_CIRCULARSLIDER)
  97. #define    WC_CIRCULARSLIDER    ((PSZ)0xffff0041L)
  98. #endif
  99.  
  100. #pragma    subtitle("      Window Controls Support - Dialog Load Function")
  101. #pragma    page( )
  102.  
  103. /* --- PDSGetTemplate ---------------------------------- [ Public ] ---    */
  104. /*                                    */
  105. /*     This function is    used to    read in    the dialog information from    */
  106. /*     the opened resource file.  The information read in for each    */
  107. /*     control is then analyzed    and converted into suitable format    */
  108. /*     to allow    the control to be created.                */
  109. /*                                    */
  110. /*     Upon Entry:                            */
  111. /*                                    */
  112. /*     HWND  hWnd;  = Window Handle                    */
  113. /*     ULONG idDlg; = Dialog ID                        */
  114. /*                                    */
  115. /*     Upon Exit:                            */
  116. /*                                    */
  117. /*     Nothing                                */
  118. /*                                    */
  119. /* --------------------------------------------------------------------    */
  120.  
  121. VOID PDSGetTemplate(HWND hWnd, ULONG idDlg)
  122.  
  123. {
  124. PDLGTEMPLATE pdlgt;           /* Dialog Template Pointer        */
  125. POINTL         aptl[2];           /* Dialog Points Array        */
  126. PVOID         pvClassName;       /* Control Data Pointer        */
  127. PVOID         pvCtlData;           /* Control Data Pointer        */
  128. PVOID         pvPresParams;       /* Presentation Parameters Pointer    */
  129. PVOID         pvStart;           /* Dialog Template Item Pointer    */
  130. PVOID         pvText;           /* Control Data Pointer        */
  131. INT         cbparam;           /* Presentation Parameter Size    */
  132. PPARAM         pparam;           /* Presentation Parameters Pointer    */
  133. PPRESPARAMS  ppres;           /* Presentation Parameters Pointer    */
  134. register INT cItems;           /* Dialog Items Counter        */
  135. register INT i;               /* Loop Counter            */
  136.  
  137.                /* Try reading in the dialog template for the    */
  138.                /* dialog ID given                */
  139.  
  140. if ( DosGetResource((HMODULE)NULL, RT_DIALOG, idDlg, (PPVOID)(PVOID)&pdlgt) )
  141.  
  142.                /* Dialog template not found, exit without    */
  143.                /* creating any controls                */
  144.    return;
  145.                /* Convert the memory selector returned into an    */
  146.                /* addressable pointer to allow the controls to    */
  147.                /* be decoded                    */
  148.  
  149. pvStart    = (PVOID)pdlgt;
  150.                /* Check    to see if any presentation parameters    */
  151.                /* associated with the control.    A -1 indicates    */
  152.                /* that no presentation parameters are        */
  153.                /* associated.                    */
  154.  
  155. if ( pdlgt->adlgti[0].offPresParams != 0xffff )
  156.    {
  157.    ppres = (PPRESPARAMS)((PBYTE)pvStart    + pdlgt->adlgti[0].offPresParams);
  158.    cbparam = (INT)ppres->cb;
  159.  
  160.    i = 0;
  161.    pparam = ppres->aparam;
  162.    while ( cbparam )
  163.        {
  164.        pparam =    (PPARAM)((BYTE *)pparam    + i);
  165.        WinSetPresParam(hWnd, pparam->id, pparam->cb, pparam->ab);
  166.        cbparam -= (i = (INT)pparam->cb + (INT)sizeof(ULONG) * 2);
  167.        }
  168.    }
  169.                /* Save the number of controls found within the    */
  170.                /* dialog template                */
  171.  
  172. cItems = pdlgt->adlgti[0].cChildren + 1;
  173.  
  174.                /* Read in and translate    each of    the controls    */
  175.  
  176. for ( i    = 1; i < cItems; i++ )
  177.    {
  178.                /* Get the position and size of the control and    */
  179.                /* convert from dialog units to actual window    */
  180.                /* co-ordinates                    */
  181.  
  182.    aptl[0].x = (LONG)pdlgt->adlgti[i].x;
  183.    aptl[0].y = (LONG)pdlgt->adlgti[i].y;
  184.    aptl[1].x = (LONG)pdlgt->adlgti[i].cx;
  185.    aptl[1].y = (LONG)pdlgt->adlgti[i].cy;
  186.  
  187.    WinMapDlgPoints(hWnd, aptl, 2UL, TRUE);
  188.  
  189.                /* Check    to see if a custom class is specified    */
  190.                /* or if    a standard PM control class is being    */
  191.                /* used                        */
  192.  
  193.    if (    pdlgt->adlgti[i].cchClassName )
  194.  
  195.                /* Since    a length for the class name present,    */
  196.                /* a custom class name is being used for    the    */
  197.                /* control.  Point to the memory    location where    */
  198.                /* the class name is found within the dialog    */
  199.                /* template information.                */
  200.  
  201.        pvClassName = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offClassName);
  202.    else
  203.                /* No class name    length given indicating    that a    */
  204.                /* standard PM class is being used.  The    class    */
  205.                /* name is stored as an index value.  For    */
  206.                /* example, the class for static's is defined as */
  207.                /*                        */
  208.                /* #define WC_STATIC ((PSZ)0xffff0005L)        */
  209.                /*                        */
  210.                /* The values within the    dialog template    for    */
  211.                /* the static class would be            */
  212.                /*                        */
  213.                /* adlgti[i].cchClassName = 0            */
  214.                /* adlgti[i].offClassName = 5            */
  215.                /*                        */
  216.                /* Therefore, the value of offClassName field    */
  217.                /* must be used as an index that    is used    to    */
  218.                /* actually select the class name.        */
  219.  
  220.        switch (    pdlgt->adlgti[i].offClassName )
  221.        {
  222.                /* Control Type:     Button                */
  223.  
  224.        case    WINCLASS_BUTTON    :
  225.            pvClassName = WC_BUTTON;    
  226.            break;
  227.                /* Control Type:     Frame                */
  228.  
  229.        case    WINCLASS_FRAME :
  230.            pvClassName = WC_FRAME;
  231.            break;
  232.                /* Control Type:     Scroll    Bar            */
  233.  
  234.        case    WINCLASS_SCROLLBAR :
  235.            pvClassName = WC_SCROLLBAR;
  236.            break;
  237.                /* Control Type:     List Box            */
  238.  
  239.        case    WINCLASS_LISTBOX :
  240.            pvClassName = WC_LISTBOX;
  241.            break;
  242.                /* Control Type:     Edit                */
  243.  
  244.        case    WINCLASS_ENTRYFIELD :
  245.            pvClassName = WC_ENTRYFIELD;
  246.            break;
  247.                /* Control Type:     Static                */
  248.  
  249.        case    WINCLASS_STATIC    :
  250.            pvClassName = WC_STATIC;    
  251.            break;
  252.                /* Control Type:     Combo Box            */
  253.  
  254.        case    WINCLASS_COMBOBOX :
  255.            pvClassName = WC_COMBOBOX;
  256.            break;
  257.                /* Control Type:     Multi-Line Edit        */
  258.  
  259.        case    WINCLASS_MLE :
  260.            pvClassName = WC_MLE;
  261.            break;
  262.                /* Control Type:     Spin Button          [1.3]    */
  263.  
  264.        case    WINCLASS_SPINBUTTON :
  265.            pvClassName = WC_SPINBUTTON;
  266.            break;
  267.                /* Control Type:     Container          [2.0]    */
  268.  
  269.        case    WINCLASS_CONTAINER :
  270.            pvClassName = WC_CONTAINER;
  271.            break;
  272.                /* Control Type:     Slider              [2.0]    */
  273.  
  274.        case    WINCLASS_SLIDER    :
  275.            pvClassName = WC_SLIDER;
  276.            break;
  277.                /* Control Type:     Value Set          [2.0]    */
  278.  
  279.        case    WINCLASS_VALUESET :
  280.            pvClassName = WC_VALUESET;
  281.            break;
  282.                /* Control Type:     Notebook          [2.0]    */
  283.  
  284.        case    WINCLASS_NOTEBOOK :
  285.            pvClassName = WC_NOTEBOOK;
  286.            break;
  287.                /* Control Type:     Handwriting     [Pen for OS/2]    */
  288.  
  289.        case    WINCLASS_HWXENTRY :
  290.            pvClassName = WC_HWXENTRY;
  291.            break;
  292.                /* Control Type:     Sketch         [Pen for OS/2]    */
  293.  
  294.        case    WINCLASS_SKETCH    :
  295.            pvClassName = WC_SKETCH;
  296.            break;
  297.                /* Control Type:     Graphic Button           [MMPM/2]    */
  298.  
  299.        case    WINCLASS_GRAPHICBUTTON :
  300.            pvClassName = WC_GRAPHICBUTTON;
  301.            break;
  302.                /* Control Type:     Circular Slider       [MMPM/2]    */
  303.  
  304.        case    WINCLASS_CIRCULARSLIDER    :
  305.            pvClassName = WC_CIRCULARSLIDER;
  306.            break;
  307.        }
  308.                /* Check    to see if any control data associated    */
  309.                /* with the control.  A -1 indicates that no    */
  310.                /* control data is associated.            */
  311.  
  312.    if (    pdlgt->adlgti[i].offCtlData != 0xffff )
  313.        pvCtlData = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offCtlData);
  314.    else
  315.        pvCtlData = NULL;
  316.                /* Check    to see if any presentation parameters    */
  317.                /* associated with the control.    A -1 indicates    */
  318.                /* that no presentation parameters are        */
  319.                /* associated.                    */
  320.  
  321.    if (    pdlgt->adlgti[i].offPresParams != 0xffff )
  322.        pvPresParams = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offPresParams);
  323.    else
  324.        pvPresParams = NULL;
  325.  
  326.                /* Check    to see if any text specified for the    */
  327.                /* control                    */
  328.  
  329.    if (    pdlgt->adlgti[i].cchText )
  330.        pvText =    (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offText);
  331.    else
  332.        pvText =    NULL;
  333.                /* Create the control                */
  334.  
  335.    WinCreateWindow(hWnd, pvClassName, pvText,
  336.            pdlgt->adlgti[i].flStyle,
  337.            aptl[0].x, aptl[0].y,
  338.            aptl[1].x, aptl[1].y,
  339.            hWnd, HWND_BOTTOM, (ULONG)(pdlgt->adlgti[i].id & 0xffff),
  340.            pvCtlData, pvPresParams);
  341.    }
  342.                /* Release the memory allocated for the dialog    */
  343.                /* template before returning            */
  344. DosFreeResource(pvStart);
  345. }
  346. #pragma    subtitle("      Window Controls Support - Default Window Procedure")
  347. #pragma    page( )
  348.  
  349. /* --- PDSKeyProc -------------------------------------- [ Public ] ---    */
  350. /*                                    */
  351. /*     This function is    used to    process    the window messages for    a    */
  352. /*     window that has controls    within it where    TAB key    selection    */
  353. /*     of controls should be possible.    The function is    used to        */
  354. /*     replace the WinDefWindowProc in such a window.            */
  355. /*                                    */
  356. /*     Upon Entry:                            */
  357. /*                                    */
  358. /*     HWND   hWnd; = Window Handle                    */
  359. /*     ULONG  msg;  = PM Message                    */
  360. /*     MPARAM mp1;  = Message Parameter    1                */
  361. /*     MPARAM mp2;  = Message Parameter    2                */
  362. /*                                    */
  363. /*     Upon Exit:                            */
  364. /*                                    */
  365. /*     PDSKeyProc = Message Handling Result                */
  366. /*                                    */
  367. /* --------------------------------------------------------------------    */
  368.  
  369. MRESULT    PDSKeyProc(HWND    hWnd, ULONG msg, MPARAM    mp1, MPARAM mp2)
  370.  
  371. {
  372.  
  373. switch ( msg )
  374.    {
  375.                /* Check    for key    strokes                */
  376.    case    WM_CHAR    :
  377.                /* Check    for the    key up flag in which case the    */
  378.                /* condition should be ignored            */
  379.  
  380.        if ( SHORT1FROMMP(mp1) &    KC_KEYUP )
  381.        break;
  382.                /* Check    for virtual keys            */
  383.  
  384.        if ( SHORT1FROMMP(mp1) &    KC_VIRTUALKEY )
  385.        switch ( SHORT2FROMMP(mp2) )
  386.            {
  387.            case VK_TAB :
  388.  
  389.                /* TAB key pressed, determine which control is    */
  390.                /* the next tab stop and    set the    focus on that    */
  391.                /* control                    */
  392.  
  393.            WinSetFocus(HWND_DESKTOP,
  394.                    WinEnumDlgItem(hWnd,
  395.                           WinQueryFocus(HWND_DESKTOP),
  396.                           EDI_NEXTTABITEM));
  397.            break;
  398.  
  399.            case VK_RIGHT :
  400.            case VK_DOWN :
  401.  
  402.                /* Right    or down    arrow key pressed, determine    */
  403.                /* which    control    is the next entry and set the    */
  404.                /* focus    on that    control                */
  405.  
  406.            WinSetFocus(HWND_DESKTOP,
  407.                    WinEnumDlgItem(hWnd,
  408.                           WinQueryFocus(HWND_DESKTOP),
  409.                           EDI_NEXTGROUPITEM));
  410.            break;
  411.  
  412.            case VK_BACKTAB :
  413.  
  414.                /* Shift+TAB key    pressed, determine which    */
  415.                /* control is the previous tab stop and set the    */
  416.                /* focus    on that    control                */
  417.  
  418.            WinSetFocus(HWND_DESKTOP,
  419.                    WinEnumDlgItem(hWnd,
  420.                           WinQueryFocus(HWND_DESKTOP),
  421.                           EDI_PREVTABITEM));
  422.            break;
  423.  
  424.            case VK_LEFT :
  425.            case VK_UP :
  426.  
  427.                /* Left or up arrow key pressed,    determine    */
  428.                /* which    control    is the previous    entry and set    */
  429.                /* the focus on that control            */
  430.  
  431.            WinSetFocus(HWND_DESKTOP,
  432.                    WinEnumDlgItem(hWnd,
  433.                           WinQueryFocus(HWND_DESKTOP),
  434.                           EDI_PREVGROUPITEM));
  435.            break;
  436.            }
  437.        break;
  438.                /* Virtual key not TAB or Shift+TAB, fall    */
  439.                /* through to default window procedure        */
  440.  
  441.                /* Default message processing            */
  442.    default :
  443.        return(WinDefWindowProc(hWnd, msg, mp1, mp2));
  444.    }
  445. return(0L);
  446. }
  447. #pragma    subtitle("   Program Initialization -   Program Initialization Function")
  448. #pragma    page( )
  449.  
  450. /* --- InitApp ----------------------------------------- [ Public ] ---    */
  451. /*                                    */
  452. /*     This function is    used to    perform    basic application        */
  453. /*     initialization to support the owner draw    list boxes and to set    */
  454. /*     the window list title if    provided.                */
  455. /*                                    */
  456. /*     Upon Entry:                            */
  457. /*                                    */
  458. /*     HWND hwndFrame;      = Application    Frame Window Handle        */
  459. /*     HWND hwndClient;      = Application    Client Window Handle        */
  460. /*     PSZ  pszTaskTitle; = Window List    Title                */
  461. /*                                    */
  462. /*     Upon Exit:                            */
  463. /*                                    */
  464. /*     Nothing                                */
  465. /*                                    */
  466. /* --------------------------------------------------------------------    */
  467.  
  468. VOID InitApp(HWND hwndFrame, HWND hwndClient, PSZ pszWindowListTitle)
  469.  
  470. {
  471. HPS    hPS;               /* Presentation Space Handle        */
  472. SWCNTRL    swCtl;               /* Task Switch Control Structure    */
  473.  
  474.                /* Get a    temporary presentation space so    that    */
  475.                /* the system's font metrics can be found and    */
  476.                /* the proper sizing of owner draw list boxes    */
  477.                /* can be performed properly            */
  478.  
  479. if ( (hPS = WinGetPS(hwndClient)) != (HPS)NULL )
  480.    {
  481.    GpiQueryFontMetrics(hPS, sizeof(FONTMETRICS), &fm);
  482.  
  483.                /* Release the temporary    presentation space    */
  484.    WinReleasePS(hPS);
  485.    }
  486.  
  487. if ( pszWindowListTitle    )
  488.    {
  489.                /* Fill Switch Entry structure with required    */
  490.                /* values before    adding program name to Task    */
  491.                /* Manager switch list                */
  492.  
  493.    swCtl.hwnd           = hwndFrame;
  494.    swCtl.hwndIcon      = (HWND)NULL;
  495.    swCtl.hprog           = (HPROGRAM)NULL;
  496.    swCtl.idProcess     =
  497.    swCtl.idSession     = 0;
  498.    swCtl.uchVisibility = SWL_VISIBLE;
  499.    swCtl.fbJump           = SWL_JUMPABLE;
  500.    strcpy(swCtl.szSwtitle, pszWindowListTitle);
  501.  
  502.    hSwitch = WinAddSwitchEntry(&swCtl);
  503.    }
  504. }
  505. #pragma    subtitle("      Program Initialization - Window Creation Function")
  506. #pragma    page( )
  507.  
  508. /* --- CreateStdWindow ------------------------------------------------    */
  509. /*                                    */
  510. /*     This function is    used to    create a standard window using        */
  511. /*     WinCreateStdWindow and to place the window in the location    */
  512. /*     and size    specified if the shell position    style has not been    */
  513. /*     specified.                            */
  514. /*                                    */
  515. /*     Upon Entry:                            */
  516. /*                                    */
  517. /*     HWND    hwndParent;     = Parent    Window Handle            */
  518. /*     ULONG   flStyle;           = Window    Style                */
  519. /*     ULONG   flCreateFlags;  = Frame Creation    Flags            */
  520. /*     PSZ     pszClientClass; = Client    Area Class            */
  521. /*     PSZ     pszTitle;       = Window    Title                */
  522. /*     HMODULE hmod;           = Resources Module Handle        */
  523. /*     ULONG   idResources;    = Resource ID                */
  524. /*     PHWND   phwndClient;    = Client    Window Handle Pointer        */
  525. /*     LONG    x;           = x Co-ordinate                */
  526. /*     LONG    y;           = y Co-ordinate                */
  527. /*     LONG    cx;           = Window    Width                */
  528. /*     LONG    cy;           = Window    Height                */
  529. /*                                    */
  530. /*     Upon Exit:                            */
  531. /*                                    */
  532. /*     CreateStdWindow = NULL :    Error Occurred,    No Window Created    */
  533. /*               = > 0  :    Frame Window Handle            */
  534. /*                                    */
  535. /* --------------------------------------------------------------------    */
  536.  
  537. HWND CreateStdWindow(HWND hwndParent, ULONG flStyle, ULONG flCreateFlags,
  538.              PSZ pszClientClass, PSZ pszTitle, ULONG styleClient,
  539.              HMODULE hmod, ULONG idResources, PHWND phwndClient,
  540.              LONG x, LONG y, LONG cx, LONG cy)
  541.  
  542. {
  543. HWND   hwndFrame;           /* Frame Window Handle        */
  544. POINTL aptl[2];               /* Point Translation    Array        */
  545.  
  546. if ( !(hwndFrame = WinCreateStdWindow(hwndParent, flStyle, &flCreateFlags,
  547.                       pszClientClass, pszTitle,    styleClient,
  548.                       hmod, idResources, phwndClient)) )
  549.    return((HWND)NULL);
  550.  
  551. if ( !(flCreateFlags & FCF_SHELLPOSITION) )
  552.    {
  553.    aptl[0].x = x;
  554.    aptl[0].y = y;
  555.    aptl[1].x = cx;
  556.    aptl[1].y = cy;
  557.    WinMapDlgPoints(HWND_DESKTOP, aptl, 2UL, TRUE);
  558.    WinSetWindowPos(hwndFrame, HWND_TOP,    aptl[0].x, aptl[0].y,
  559.            aptl[1].x, aptl[1].y, SWP_ACTIVATE |    SWP_SIZE | SWP_MOVE |
  560.            (ULONG)((flStyle & WS_VISIBLE) ? SWP_SHOW : 0UL));
  561.    }
  562.                /* Return back the window handle            */
  563. return(hwndFrame);
  564. }
  565.