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

2016-01-29 17:40 30 1 收藏

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

【 tulaoshi.com - ASP 】

  发布于: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
 

来源:http://www.tulaoshi.com/n/20160129/1502425.html

延伸阅读
标签: Web开发
网站的建设及发展,已经涉及到国家的信息安全、新闻宣传、信息产业和文化传播、发展、信息化建设等众多重要方面。网站作为第四媒 体的代表逐渐在日趋激烈的媒介竞争中,无可争议地获得了自身的地位,其影响已全面而深刻地渗入到人们的政治、经济、文化、生活等各个 方面,成为新闻传播活动不可须臾离弃的手段和方式。我国的网络...
用Visual Basic访问数据库有许多可供选择的方案,但是选择那种方案更能使开发队伍和应用软件在今天处于有利位置并且适应将来的发展方向呢?这些解决方案各有什么特点?本文将说明这些问题,帮助使用VB5的用户和准备使用VB5的用户选择和决定哪种数据库访问方案对现在很有意义而且适应将来的应用程序。 当今,RDO2.0是Visual Basic访问关...
标签: 电脑入门
#! /bin/sh # Simple bandwidth limiter - [email]j@4u.net[/email] # Change this to your link bandwidth # (for cable modem, DSL links, etc. put the maximal bandwidth you can # get, not the speed of a local Ethernet link) REAL_BW='10Mbit' # Change this to the bandwidth you want to allocate to...
标签: 照片
一位纽西兰的街头摄影师 Sim Ahmed 为了想让大家都爱上摄影,于是在自己居住的城市张贴他自己的街头摄影作品,他印了约500张的照片,将每一张照片都表框,并且在拍摄那些照片的地点将这些照片贴在附近的墙上。自从他开始与他居住的城市分享他的街头摄影作品之后,开始陆陆续续收到陌生人email给他的感谢文,我想知道自己的照片能带给大家喜悦的...
标签: Web开发
伴随着网络的全球化普及,信息时代的到来,上网人数的日益聚增,信息大爆炸的时代到来。Internet作为一种新的载体和工具,在现实生活中的实用价值和意义也越来越高。网络作为一种新兴的媒体也备受人们的关注。 Internet的广泛应用给企业的发展带来巨大的市场价值,特别是网络的时效性、覆盖范围广等特点给企业的形象宣传、市场推广、...

经验教程

239

收藏

58
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部