第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我該怎么去定義子程序和函數(shù)的問題??!急

我該怎么去定義子程序和函數(shù)的問題?。〖?/h1>
楊__羊羊 2021-08-18 20:15:37
代碼如下:Private Sub Command1_Click() '去掉警告信息Dim hkey As LongRegCreateKey HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\Winlogon", hkeyRegDeleteValue hkey, "legalnoticecaption"RegDeleteValue hkey, "LegalNoticeText"MsgBox "已完成設(shè)置,請重新啟動計算機!", , "提示信息"End SubPrivate Sub Command2_Click() '添加警告信息Dim hkey As LongRegOpenKeyEx HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion", 0, 0, hkeyRegCreateKey HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\Winlogon", hkeyDim a As Bytea = &O1RegSetValueEx hkey, "legalnoticecaption", 0, REG_SZ, ByVal Text1.Text, 255RegSetValueEx hkey, "LegalNoticeText", 0, REG_SZ, ByVal Text2.Text, 255MsgBox "已完成設(shè)置,請重新啟動計算機!", , "提示信息"End SubRegCreateKey為何顯示子程序或函數(shù)未定義??又如何定義?
查看完整描述

3 回答

?
慕尼黑的夜晚無繁華

TA貢獻1864條經(jīng)驗 獲得超6個贊

該函數(shù)是API函數(shù),將下面代碼保存為Reg.Bas就可以正常使用了。

'養(yǎng)成好習(xí)慣代表所有變量都需要先定義后使用
Option Explicit

'根鍵常數(shù)
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_USERS = &H80000003
Public Const HKEY_PERFORMANCE_DATA = &H80000004
Public Const HKEY_CURRENT_CONFIG = &H80000005
Public Const HKEY_DYN_DATA = &H80000006

'鍵值類型

Public Const REG_NONE = 0
Public Const REG_SZ = 1 '字符串值
Public Const REG_EXPAND_SZ = 2
Public Const REG_BINARY = 3 '二進制值
Public Const REG_DWORD = 4 'DWORD 值
Public Const REG_DWORD_BIG_ENDIAN = 5
Public Const REG_MULTI_SZ = 7

'----聲明有關(guān)注冊表API函數(shù) --Start----

'建立一個新的主鍵
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" _
( _
ByVal hKey As Long, _
ByVal lpSubKey As String, _
ByRef phkResult As Long _
) As Long

'打開一個主鍵 返回0代表打開成功,返回2代表打開失敗
Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
( _
ByVal hKey As Long, _
ByVal lpSubKey As String, _
ByRef phkResult As Long _
) As Long

'刪除一個主鍵
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" _
( _
ByVal hKey As Long, _
ByVal lpSubKey As String _
) As Long

'關(guān)閉一個主鍵 返回0代表關(guān)閉成功,6代表關(guān)閉失敗
Public Declare Function RegCloseKey Lib "advapi32.dll" _
( _
ByVal hKey As Long _
) As Long

'創(chuàng)建或改變一個鍵值,lpData應(yīng)由缺省的ByRef型改為ByVal型
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" _
( _
ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal Reserved As Long, _
ByVal dwType As Long, _
ByVal lpData As Any, _
ByVal cbData As Long _
) As Long

'查詢一個鍵值,lpData應(yīng)由缺省的ByRef型改為ByVal型
Public Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
( _
ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
ByRef lpType As Long, _
ByVal lpData As Any, _
ByRef lpcbData As Long _
) As Long

'刪除一個鍵值
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" _
( _
ByVal hKey As Long, _
ByVal lpValueName As String _
) As Long

'----聲明有關(guān)注冊表API函數(shù) End----



查看完整回答
反對 回復(fù) 2021-08-23
?
慕妹3242003

TA貢獻1824條經(jīng)驗 獲得超6個贊

在聲明里加上
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
其他幾個注冊表函數(shù)也要聲明

查看完整回答
反對 回復(fù) 2021-08-23
?
MMTTMM

TA貢獻1869條經(jīng)驗 獲得超4個贊

API函數(shù)還沒定義,不能直接調(diào)用
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 RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long



查看完整回答
反對 回復(fù) 2021-08-23
  • 3 回答
  • 0 關(guān)注
  • 350 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號