如题!!
解决方案 »
- winrar压缩文件夹
- 急:API方式调用DLL,有个例子可以,Copy到我新建的工程里不行,为什么?
- vb_如何锁定文本框中的内容?
- 重大问题,关于控件的修改!
- 请教: 关于format()函数的参数问题
- 将数据库中的一列如时间的文本转换成时间格式
- 打印预览
- 在form1_dbclick和form1_click事件中写了各自的事件处理程序,但为什么程序总是执行form1_click事件处理程序?
- 高手帮忙呀,怎么调用输入法的软键盘呀??
- ActiveReports 安装不上啊 急急急急急急急急
- 俺编写了一个播放VCD的DLL.拿出来和大家分享.快来啊,别错过!!!
- 关于SYBASES数据库向MDB中导入表的问题,请高手指教,谢谢
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 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 ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Const REG_DWORD As Long = 4
Private Const REG_SZ = 1
Private Const HKEY_CURRENT_USER = &H80000001
Private Sub SetSurrogate(address As String, Port As String) '设置代理服务器的地址跟端口
Dim str As String
Dim SubKey As String
Dim hKey As Longstr = Trim(address) & ":" & Trim(Port)
SubKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\"
RegCreateKey HKEY_CURRENT_USER, SubKey, hKey
RegSetValueEx hKey, "ProxyServer", 0, REG_SZ, ByVal str, LenB(StrConv(str, vbFromUnicode)) + 1
RegCloseKey hKey
End SubPrivate Sub SetEnable()
Dim SubKey As String
Dim hKey As LongSubKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\"
RegCreateKey HKEY_CURRENT_USER, SubKey, hKey
RegSetValueEx hKey, "ProxyEnable", 0, REG_DWORD, 1&, 4
RegCloseKey hKey
End SubPrivate Sub SetDisable()
Dim SubKey As String
Dim hKey As LongSubKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\"
RegCreateKey HKEY_CURRENT_USER, SubKey, hKey
RegSetValueEx hKey, "ProxyEnable", 0, REG_DWORD, 0&, 4
RegCloseKey hKey
End SubPrivate Sub Command1_Click()'使代理服务器可用
SetSurrogate "192.168.1.199", "200"
SetEnable
End SubPrivate Sub Command2_Click()'使代理服务器不可用
SetDisable
End Sub