I am writing a program which needs to send commands to the RS-232 port to turn valves on and off. I have that part done, but now i need to be able to time it so that it will go automatically. This has to be exact to the millisecond. From what i've read I'm assuming that I need to use QueryPerformanceCounter/QueryPerformanceFrequency but I am having difficulties finding the syntax for these commands. Any help would be much appreciated. Thanks 