将你的网站设置为客户的信任站点--VB方案

终归尘土l

终归尘土l

2016-01-29 17:40

将你的网站设置为客户的信任站点--VB方案,将你的网站设置为客户的信任站点--VB方案
  发布于:2002-1-1
将程序生成EXE,文件名即为你的网站名称

Const HKEY_CLASSES_ROOT = -2147483648#
Const HKEY_CURRENT_USER = -2147483647#
Const HKEY_LOCAL_MACHINE = -2147483646#
Const HKEY_USERS = -2147483645#


Const REG_SZ = 1& '字符串值
Const REG_BINARY = 3& '二?制值
Const REG_DWORD = 4& 'DWORD 值


Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, ByRef phkResult As Long) As Long

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey 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 Sub Form_Load()
Call SetTrustedSite(App.EXEName)
Unload Me
End Sub

'//Set Trust site
Private Function SetTrustedSite(ByVal StrSiteName As String)
On Error GoTo Errhandle
Dim nKeyHandle, KeyValue, Iresult As Long
Dim StrkeyPath As String
StrkeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet SettingsZoneMapDomains"
StrkeyPath = StrkeyPath & SplitSiteName(StrSiteName)
KeyValue = 2
Call RegCreateKey(HKEY_CURRENT_USER, StrkeyPath, nKeyHandle)
Iresult = RegSetValueEx(nKeyHandle, "http", 0, REG_DWORD, KeyValue, 4)
If Iresult = 0 Then
MsgBox "You have accept http://" & StrSiteName & " as your Trusted Site!"
Else
MsgBox "Fail add http://" & StrSiteName & " as your Trusted Site!"
End If
Call RegCloseKey(nKeyHandle)
Exit Function
Errhandle:
MsgBox "Fail add http://" & StrSiteName & " as your Trusted Site!"
End Function

'// Split SiteName
'// "A.B.C.D.E" ---- "D.E/A.B.C"
'// "A.B.C.D" ---- "C.D/A.B"
'// "A.B.C" ---- "B.C/A"
'// "A.B" ---- "A.B"
'// "A" ---- "A"
Private Function SplitSiteName(ByVal StrSiteName As String) As String
Dim ArraySiteName
Dim IntArrayLen, I As Integer
Dim StrSplitSite As String

ArraySiteName = Split(StrSiteName, ".")
IntArrayLen = UBound(ArraySiteName)

If IntArrayLen 1 Then
StrSplitSite = ArraySiteName(IntArrayLen - 1) & "." & ArraySiteName(IntArrayLen) & ""
For I = 0 To IntArrayLen - 2
If I = 0 Then
StrSplitSite = StrSplitSite & ArraySiteName(I)
Else
StrSplitSite = StrSplitSite & "." & ArraySiteName(I)
End If
Next
SplitSiteName = StrSplitSite
Else
SplitSiteName = StrSiteName
End If

End Function
 
展开更多 50%)
分享

猜你喜欢

将你的网站设置为客户的信任站点--VB方案

ASP
将你的网站设置为客户的信任站点--VB方案

将你的网站设置为客户的信任站点--WSH方案

ASP
将你的网站设置为客户的信任站点--WSH方案

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

将你的网站从MySQL改为PostgreSQL

MySQL mysql数据库
将你的网站从MySQL改为PostgreSQL

别让网站登录将你的用户拒之门外

平面设计 海报设计 广告设计 画报设计 签名设计 服装设计 名片设计 画册设计 版式设计 商标设计
别让网站登录将你的用户拒之门外

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

页面锁定的锁定方案--多客户环境下VB数据库编程之(7)

编程语言 网络编程
页面锁定的锁定方案--多客户环境下VB数据库编程之(7)

为你的VB程序程序加密(VB新手)

编程语言 网络编程
为你的VB程序程序加密(VB新手)

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

《NBA 2K16》游戏得分点及跑战术解析

《NBA 2K16》游戏得分点及跑战术解析

用EasyMailObject组件处理Exchange邮件源代码(1)

用EasyMailObject组件处理Exchange邮件源代码(1)
下拉加载更多内容 ↓