Parsi Coders

نسخه‌ی کامل: باز کردن فایل یونیکد با وی بی 6
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
تابع مذکور بدون شرح :

کد:
Function ShowOpenW(Optional Owner As Long = 0&, Optional inFilter As String = "All (*.*)| *.*") As String
    
        ........
        ........
        mFileSpec = ""
        m_FileExtIndexOnOpen = -1
        If mResult = 1 Then
             If typOpenFile.nFileOffset Then
                 i = InStr(typOpenFile.nFileOffset, typOpenFile.lpstrFile, vbNullChar) - 1&
                 If i = 0 Then
                     i = Len(typOpenFile.lpstrFile)
                 End If
             Else
                 i = Len(typOpenFile.lpstrFile))
             End If
            
               'Fill in mFileSpec
             If i > 0 Then
                   mFileSpec = Left$(typOpenFile.lpstrFile, i)
                     ' Note down for possible use of calling program, e.g. to set file pattern
                     ' "*.*" when a certain nFilterIndex has been selected.
                   m_FileExtIndexOnOpen = typOpenFile.nFilterIndex
             End If
        Else
             If mResult <> 0 Then              ' 0 is Cancel, else extended error
                  m_lExtendedError = CommDlgExtendedError()
             End If
        End If
          ' Return file spec
        ShowOpenW = mFileSpec
    End Function

نحوه استفاده :

کد:
If returnedFileSpec = "" then
        If cUniDialog.ExtendedErrorNum <> 0 then
                'Flag what is the error description
            cUniDialog.FlagErrMsg cUniDialog.ExtendedErrorNum
        End If
    End if