OSDinit

Creates OSDialog object, initializes all related resources and returns the descriptor of OSDialog object it has created.

HANDLE OSDInit(bool bOpenFileDialog,
        const char* lpszSection,
        const char* lpszInitialDir,
        const char* lpszDefExt,
        const char* lpszFileName,
       unsigned int dwFlags,
        const char* lpszFilter,
               HWND hParentWnd);  

Parameters

  • bOpenFileDialog - Specifies dialog mode:
    Value Description
    TRUE Creates "open image file" dialog.
    FALSE Creates "save image file" dialog.
  • lpszSection - Specifies registry key to save OSDialog settings:
    HKEY_CURRENT_USER\Software\fCoder\OSDialog\\.
  • lpszInitialDir - Points at the string that ends in NULL; allows specifying the initial folder.
  • lpszInitialDir - Points at the string that ends in NULL; allows specifying the initial folder.
  • lpszDefExt - Default file extension. If the user does not specify the extension in file name box, the default extension is automatically added to the file name. If this parameter is set to NULL, no extension is added to the file name.
  • lpszFileName Initial file name displayed in file name box. If the parameter is set to NULL, no name is displayed.
  • dwFlags Combination of bit flags at allows changing appearance and behavior of the dialog window. See description of these flags in OPENFILENAME structure section in Platform SDK.
  • lpszFilter A set of string pairs specifying filters applied to the list of files. If such filters are applied, the dialog only displays files that comply with applied filter conditions. The first string in the pair describes the filter, the second string describes its file extension. You can specify several extensions using ";" as a delimiter. Filter sample: static char BASED_CODE szFilter[] = "Files Bitmap (*.bmp)|*.bmp|" "Files JPEG (*.jpg)|*.jpg|" "Files TIFF (*.tif;*.tiff)|*.tif; *.tiff|" "All files (*.*)|*.*||";
  • pParentWnd Points at the parent or owner window object.
  • Returned value Returns HANDLE descriptor of the created OSDialog object or NULL in erroneous case.

Notes

This function should always be called first. The descriptor it creates is passed over for usage in other library functions. The object is destroyed by OSDRelease function.

Sample:

HANDLE hDialog = »
OSDInit(true, "SDITEST", 0, 0, 0, 0, 0, AfxGetMainWnd()->m_hWnd);

* The red "ยป"mark in the sample means line folding. This is only done for convenient display of the source code at our website. When reproducing this sample, delete this mark and join the code lines separated by it.

See also: