Автор вопроса: Boconon | Web-сайт:microsoft.com | ICQ: 216390557
Как ассоциировать определенные типы файлов с программой, задать их значки, как отловить передаваемые в программу данные (путь к файлу или группе файлов)?
Наверняка у кого-то есть примерчик, или хотя-бы объясните, какие ключи в реестре создавать и какие параметры обрабатывать?
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
' Return codes from Registration functions.
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1&
Const ERROR_BADKEY = 2&
Const ERROR_CANTOPEN = 3&
Const ERROR_CANTREAD = 4&
Const ERROR_CANTWRITE = 5&
Const ERROR_OUTOFMEMORY = 6&
Const ERROR_INVALID_PARAMETER = 7&
Const ERROR_ACCESS_DENIED = 8&
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const MAX_PATH = 260&
Private Const REG_SZ = 1
Private Sub Form_Load()
' связывание файла asc
Dim sKeyName As String
Dim sKeyValue As String
Dim ret&
Dim lphKey&
'Создание ключа "MyApp".
sKeyName = "Kuban Printer"
sKeyValue = "Kuban Printer"
ret& = RegCreateKey&HKEY_CLASSES_ROOT, sKeyName, lphKey&
ret& = RegSetValue&lphKey&, "", REG_SZ, sKeyValue, 0&
'Создание ключа, связанного с "MyApp".
sKeyName = ".asc"
sKeyValue = "Kuban Printer"
ret& = RegCreateKey&HKEY_CLASSES_ROOT, sKeyName, lphKey&
ret& = RegSetValue&lphKey&, "", REG_SZ, sKeyValue, 0&
'Коммандная линия для приложения"MyApp".
sKeyName = "Kuban Printer"
sKeyValue = "C:\Kuban_Printer\приложение.exe %1"
ret& = RegCreateKey&HKEY_CLASSES_ROOT, sKeyName, lphKey&
ret& = RegSetValue&lphKey&, "shell\open\command", REG_SZ, sKeyValue, MAX_PATH)
'============================