I would like to write a programming that mimics someone pushing and holding the ALT key on their keyboard. I would like to write a console program for this. The reason is that this will be used for another program so I need to have it so that when the other application has loaded (its a game) that the ALT key is pushed down. Would this be possible?

I have written some pseudocode for what I think might work but I am not sure if this is the right approach:

do
flag = true //sets an invinate loop
send alt key command to windows
printf "the program has loaded"
printf "launch the game to see the results!"
while flag = true continue


basically i think all i need is a while loop that is contantly "sending" the ALT key to the computer. Would this be correct? If so how would I actually code this?

Thanks