VB °æ (¾«»ªÇø)
·¢ÐÅÈË: zxfsnow (½ÄϵÄÑ©), ÐÅÇø: VB
±ê Ìâ: ÔõÑùΪÎļþ½¨Á¢¹ØÁª
·¢ÐÅÕ¾: ¹þ¹¤´ó×϶¡Ïã (2000Äê06ÔÂ18ÈÕ12:01:18 ÐÇÆÚÌì), תÐÅ
·¢ÐÅÈË: zkboy (ССÄñ), ÐÅÇø: VisualBasic
±ê Ìâ: Re: ÔõÑùΪÎļþ½¨Á¢¹ØÁª£¿
·¢ÐÅÕ¾: BBS ˮľÇ廪վ (Thu Jun 15 20:10:23 2000)
¸øÄã¸öÀý×Ó½è¼øÒ»ÏÂ
Ä£¿é£º
Declare Function RegCreateKey& Lib "advapi32.DLL" Alias "RegCreateKeyA" (By
Val hKey&, ByVal lpszSubKey$, lphKey&)
Declare Function RegSetValue& Lib "advapi32.DLL" Alias "RegSetValueA" (ByVal
hKey&, ByVal lpszSubKey$, ByVal fdwType&, ByVal lpszValue$, ByVal dwLength&
)
Public Const ERROR_SUCCESS = 0&
Public Const ERROR_BADDB = 1&
Public Const ERROR_BADKEY = 2&
Public Const ERROR_CANTOPEN = 3&
Public Const ERROR_CANTREAD = 4&
Public Const ERROR_CANTWRITE = 5&
Public Const ERROR_OUTOFMEMORY = 6&
Public Const ERROR_INVALID_PARAMETER = 7&
Public Const ERROR_ACCESS_DENIED = 8&
Global Const HKEY_CLASSES_ROOT = &H80000000
Public Const MAX_PATH = 256&
Public Const REG_SZ = 1
´°Ì壺
Dim sKeyName As String 'Holds Key Name in registry.
Dim sKeyValue As String 'Holds Key Value in registry.
Private Const ERROR_SUCCESS = 0&
Private Const ERROR_BADDB = 1&
Private Const ERROR_BADKEY = 2&
Private Const ERROR_CANTOPEN = 3&
Private Const ERROR_CANTREAD = 4&
Private Const ERROR_CANTWRITE = 5&
Private Const ERROR_OUTOFMEMORY = 6&
Private Const ERROR_INVALID_PARAMETER = 7&
Private Const ERROR_ACCESS_DENIED = 8&
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const MAX_PATH = 256&
Private Const REG_SZ = 1
Private Sub Command1_Click()
Dim sKeyName1 As String, sKeyValue1 As String, i As Integer, temp As
String
Dim ret& 'Holds error status if any from API call
s.
Dim lphKey& 'Holds created key handle from RegCreate
Key.
sKeyName1 = "MyApp" & sKeyName
sKeyValue1 = UCase(Mid(sKeyName, 2))
sKeyValue1 = sKeyValue1 & " Îļþ"
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName1, lphKey&)
ret& = RegSetValue&(lphKey&, "", REG_SZ, sKeyValue1, 0&)
'This creates a Root entry called .BAR associated with "MyApp".
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
ret& = RegSetValue&(lphKey&, "", REG_SZ, sKeyName1, 0&)
'This sets the command line for "MyApp".
sKeyValue = sKeyValue & " %1"
ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName1, lphKey&)
ret& = RegSetValue&(lphKey&, "shell\open\command", REG_SZ, sKeyValue,
MAX_PATH)
End
End Sub
Private Sub Form_Load()
Form1.Caption = "Association"
sKeyName = InputBox("Please input the type of file to be associated,Èç.l
og (±ØҪʱÐèҪȫ·¾¶)", "Extention Name", ".*")
sKeyValue = InputBox("Please input the program to associate:", "Program
Name", "*.exe")
End Sub
ñ
»¶Ó·ÃÎÊÎÒµÄftp ftp£º//202.112.139.6
--
ÒԿƼÆΪ±¾,ÒÔ²úÒµ±¨¹ú!
³¬Ô½×ÔÎÒ,·ÉÔ¾ÎÞÏÞ!
¡ù À´Ô´:¡¤¹þ¹¤´ó×϶¡Ïã bbs.hit.edu.cn¡¤[FROM: 202.118.235.249]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º3.063ºÁÃë