Well, I really don't know why it doesn't work.
All I have is this function that returns GetTopWindow(mwnd).
Then I try it in mIRC:
//echo -a $dll(test.dll,getactivehwnd,)
And it returns the same number every time I echo, no matter what window I am typing it in.