[問題] 觸發
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
bcb
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
Button1, Button2
Button1按下去時,
會while(Repeat){...}
Button2按下去時,
會送出Repeat=0,想跳出while
想問一下, 除了這樣寫外, 還有其它更快觸發的寫法嗎?
因為...
可以達到中斷沒錯,
但都會等while做完"一次"才會中斷, 不會即時中斷
while一次時間久的話, 就會發現Button2會lag更久才中斷
想問怎麼寫會達到loop又快中斷?
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (CheckBox1->Checked == true){
while(Repeat){
Application->ProcessMessages();
MSComm1->Output = TBuff;
}
Repeat = 1;
}else {
MSComm1->Output = TBuff;
}
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Repeat = 0;
}
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.251.230.192
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1445678314.A.DF6.html
※ 編輯: GooLoo (111.251.230.192), 10/24/2015 17:19:16
→
10/25 01:17, , 1F
10/25 01:17, 1F
推
10/25 22:10, , 2F
10/25 22:10, 2F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章
-3
13