Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

MW-Menu

 

Free Visual BASIC Newsletter

Features

Tips

Sample Code

Newsletters

Products

ActiveX

Cool Links

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Determine Whether The Show Extention Is On or NOT

In Windows NT/95/98 you can set whether a file has its extension shown to the user or not. If you want to find out whether the extension is turned on for a specified file then use the following function that may be a little quickly written, but it sure does the job.

Private Declare Function GetFileTitle Lib "comdlg32.dll" _

Alias "GetFileTitleA" (ByVal lpszFile As String, ByVal _

lpszTitle As String, ByVal cbBuf As Integer) As Integer

Private Function HasExtension(sFileName As String) As Long

Dim sTemp As String

Dim lTemp As Long

sTemp = String(1, 0)

lTemp = GetFileTitle(sFileName, sTemp, Len(sTemp))

If lTemp < 0 Then HasExtension = -1: Exit Function

sTemp = String(lTemp, 0)

Call GetFileTitle(sFileName, sTemp, Len(sTemp))

If (Left$(Right$(Left$(sTemp, lTemp - 1), 4), 1)) = "." Then

HasExtentsoin = 1

Else

HasExtentsion = 0

End If

End Function

Home

___________________________________________

Send Bugs, comments to the webmaster at webmaster@mwe.8m.com

Terms of Use

© 1999 MW Software, all rights reserved