asp.net实现检测电脑是否联网api程序

作者:袖梨 2022-06-25
 代码如下 复制代码

 

::Wininet := ..raw.loadDll("Wininet.dll") 
::InternetGetConnectedState = Wininet.api("InternetGetConnectedState","bool(int &flag,int

reserved )" )
 
isOnline = function(){
    return InternetGetConnectedState(0,0); 
}
 
io.open()
io.print( isOnline() )


using System.Runtime.InteropServices;
class inet
{
    [DllImport("wininet.dll")]
    extern static bool InternetGetConnectedState(out int connectionDescription, int

reservedValue);
    public bool isOnline()
    {
        int flag = 0;
        bool state = InternetGetConnectedState(out flag, 0);
        return state;
    }
}

相关文章

精彩推荐