1
我已經使用連接到串行端口的繼電器開關將照相閃光燈連接到我的電腦。下面的代碼使發閃光以4赫茲閃爍閃爍10次:閃光燈實現的基本對話框輸入
#include <windows.h>
//Initialise Windows module
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
//Define the serial port precedure
HANDLE hSerial;
int freq = 4;
int iterations = 10;
int x;
for (x = 0; x < iterations; x++)
{
//Fire the flash (open the serial port, and immediately close it)
hSerial = CreateFile("COM1",GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
CloseHandle(hSerial);
//Sleep in between flashes for specified duration
Sleep (1000/freq);
}
return 0;
}
如何在程序開始執行的對話框,使用戶可以輸入「頻率」和「重複」的價值?
請刪除這個問題,因爲你重新在http://stackoverflow.com/questions/6255682/simple-value-input-in-a-windows-program – CharlesB 2011-06-06 17:29:05