 |
 |
 |
 |
 |
 |
 |
 |
 |
|
|
clsCommDialogs
This class permits you to invoke Unicode Windows dialogs like OpenFile, SaveFile, ShowFonts, ShowDir, ShorColor.
PS: Call the InitDialogs method one time before use the class
ShowOpen and ShowSave functions needs in input a parameter called "lFlags". This can be any combination of values present in the eOpenFileFlags enum (see details).
Note that flags OFN_EXTENSIONDIFFERENT and OFN_NOREADONLYRETURN are used only in Output. Pass a variable in the lFlags parameter to check them after a call to ShowOpen and ShowSave.
Methods:
- InitDialogs - Initialize the Common Dialogs for use, call this method only one time for your application. - ShowColor - Display the color common dialog - ShowOpen - Opens the OpenFile common dialog |
 |
|
|
|
|
|
 |
|
|
Definition: Public Function ShowOpen( _ ByVal hwndParent As Long, _ ByVal sFilter As String, _ ByVal sTitle As String, _ ByRef lFlags As eOpenFileFlags, _ ByVal sStartDir As String, _ Optional ByVal sDefExt As String = "", _ Optional ByVal sDefaultFile As String = "") As String
Parameters: - hwndParent - handle of the calling window (Me.hWnd) - sFilter - file filter, a list of (Description - chr(0) - extension - chr(0)) ex: sFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0) & _ "Windows Applications (*.exe; *.com)" & Chr(0) & "*.exe;*.com" & Chr(0) - sTitle - the title of the dialog - lFlags (IN/OUT) - see here - sStartDir - starting folder - sDefExt - default extension for the file if not specified (used with flag OFN_EXTENSIONDIFFERENT) - sDefaultFile - default filename
from MSDN: Pointer to a buffer that contains the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name if the user fails to type an extension. This string can be any length, but only the first three characters are appended. The string should not contain a period (.). If this member is NULL and the user fails to type an extension, no extension is appended. | |
 |
|
|
|
|
|
 |
|
- ShowSave - Opens the SaveFile common dialog
|
 |
|
|
|
|
|
 |
|
|
Definition:
Public Function ShowSave( _ ByVal hwndParent As Long, _ ByVal sFilter As String, _ ByVal sTitle As String, _ ByRef lFlags As eOpenFileFlags, _ ByVal sStartDir As String, _ ByVal sDefaultFile As String, _ ByRef iFilterIndex As Integer, _ Optional ByVal sDefExt As String = "") As String
Parameters: - hwndParent - handle of the calling window (Me.hWnd) - sFilter - file filter, a list of (Description - chr(0) - extension - chr(0)) ex: sFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0) & _ "Windows Applications (*.exe; *.com)" & Chr(0) & "*.exe;*.com" & Chr(0) - sTitle - the title of the dialog - lFlags (IN/OUT) - see here - sStartDir - starting folder - sDefaultFile - the file displayed when the dialog starts - iFilterIndex (IN/OUT) - index of the type chosed in the sFilter list (in the above example is 1 for "All Files", 2 for "Windows Applications") - sDefExt - default extension for the file if not specified (used with flag OFN_EXTENSIONDIFFERENT)
from MSDN: Pointer to a buffer that contains the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name if the user fails to type an extension. This string can be any length, but only the first three characters are appended. The string should not contain a period (.). If this member is NULL and the user fails to type an extension, no extension is appended. | |
 |
|
|
|
|
|
 |
|
- ShowFont - Opens the Choose Font common dialog |
 |
|
|
|
|
|
 |
|
|
Definition:
Public Function ShowFont( _ ByRef sFontName As String, _ ByRef lFontColor As Long, _ ByRef bFontBold As Boolean, _ ByRef bFontItalic As Boolean, _ ByRef bFontUnderline As Boolean, _ ByRef bFontStrikeout As Boolean, _ ByRef iSize As Integer) As Boolean
Parameters: Every parameter is in IN/OUT direction | |
 |
|
|
|
|
|
 |
|
- ShowDir - Opens the Choose Directory common dialog |
 |
|
|
|
|
|
 |
|
- ShowFontEx - Opens the Choose Font common dialog (this has more options) |
 |
|
|
|
|
|
 |
|
|
Definition:
Public Function ShowFontEx( _ CurFont As Font, _ Optional PrinterDC As Long = -1, _ Optional Owner As Long = -1, _ Optional Color As Long = vbBlack, _ Optional MinSize As Long = 0, _ Optional MaxSize As Long = 0, _ Optional flags As EChooseFont = 0) As Boolean
Parameters: - CurFont: this is the current font, in/out - PrinterDC: this is the HDC of the selected printer if you need it - Owner: this is the handle of the owner window - Color: this is the font color - MinSize, MaxSize: min and max selectable font size - Flags (MSDN): | |
 |
|
|
|
|
|
 |
