home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / bmp3.zip / SUPPORT.C < prev    next >
C/C++ Source or Header  |  1995-10-18  |  20KB  |  579 lines

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