1.这样试试.[DllImport("wininet.dll", CharSet=CharSet.Auto)]
public static extern InternetCheckConnection(
string lpszUrl,
[MarshalAs(UnmanagedType.U4)] int dwFlags,
[MarshalAs(UnmanagedType.U4)] int dwReserved);
public static extern InternetCheckConnection(
string lpszUrl,
[MarshalAs(UnmanagedType.U4)] int dwFlags,
[MarshalAs(UnmanagedType.U4)] int dwReserved);
int FLAG_ICC_FORCE_CONNECTION =0x00000001;
string tempUrl =null;
if(ConnectApi.InternetCheckConnection(tempUrl, FLAG_ICC_FORCE_CONNECTION, 0)== true)
{
MessageBox.Show("你以上线", "提示");
}
没成功!
另外第2个问题能否帮助解决一下!谢谢了!
不可能每100豪秒PING一次网站吧!那太夸张了。别到时人家来找我麻烦!555555555555
[DllImport("User32.dll")]
private static extern bool PostMessage(
int hWnd, // handle to destination window
int Msg, // message
char tempStr, // first message parameter
int lParam // second message parameter
);
调用:,,,,,,,,,,,
foreach(char tempChar in this.messageText)
{
char tempChar1 = Convert.ToChar((Convert.ToInt32(tempChar)& 0xFF));
PostMessage(Hwnd,WM_CHAR,tempChar1,0);//
}
可在2000,xp下却不能发送中文5555555555555。得到是乱码呀!请帮助!