Hmm, I'd prefer to have this nonblocking... at least do something to prevent the window from locking up (don't remember what helps here, but sleep(10) might do the trick and run the window's message loop)