That's strange. It compiles fine here (after having to add #include "stdafx.h" and changing some TCHARs to char*), but when I call window() from mIRC (/echo -a $dll(windowtest.dll,window,1)) it doesn't return the stuff I copied into the data buffer (I had added lstrcpyA(data, "test"); return 3;). Besides, no window shows up.

I'm starting to think it might be the project type/settings. Normally I create a regular, empty Win32 dll, but I couldn't compile the code with that so I created an MFC DLL and it worked fine. What kind of project do you use? (shared, statically linked, extension dll, etc)