|
|
|
CF_APPLY
Causes the dialog box to display the Apply button. You should provide a hook procedure to process WM_COMMAND messages for the Apply button. The hook procedure can send the WM_CHOOSEFONT_GETLOGFONT message to the dialog box to retrieve the address of the LOGFONT structure that contains the current selections for the font.
CF_ANSIONLY
This flag is obsolete. To limit font selections to all scripts except those that use the OEM or Symbol character sets, use CF_SCRIPTSONLY. To get the Windows 3.1 CF_ANSIONLY behavior, use CF_SELECTSCRIPT and specify ANSI_CHARSET in the lfCharSet member of the LOGFONT structure pointed to by lpLogFont.
CF_BOTH
Causes the dialog box to list the available printer and screen fonts. The hDC member is a handle to the device context (or information context) associated with the printer. This flag is a combination of the CF_SCREENFONTS and CF_PRINTERFONTS flags.
CF_TTONLY
Specifies that ChooseFont should only enumerate and allow the selection of TrueType fonts.
CF_EFFECTS
Causes the dialog box to display the controls that allow the user to specify strikeout, underline, and text color options. If this flag is set, you can use the rgbColors member to specify the initial text color. You can use the lfStrikeOut and lfUnderline members of the LOGFONT structure pointed to by lpLogFont to specify the initial settings of the strikeout and underline check boxes. ChooseFont can use these members to return the user's selections.
CF_ENABLEHOOK
Enables the hook procedure specified in the lpfnHook member of this structure.
CF_ENABLETEMPLATE
Indicates that the hInstance and lpTemplateName members specify a dialog box template to use in place of the default template.
CF_ENABLETEMPLATEHANDLE
Indicates that the hInstance member identifies a data block that contains a preloaded dialog box template. The system ignores the lpTemplateName member if this flag is specified.
CF_FIXEDPITCHONLY
Specifies that ChooseFont should select only fixed-pitch fonts.
CF_FORCEFONTEXIST
Specifies that ChooseFont should indicate an error condition if the user attempts to select a font or style that does not exist.
CF_INITTOLOGFONTSTRUCT
Specifies that ChooseFont should use the LOGFONT structure pointed to by the lpLogFont member to initialize the dialog box controls.
CF_LIMITSIZE
Specifies that ChooseFont should select only font sizes within the range specified by the nSizeMin and nSizeMax members.
CF_NOOEMFONTS
Same as the CF_NOVECTORFONTS flag.
CF_NOFACESEL
When using a LOGFONT structure to initialize the dialog box controls, use this flag to selectively prevent the dialog box from displaying an initial selection for the font name combo box. This is useful when there is no single font name that applies to the text selection.
CF_NOSCRIPTSEL
Disables the Script combo box. When this flag is set, the lfCharSet member of the LOGFONT structure is set to DEFAULT_CHARSET when ChooseFont returns. This flag is used only to initialize the dialog box.
CF_NOSTYLESEL
When using a LOGFONT structure to initialize the dialog box controls, use this flag to selectively prevent the dialog box from displaying an initial selection for the font style combo box. This is useful when there is no single font style that applies to the text selection.
CF_NOSIZESEL
When using a LOGFONT structure to initialize the dialog box controls, use this flag to selectively prevent the dialog box from displaying an initial selection for the font size combo box. This is useful when there is no single font size that applies to the text selection.
CF_NOSIMULATIONS
Specifies that ChooseFont should not allow graphics device interface (GDI) font simulations.
CF_NOVECTORFONTS
Specifies that ChooseFont should not allow vector font selections.
CF_NOVERTFONTS
Causes the Font dialog box to list only horizontally oriented fonts.
CF_PRINTERFONTS
Causes the dialog box to list only the fonts supported by the printer associated with the device context (or information context) identified by the hDC member.
CF_SCALABLEONLY
Specifies that ChooseFont should allow only the selection of scalable fonts. (Scalable fonts include vector fonts, scalable printer fonts, TrueType fonts, and fonts scaled by other technologies.)
CF_SCREENFONTS
Causes the dialog box to list only the screen fonts supported by the system.
CF_SCRIPTSONLY
Specifies that ChooseFont should allow selection of fonts for all non-OEM and Symbol character sets, as well as the ANSI character set. This supersedes the CF_ANSIONLY value.
CF_SELECTSCRIPT
When specified on input, only fonts with the character set identified in the lfCharSet member of the LOGFONT structure are displayed. The user will not be allowed to change the character set specified in the Scripts combo box.
CF_SHOWHELP
Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button.
CF_USESTYLE
Specifies that the lpszStyle member is a pointer to a buffer that contains style data that ChooseFont should use to initialize the Font Style combo box. When the user closes the dialog box, ChooseFont copies style data for the user's selection to this buffer.
CF_WYSIWYG
Specifies that ChooseFont should allow only the selection of fonts available on both the printer and the display. If this flag is specified, the CF_BOTH and CF_SCALABLEONLY flags should also be specified. |
 |
|
|
|
|
|
|
 |
|
|
|
|
|
 | |