Office中国论坛/Access中国论坛

标题: 请huanghai兄帮个忙 [打印本页]

作者: binbow_z    时间: 2002-6-27 05:55
标题: 请huanghai兄帮个忙
将[HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options]
"ShowProgressDialog" = "Yes"
改为
[HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options]
"ShowProgressDialog" = "No"
目的:
在导入图片时不显示导入对话框
主要问题是你发布的注册表操作那些参数看不懂

作者: huanghai    时间: 2002-6-27 06:24
我曾发过一个例子,是照你发的修改注册的代码做的。
http://www.office-cn.net/bbs/dispbbs.asp?boardID=2&RootID=6096&ID=6096
我想这个代码改一下就行了。

'--------------------------
'用API将信息写在注册表指定的地方
'声明这三个API函数,它们分别是:RegSetValue、RegCreateKey、RegCloseKey,
'其作用是设置某一个主键的键值、创建一个主键、关闭对注册表主键的操作。

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 Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

'然后声明以下两个常数,要进行注册表写入的位置是在HKEY_LOCAL_MACHINE下,我们可以在VB自带的API文本查看器中找到这些常数的定义方法。
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const REG_SZ = 1

Private Sub chkAutorun_Click()
On Error Resume Next
   
'写注册表
Dim Ret2 As Long
'打开 HKEY_LOCAL_MACHINE 下的 software\microsoft\windows\currentVersion\run 主键
RegCreateKey HKEY_LOCAL_MACHINE, "software\microsoft\windows\currentVersion\Run", Ret2
'更改主键的“默认”项的值,也就是要开机运行的程序路径
If chkAutorun.Value = 1 Then
    RegSetValue Ret2, vbNullString, REG_SZ, App.Path & "\AutoRun.exe", 4
Else
    RegSetValue Ret2, vbNullString, REG_SZ, "", 4
End If

'关闭对主键的操作
RegCloseKey Ret2

End Sub

'--------------------------




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3