Originally Posted By: argv0
Obvious questions:

Have you tried your window creation code outside of a mIRC dll? Specifically: are you sure your window / threading code is working? I assume you posted this on an mIRC discussion board because you're having an issue that is specific to mIRC, and not just a general programming issue. If you haven't yet tested this, I suggest you do so first so we can narrow down and find out whether the problem is actually mIRC related.

If you have tried it and it crashes without mIRC, perhaps a better place to ask about threading / winapi code is on an MSDN / winapi discussion forum, not mIRC's forums.

I'm asking here because the problem is specific to mIRC. I've tried multiple complete window creation code examples taken from various different tutorials and tried them all to create standalone Windows applications. They worked perfectly. When I use the same code in an mIRC DLL, mIRC crashes. Now I can't say the same thing about what I posted earlier because I didn't test that as a standalone application, so I'll try it out first to confirm that it's not the problem (I'll reply to this thread when I've done this).

Originally Posted By: argv0

Threading + mIRC == bad. Instead of spawning a thread you should hook into mIRC's windowproc and do your processing from there to run mIRC's runloop along. Check MSDN on how to either subclass a window or hook into a windowproc.

Thanks, I made a quick look-up for 'wndproc hook' and google returned lots of promising results. I suppose I'll find enough information/examples on the subject. Looks like threading is a bit of trouble when mixed with IRC clients. I've had similar problems with Xchat. Hopefully hooking into mIRC's WndProc will save me the trouble.

Originally Posted By: argv0

Using "reinterpret_cast" smells fishy in general. Is this your code, or was it copied? You should probably stick to straight C.

Why are you passing a string literal as your thread parameter? Seems pointless...

reinterpret_cast was part of the copied code. Likewise, the CreateThread() call was copied as is. I guess the author of the code preferred to set the title of the window by passing it to CreateThread().