
EVENT_MSG event; /* allocate space for an event message 
*/
draw_screen(); /* put up your window */
for(;;)
	{
	/* receive the message from QNX Windows */
	GetEvent(0, &event, sizeof(EVENT_MSG));

	/* extract the message type, and act appropriately */
	switch(Event(&event))
		{
		case CLICK: /* somebody clicked the mouse */
			do_something();
			continue;

		case QUIT: /* the user wants to quit */
		case TERMINATED: /* the server is being shut down */
			shutdown();
			exit(0); 
		}
	}

