如何用api函数创建文件关联啊 希望能给出主要的部分就行了 特别是参数,我的那个参数又错误,不知道其直是多少了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.vbaspnew.com/ziyuan/w/api/49.txt 搜索了一下,找到这个贴子:http://search.csdn.net/Expert/topic/528/528176.xml?temp=.5120813 Const HKEY_CLASSES_ROOT = &H80000000Const HKEY_CURRENT_USER = &H80000001Const HKEY_LOCAL_MACHINE = &H80000002Const HKEY_USERS = &H80000003Const HKEY_CURRENT_CONFIG = &H80000004Private Const REG_SZ = 1 ' Unicode nul terminated stringPrivate Const REG_NONE = 0 ' No value typePrivate Const REG_EXPAND_SZ = 2 ' Unicode nul terminated stringPrivate Const REG_BINARY = 3 ' Free form binaryPrivate Const REG_DWORD = 4 ' 32-bit numberPrivate Const REG_DWORD_BIG_ENDIAN = 5 ' 32-bit numberPrivate Const REG_MULTI_SZ = 7Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As LongPrivate 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 LongPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Form_Load()Command1.Caption = "建立关联"Command2.Caption = "退出"Label1.Caption = "扩展名"Label2.Caption = "默认值"Label3.Caption = "类型描述"Label4.Caption = "shell"Label5.Caption = "打开命令"Label6.Caption = "打印命令"Label7.Caption = "文件图标"Text1.Text = ".abc"Text3.Text = "abc源文件"Text2.Text = "abcfile"Text4.Text = "open"Text5.Text = "c:\windows\notepad.exe %1"Text6.Text = "c:\windows\notepad.exe /p %1"Text7.Text = "D:\自编程序\系统信息\wmp.ico"End SubPrivate Sub Command1_Click()Dim hkey As Longhkey = HKEY_CLASSES_ROOTRegSetValue hkey, Text1.Text, REG_SZ, Text2.Text, 7RegSetValue hkey, Text2.Text, REG_SZ, Text3.Text, 9RegSetValue hkey, Text2.Text & "\" & "shell", REG_SZ, Text4.Text, 5RegSetValue hkey, Text2.Text & "\" & "shell\open\command", REG_SZ, Text5.Text, Len(StrConv(Text5.Text, vbFromUnicode)) + 1RegSetValue hkey, Text2.Text & "\" & "shell\print\command", REG_SZ, Text6.Text, Len(StrConv(Text6.Text, vbFromUnicode)) + 1RegSetValue hkey, Text2.Text & "\" & "defaulticon", REG_SZ, Text7.Text, Len(StrConv(Text5.Text, vbFromUnicode)) + 1MsgBox ""RegCloseKey hkeyEnd Sub自己对应该一下。 使用过mapx的朋友能给点代码吗关于mapx5控件怎么加载图片? 累计问题 关于用vb执行sql存储过程并获取返回值 怎么让运行时的窗体直接最大化? 高分求购源代码 listbox的问题 求高手分析一个注册码算法的含义 Alicky快过来。 http://expert.csdn.net/Expert/topic/1910/1910955.xml?temp=.1330225 关于向EXCEL导出数据的一些讨论,欢迎UP! 这样在程序中 使用拼写检查? 高分求房地产销售,房地产查询系统方面的VB源代码 再沉痛悼念我的贴子
http://search.csdn.net/Expert/topic/528/528176.xml?temp=.5120813
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000004
Private Const REG_SZ = 1 ' Unicode nul terminated string
Private Const REG_NONE = 0 ' No value type
Private Const REG_EXPAND_SZ = 2 ' Unicode nul terminated string
Private Const REG_BINARY = 3 ' Free form binary
Private Const REG_DWORD = 4 ' 32-bit number
Private Const REG_DWORD_BIG_ENDIAN = 5 ' 32-bit number
Private Const REG_MULTI_SZ = 7
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey 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
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Command1.Caption = "建立关联"
Command2.Caption = "退出"
Label1.Caption = "扩展名"
Label2.Caption = "默认值"
Label3.Caption = "类型描述"
Label4.Caption = "shell"
Label5.Caption = "打开命令"
Label6.Caption = "打印命令"
Label7.Caption = "文件图标"
Text1.Text = ".abc"
Text3.Text = "abc源文件"
Text2.Text = "abcfile"
Text4.Text = "open"
Text5.Text = "c:\windows\notepad.exe %1"
Text6.Text = "c:\windows\notepad.exe /p %1"
Text7.Text = "D:\自编程序\系统信息\wmp.ico"
End Sub
Private Sub Command1_Click()
Dim hkey As Long
hkey = HKEY_CLASSES_ROOT
RegSetValue hkey, Text1.Text, REG_SZ, Text2.Text, 7
RegSetValue hkey, Text2.Text, REG_SZ, Text3.Text, 9
RegSetValue hkey, Text2.Text & "\" & "shell", REG_SZ, Text4.Text, 5
RegSetValue hkey, Text2.Text & "\" & "shell\open\command", REG_SZ, Text5.Text, Len(StrConv(Text5.Text, vbFromUnicode)) + 1
RegSetValue hkey, Text2.Text & "\" & "shell\print\command", REG_SZ, Text6.Text, Len(StrConv(Text6.Text, vbFromUnicode)) + 1
RegSetValue hkey, Text2.Text & "\" & "defaulticon", REG_SZ, Text7.Text, Len(StrConv(Text5.Text, vbFromUnicode)) + 1
MsgBox ""
RegCloseKey hkey
End Sub
自己对应该一下。