是否可以将我的应用程序作为默认的Internet浏览器

时间:2015-01-09 06:02:57

标签: vb.net internet-explorer

我正在尝试开发一个使用互联网浏览器的简单安全工具。是否有可能他们唯一的选择是使用我的已部署的应用程序在桌面上使用互联网浏览器图标,因为现在我只是将软件隐藏在我的驱动器中。

我使用的是这样一个简单的代码:

Private Sub login(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click

    Dim Username As String = "user"
    Dim Password As String = "pass"

    If txtusername.Text = Username And txtpassword.Text = Password Then
        Process.Start("iexplore.exe")
        Environment.Exit(0)
    Else
        MessageBox.Show("Invalid User Account!")
    End If
End Sub

我这样做是为了在他们使用浏览器之前它会有一个提示帐户。感谢。

1 个答案:

答案 0 :(得分:0)

你的方法并不理想但是为了回答你的问题,这里是快速而又非常肮脏的步骤:

  1. 创建一个阻止iexplore.exe进程执行的注册表项
  2. 打开记事本,粘贴下面的文本并将其保存为disallow.reg,然后双击该文件。

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
    "DisallowRun"=dword:00000001
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun]
    "1"="iexplore.exe"
    
    1. 添加一些代码,用于读取/更改注册表的值,以便在用户通过身份验证后允许IE再次运行

      My.Computer.Registry.SetValue(“HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ Explorer \ DisallowRun”,“1”,“”)

    2. ...你的其余代码就在这里

      同样,一旦应用程序关闭,您将值'iexplore.exe'设置为

      My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun","1", "iexplore.exe") 
      
相关问题