HFILE OpenFile (HWND Owner_window)
{
  FILEDLG Dialog = {                                                           /* File dlg control structure  */
                    .cbSize         = sizeof (FILEDLG),                        /* Set size of control struct  */
                    .fl             = FDS_OPEN_DIALOG |                        /* Set dialog type to "Open"   */
                                      FDS_CENTER      |                        /* Centered in parent window   */
                                      FDS_HELP_BUTTON,                         /* Include help button         */
                    .pszTitle       = NULL,                                    /* Use default title bar text  */
                    .pszOKButton    = NULL,                                    /* Use default button text     */
                    .pfnDlgProc     = NULL,                                    /* Use standard dlg proc       */
                    .hmod           = 0,
                    .idDlg          = 0,
                    .pszIType       = NULL,                                    /* No initial type setting     */
                    .ppszITypeList  = NULL,                                    /* No list of types            */
                    .pszIDrive      = NULL,                                    /* No initial drive setting    */
                    .ppszIDriveList = NULL                                     /* No list of drives           */
                   };

  WinFileDlg (Owner_window, &Dialog);                                          /* Invoke file dialog          */

  HFILE File_to_open = NULLHANDLE;                                             /* File handle                 */

  if (Dialog.lReturn == DID_OK)                                                /* Check result                */
  {
    USHORT Action = 0;                                                         /* Action indicator            */

    DosOpen (Dialog.szFullFile,                                                /* Open returned file name     */
             &File_to_open,                                                    /* File handle                 */
             &Action,                                                          /* Action indicator            */
             0,                                                                /* File size not applicable    */
             0,                                                                /* File attribute ignored      */
             OPEN_ACTION_OPEN_IF_EXISTS,                                       /* Open file if it exists      */
             OPEN_ACCESS_READWRITE    |                                        /* Non-shared, read-write      */
             OPEN_SHARE_DENYREADWRITE |
             OPEN_FLAGS_FAIL_ON_ERROR,
             NULL);
  }

  return File_to_open;                                                         /* Return file handle          */
}
