Hello,

I'm a brand new WinAPI programmer trying to figure out the language, and I'm a bit stuck. I have the following scenario:

I am controlling a laboratory instrument via the instrument's operating software, which responds to Windows messages and sends back its own. I am therefore able to give a SendMessage instruction at any time and from any function, and then listen for the response via the message loop and WndProc (it sends back a WM_COPYDATA). I have tested my code and am able to both send and receive messages successfully. However, I'm trying to program the following function and can't figure out how:

(pseudocode):
x = 0
while x < 10
{
Send command #1 (set temperature to x).
Send command #2 (send me your status (via the message loop)).
while (status != ready and time elapsed < 1 minute) { wait }
x++
}

I can't figure out how to allow my function to receive the message from the message handler in real time. Is this even possible? If not, what is another approach I could use?