主题:[讨论]与txt文件进行关联的问题
Private Sub Command1_Click()
Dim result As Long
Dim hKeyID As Long
Dim skey As String
Dim skeyVal As String
skey = "txtfile/shell/open/command"
skeyVal = "C:\as\as.exe"
result = RegOpenKey(HKEY_CLASSES_ROOT, skeyVal, hKeyID)
If result = 0 Then
result = RegSetvalueEx(hKeyID, skey, 0&, REG_SZ, skeyVal, Len(skeyVal) + 1)
End If
End Sub
各位高手一看就知道了,原是与txt文件进行关联。在存在文件"C:\as\as.exe" 的情况下,
我运行以上程序后,并没有达到我要的效果,即只要打开扩展名为txt的文件,也附带运行了C:\as\as.exe,
(注:txt文件要能正常打开),请高手指点
Dim result As Long
Dim hKeyID As Long
Dim skey As String
Dim skeyVal As String
skey = "txtfile/shell/open/command"
skeyVal = "C:\as\as.exe"
result = RegOpenKey(HKEY_CLASSES_ROOT, skeyVal, hKeyID)
If result = 0 Then
result = RegSetvalueEx(hKeyID, skey, 0&, REG_SZ, skeyVal, Len(skeyVal) + 1)
End If
End Sub
各位高手一看就知道了,原是与txt文件进行关联。在存在文件"C:\as\as.exe" 的情况下,
我运行以上程序后,并没有达到我要的效果,即只要打开扩展名为txt的文件,也附带运行了C:\as\as.exe,
(注:txt文件要能正常打开),请高手指点