如何防止出现新的连接网络位置对话框(家庭,工作,公共)? [英] How to prevent the Network Location dialog (home, work, public) appearing for new connections?

查看:772
本文介绍了如何防止出现新的连接网络位置对话框(家庭,工作,公共)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个软件,它使用USB 3G适配器来连接,如果连接不存在互联网。



在软件加载,它检测在互联网是否可用,如果没有,则创建(经由RAS)的一个拨号连接,然后拨打它



如果发生这种情况,第一次,网络位置对话框出现,要求用户选择无论是家庭,工作或公共。



反正是有,我可以编程设置连接的网络位置,甚至告诉Windows不显示对话框并自动将位置设置为公开?



干杯



加文



编辑:对于ScottM

 公共BOOL连接(布尔monitorSignalUpdates)
{
RasPhoneBook RPB =新RasPhoneBook();
rpb.Open(真);
如果(!rpb.Entries.Contains(3G连接))
{
rpb.Entries.Add(RasEntry.CreateBroadbandEntry(3G连接,RasDevice.GetDeviceByName(华为手机连接 - 3G调制解调器,RasDeviceType.Modem),真));
}
_rd =新RasDialer();
_rd.EntryName =3G连接;
_rd.PhoneNumber =* 99#;

{
_rd.Dial();
如果(monitorSignalUpdates)
{
_queryPort.DataReceived + =新SerialDataReceivedEventHandler(_queryPort_DataReceived);
}
返回真;
}
赶上(异常前)
{
INT I = 99;
}
返回FALSE;
}


解决方案

此注册表项控制是否视窗会提示(家庭/工作/公共):



HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff



HTTP: //technet.microsoft.com/en-us/library/gg252535%28v=ws.10%29.aspx



您可以随时,开启关闭从系统托盘上的新网络的通知:)



如果你能做到这一点,我敢肯定有一个注册表黑客和/或做一个PowerShell API相同的:



http://technet.microsoft.com/en-us/library/cc725831%28v=ws.10%29.aspx


I've written a piece of software that uses an USB 3G Dongle to connect to the internet if a connection doesn't already exist.

When the software loads, it detects whether the internet is available and if not, then creates a dial up connection (via RAS) and then dials it.

If this happens for the first time, the network location dialog comes up asking the user to select whether it's home, work or public.

Is there anyway, I can either programatically set the network location of a connection, or even tell windows not to show the dialog and automatically set the location to public?

Cheers

Gavin

Edit: For ScottM

public bool Connect(bool monitorSignalUpdates)
{
    RasPhoneBook rpb = new RasPhoneBook();
    rpb.Open(true);
    if (!rpb.Entries.Contains("3G Connection"))
    {
        rpb.Entries.Add(RasEntry.CreateBroadbandEntry("3G Connection", RasDevice.GetDeviceByName("HUAWEI Mobile Connect - 3G Modem", RasDeviceType.Modem), true));
    }
    _rd = new RasDialer();
    _rd.EntryName = "3G Connection";
    _rd.PhoneNumber = "*99#";
    try
    {
        _rd.Dial();
        if (monitorSignalUpdates)
        {
            _queryPort.DataReceived += new SerialDataReceivedEventHandler(_queryPort_DataReceived);
        }
        return true;
    }
    catch (Exception ex)
    {
        int i = 99;
    }
    return false;
}

解决方案

This registry entry controls whether Windows will prompt for ("Home/Work/Public"):

HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff

http://technet.microsoft.com/en-us/library/gg252535%28v=ws.10%29.aspx

You can always ""Turn off Notification on New Networks" from system tray :)

And if you can do that, I'm sure there's a registry hack and/or a PowerShell API for doing the same:

http://technet.microsoft.com/en-us/library/cc725831%28v=ws.10%29.aspx

这篇关于如何防止出现新的连接网络位置对话框(家庭,工作,公共)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