Okey,我檢查HWID的代碼工作正常,但當它傳遞的部分傳遞HWID在字符串它不工作,它返回空白。C#HWID檢查,它的工作,但不會傳遞到字符串
這是我的代碼使用
private void Form1_Load(object sender, EventArgs e)
{
string HWID = string.Empty;//creating a empty string
ManagementClass Management = new ManagementClass("win32_processor");//declaring the system management calss
ManagementObjectCollection MObject = Management.GetInstances();//decalring the system management object collection
foreach (ManagementObject mob in MObject)//having a foreach loop
{
if (string.IsNullOrEmpty(HWID))
{
HWID = mob.GetPropertyValue("processorID").ToString();//converting the HWID to string
break;
}
}
}
private void alphaBlendTextBox2_TextChanged(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
string loginUrl = "http://xxxxxx.xyz/customapi.php?username=" + alphaBlendTextBox1.Text + "&password=" + alphaBlendTextBox2.Text + "&hid=" + hwid + "&apiKey=APIKEYHERE&hid=" + HWID + "&ver=2";
使一切更清楚我嘗試做API調用,一切都很好,但是當涉及到HWID它的失敗。
//編輯
我一直失敗,如果有人williing改寫和修復代碼生病幸福..謝謝!
你讓HWID的Form1_Load的()方法的局部變量。刪除「字符串」。 –
@HansPassant是這樣的嗎? http://pastebin.com/unV8fqfC – CEED