【发布时间】:2011-06-06 16:59:28
【问题描述】:
我使用连接到串行端口的继电器开关将摄影闪光灯连接到我的计算机。以下代码使频闪灯以 4Hz 频率闪烁 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;
}
如何在程序的开头实现对话框,以便用户可以输入'freq'和'iterations'的值?
【问题讨论】:
-
请删除您在stackoverflow.com/questions/6255682/…中重新表述的问题