This sample program shows how to accomplish 3 tasks.
Submitted By:
Unknown
Rating:





(
Rate It)
Attribute VB_Name = "modFileOpenDialog"
' Disclaimer of Warranty:
' This software and the accompanying files are provided "as is"
' and without warranties as to performance of the software and
' the accompanying files or any other warranties whether expressed
' or implied. No warranty of fitness for a particular purpose
' is offered.
'
' You MAY NOT sell this software or it's source code.
' You MAY use this code in any way you find useful.
OPTION Explicit
'Function Declarations, type structure, and constants for the Open and Save
'common dialog boxes. For more information on these, consult the SDK,
'included with VB 4.0 Pro or Ent editions as part of the MSDN/VB Starter
'Kit.
Public TYPE OPENFILENAME
lStructSize AS LONG
hwndOwner AS LONG
hInstance AS LONG
lpstrFilter AS STRING
lpstrCustomFilter AS STRING
nMaxCustFilter AS LONG
nFilterIndex AS LONG
lpstrFile AS STRING
nMaxFile AS LONG
lpstrFileTitle AS STRING
nMaxFileTitle AS LONG
lpstrInitialDir AS STRING
lpstrTitle AS STRING
Flags AS LONG
nFileOffset AS INTEGER
nFileExtension AS INTEGER
lpstrDefExt AS STRING
lCustData AS LONG
lpfnHook AS LONG
lpTemplateName AS STRING
END TYPE
'Functions and constants for the common dialog boxes
Public DECLARE FUNCTION GetOpenFileName Lib "comdlg32.dll" _
ALIAS "GetOpenFileNameA" (pOPENFILENAME AS OPENFILENAME) AS LONG
Public DECLARE FUNCTION GetSaveFileName Lib "comdlg32.dll" _
ALIAS "GetSaveFileNameA" (pOPENFILENAME AS OPENFILENAME) AS LONG
'These constants must be declared since the Common Dialog control is not
'part of the project and, therefore, the intrinsic constants are not
'defined.
Public CONST OFN_READONLY = &H1
Public CONST OFN_OVERWRITEPROMPT = &H2
Public CONST OFN_HIDEREADONLY = &H4
Public CONST OFN_NOCHANGEDIR = &H8
Public CONST OFN_SHOWHELP = &H10
Public CONST OFN_ENABLEHOOK = &H20
Public CONST OFN_ENABLETEMPLATE = &H40
Public CONST OFN_ENABLETEMPLATEHANDLE = &H80
Public CONST OFN_NOVALIDATE = &H100
Public CONST OFN_ALLOWMULTISELECT = &H200
Public CONST OFN_EXTENSIONDIFFERENT = &H400
Public CONST OFN_PATHMUSTEXIST = &H800
Public CONST OFN_FILEMUSTEXIST = &H1000
Public CONST OFN_CREATEPROMPT = &H2000
Public CONST OFN_SHAREAWARE = &H4000
Public CONST OFN_NOREADONLYRETURN = &H8000
Public CONST OFN_NOTESTFILECREATE = &H10000
Public CONST OFN_NONETWORKBUTTON = &H20000
Public CONST OFN_NOLONGNAMES = &H40000 ' force no long names for 4.x modules
Public CONST OFN_EXPLORER = &H80000 ' new look commdlg
Public CONST OFN_NODEREFERENCELINKS = &H100000
Public CONST OFN_LONGNAMES = &H200000 ' force long names for 3.x modules