VB °æ (¾«»ªÇø)
·¢ÐÅÈË: zxfsnow (½ÄϵÄÑ©), ÐÅÇø: VB
±ê Ìâ: Çó½Ì£ºvbÖÐÈçºÎÕÒµ½word²¢Æô¶¯£¿
·¢ÐÅÕ¾: ¹þ¹¤´ó×϶¡Ïã (2000Äê06ÔÂ18ÈÕ12:22:07 ÐÇÆÚÌì), תÐÅ
·¢ÐÅÈË: cedar (seek), ÐÅÇø: VisualBasic
±ê Ìâ: Re: Çó½Ì£ºvbÖÐÈçºÎÕÒµ½word²¢Æô¶¯£¿
·¢ÐÅÕ¾: BBS ˮľÇ廪վ (Thu Mar 25 21:01:42 1999)
¡¾ ÔÚ ababa (ìª) µÄ´ó×÷ÖÐÌáµ½: ¡¿
: ¡¾ ÔÚ cedar (seek) µÄ´ó×÷ÖÐÌáµ½: ¡¿
: ÎÒÏëÎʵľÍÊÇÔõô²é×¢²á±í£¬µÃµ½wordµÄ°²×°Â·¾¶£¿
ÎÒºÃÏóÒѾÌù¹ýÔõô¶Áȡע²á±íµÄÀý×ÓÁË°É£¬ÄǾÍÔÙÌùÒ»´Î¡£
¾¯¸æ£¬¸ÃÀý½öÌṩÓÃÓÚѧϰĿµÄ£¬ÈκÎÆäËûÓÃ;¾ùÊǽûÖ¹µÄ£¬¶øÇÒתÔØ»òÔÙ´ÎÉ¢·¢¾ù
ÐèµÃµ½ÊéÃæÐí¿É£¬·ñÔò¼´ÊÓΪÇÖȨ¡£
ÔÚʹÓÃÒ»¸ö×¢²á±í¹Ø¼ü×ÖÇ°£¬ÐèÒªÏÈÓÃRegCreateKeyEx´´½¨¸Ã¹Ø¼ü×Ö¡£Èç¹û¹Ø¼ü×Ö²»
´æÔÚ£¬Ôò RegCreateKeyEx ½«´´½¨Ò»¸öеĹؼü×Ö£¬¶øÈç¹û¹Ø¼ü×ÖÒѾ´æÔÚ£¬Ôò½«Ö»
¼òµ¥µØ½«Ëü´ò¿ª¡£ÀýÈçµ÷Óà RegCreateKeyEx ´´½¨¹Ø¼ü×Ö:
CreateRegKey = (RegCreateKeyEx(hKey £¬ SubKey & NewSubKey £¬ 0 £¬ "" £¬_
REG_OPTION_NON_VOLATILE £¬ KEY_ALL_ACCESS £¬SA £¬ _
phkResult £¬ Create) = ERROR_SUCCESS)
ÏÂÃæ¸ø³öÒ»¸ö²Ù×÷×¢²á±íµÄÄ£¿é£º
Option Explicit
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Public Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
Public Const KEY_QUERY_VALUE = &H1
Public Const KEY_SET_VALUE = &H2
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const KEY_CREATE_LINK = &H20
Public Const SYNCHRONIZE = &H100000
Public Const STANDARD_RIGHTS_ALL = &H1F0000
Public Const KEY_READ = ((STANDARD_RIGHTS_READ Or _
KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) _
And (Not SYNCHRONIZE))
Public Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or _
KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Public Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or _
KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY _
Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) _
And (Not SYNCHRONIZE))
Public Const KEY_EXECUTE = ((KEY_READ) And (Not SYNCHRONIZE))
Public Const ERROR_SUCCESS = 0&
Declare Function RegOpenKeyEx Lib "advapi32.dll" _
Alias "RegOpenKeyExA" (ByVal hKey As Long, _
ByVal lpSubKey As String, ByVal ulOptions As Long, _
ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" _
Alias "RegQueryValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Function sdaGetRegEntry(strKey As String, strSubKeys As String, strValName _ª
As String, lngType As Long) As String
' Demonstration of win32 API's to query the system registry
On Error GoTo sdaGetRegEntry_Err
Dim lngResult As Long, lngKey As Long
Dim lngHandle As Long, lngcbData As Long
Dim strRet As String
Select Case strKey
Case "HKEY_CLASSES_ROOT": lngKey = &H80000000
Case "HKEY_CURRENT_CONFIG": lngKey = &H80000005
Case "HKEY_CURRENT_USER": lngKey = &H80000001
Case "HKEY_DYN_DATA": lngKey = &H80000006
Case "HKEY_LOCAL_MACHINE": lngKey = &H80000002
Case "HKEY_PERFORMANCE_DATA": lngKey = &H80000004
Case "HKEY_USERS": lngKey = &H80000003
Case Else: Exit Function
End Select
If Not ERROR_SUCCESS = RegOpenKeyEx(lngKey, strSubKeys, 0&, KEY_READ, _
lngHandle) Then Exit Function
lngResult = RegQueryValueEx(lngHandle, strValName, _
0&, lngType, ByVal strRet, lngcbData)
strRet = Space(lngcbData)
lngResult = RegQueryValueEx(lngHandle, strValName, _
0&, lngType, ByVal strRet, lngcbData)
If Not ERROR_SUCCESS = RegCloseKey(lngHandle) Then lngType = -1&
sdaGetRegEntry = strRet
sdaGetRegEntry_Exit:
On Error GoTo 0
Exit Function
sdaGetRegEntry_Err:
lngType = -1&
MsgBox Err & "> " & Error$, 16, "GenUtils/sdaGetRegEntry"
Resume sdaGetRegEntry_Exit
End Function
--
¶ÀÁ¢ÔÆɽ ³¤·çÂúÐä
--
ÒԿƼÆΪ±¾,ÒÔ²úÒµ±¨¹ú!
³¬Ô½×ÔÎÒ,·ÉÔ¾ÎÞÏÞ!
¡ù À´Ô´:¡¤¹þ¹¤´ó×϶¡Ïã bbs.hit.edu.cn¡¤[FROM: 202.118.235.249]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º2.415ºÁÃë