软件设置了开机自启动后,开机运行,软件里面有个WEB控件,控件打开一个网页(Navigate)。
但是有的时候会出现WEB控件“白屏”的问题,就是控件没有打开网页。
我查了下原因,是由于刚开机的时候,网络链接没有建立,这个时候我去打开网页就没有成功,而且这样还会导致整个网络卡住,就是我必须把软件关闭才可以上网,否则无法上网(用浏览器浏览也无法打开网页)。请问这有啥办法解决?

解决方案 »

  1.   

    使用下面的函数来判断当前网络状态,来控制是否执行打开动作。
    InternetGetConnectedState
    This function retrieves the connected state of the local system.BOOL InternetGetConnectedState(
    LPDWORD lpdwFlags,
    DWORD dwReserved);
    Parameters
    lpdwFlags 
    Address of an unsigned long integer variable where the connection description should be returned. This can be a combination of the following values: 
    Value Description 
    INTERNET_CONNECTION_CONFIGURED  Local system has a valid connection to the Internet, but it may or may not be currently connected.  
    INTERNET_CONNECTION_LAN  Local system uses a local area network to connect to the Internet.  
    INTERNET_CONNECTION_MODEM  Local system uses a modem to connect to the Internet.  
    INTERNET_CONNECTION_MODEM_BUSY  No longer used.  
    INTERNET_CONNECTION_OFFLINE  Local system is in offline mode.  
    INTERNET_CONNECTION_PROXY  Local system uses a proxy server to connect to the Internet.  
    INTERNET_RAS_INSTALLED  Local system has RAS installed.  
      

  2.   

    InternetGetConnectedState
    这个函数我用过,有BUG啊,在一些机子上用的是无线网络,网络已经连上了,可是返回值还是表示无网络状态
      

  3.   

    Bool IsNetworkAlive(
      LPDWORD lpdwFlags     // Specifies the type of network connection
    );
      

  4.   


    具体的路径与当前用户有关,但是这个路径可以用Shell的API查询到!具体是那个,我也忘记了!好像是先用调用SHGetSpecialFolderLocation生成一个SHELL对像
    再调用SHGetPathFromIDList得到路径名
      

  5.   

    zhouzhipen,可以给具体的代码吗?