Cool, GetTickCount() returns the time in milliseconds.
void run_demo()
{
unsigned long running_timer=0;
unsigned long demo_timer=GetTickCount();
int duration=30000; // aka 30 seconds.
while (1)
{
running_timer=GetTickCount();
clear_gfx_buffer( screen_buffer, 0 );
if ( (demo_timer + duration) <= running_timer )
{
image_pos_x=random_int(0,2);
demo_timer=running_timer;
}
}
}