|
Получение списка расширений, зарегистрированных в системе файлов |
|
|
Данный пример выведет в ваш ComboBox список всех расширений файлов, зарегистрированных в системе Private Declare Function RegOpenKey Lib "advapi32.dll" Alias
"RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long)
As Long
Private Declare Function RegEnumKey Lib "advapi32.dll" Alias
"RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As
String, ByVal cbName As Long) As Long
Function GetAllExts() As Variant
Dim lRegResult As Long
Dim lCounter As Long
Dim hCurKey As Long
Dim strBuffer As String
Dim lDataBufferSize As Long
Dim intZeroPos As Integer
lCounter = 0
lRegResult = RegOpenKey(&H80000000, "", hCurKey)
Do
lDataBufferSize = 255
strBuffer = String(lDataBufferSize, " ")
lRegResult = RegEnumKey(hCurKey, lCounter, strBuffer, lDataBufferSize)
If lRegResult = 0& Then
intZeroPos = InStr(strBuffer, Chr$(0))
If Left(strBuffer, 1) = "." Then
Form1.Combo1.AddItem LCase(Right(strBuffer, Len(strBuffer) - 1))
End If
lCounter = lCounter + 1
Else
Exit Do
End If
Loop
End Function
Private Sub Form_Load()
GetAllExts
End Sub
|
|
|
|
|
|
|