• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

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

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 21次 | 进入软件测试论坛讨论

领测软件测试网 将程序生成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 = "Software\Microsoft\Windows\CurrentVersion\Inte.net Settings\ZoneMap\Domains\"
          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

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网