C#查詢QQ狀態是否在線實例代碼如下:
private void button3_Click(object sender, System.EventArgs e)
{
if(textBox3.Text=="")
{
MessageBox.Show("必須填寫當前的查詢的QQ號碼!","錯誤提示!");
textBox3.Focus();
return;
} else {
string strQQ=textBox3.Text.Trim();
string strSearchQQ="http://wpa.qq.com/pa?p=1:" strQQ ":3";
string strQQStatus=GetWebContent(strSearchQQ).Substring(0,7);
switch(strQQStatus)
{
case "GIF89aK":MessageBox.Show(strQQ "不在線","QQ狀態提示!");
break;
case "GIF89aJ":MessageBox.Show(strQQ "在線","QQ狀態提示!");
break;
}
}
}