This is bad! You can't access the UI thread from any other thread, it's an inherent limitation of Win32. Doing what you're doing here might work some of the time, but it's not a good idea at all.

Always check InvokeRequired and use Invoke when needed!