in that case then i would suggest subclassing the MDI. Subclassing can lead to problems casueing mirc to crash but at least windows still lives. Sublassing is also a bit easier to do. You would simply create a dll function such as Mark or Init wich calls SetWindowLong with the GWL_WNDPROC constant. (note SetWindowLongPtr might be better if you think your dll will ever live on a 64bit version but i dont think that will happen soon).

Your window procedure may look a bit like this

LRESULT CALLBACK MyMDIProc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp)
{
switch(msg)
{
case WM_PARENTNOTIFY:
switch(LOWORD(wp)
{
case WM_CREATE:
//you can typecast lp to an HWND here (HWND)lp and get things such as the window text etc..
break;
case WM_DESTROY:
//same thing here.
break;
}
break;
}
return CallWindowProc(oldproc,hwnd,msg,wp,lp);
}

SetWindowLong will return the old window procedure. since theres only one MDI window and mirc is not threaded its ok to use a global WNDPROC (typecase the return result to a WNDPROC)

One thing to note a WndProc is a function called by windows not you (at least not firectly). Once you replace the wndproc windows will continue calling that procedure. If for example the use unloads the dll using /dll -u name then your proc is no longer valid however windows will still try to call it. This will crash mirc. You need to replace the old procedure when the dll unloads. Also if the window is closed (ie mirc is closed) your proc will receive the messages you cannot send that message back to mirc its no longer valid so you should replace the old procedure and then destroy the window yourself.

I know it sounds difficult but its not really. There are several good exmaples out there in fact you would be amazed at the number of mirc dll's that subclass some window.

Another hint to avoid problems finding the HWND of the MDI window i wouldnt use the ID value in spy with GetDlgItem. mIRC has been known to change her id's from build to build instead use the EnumChildWindows function and the GetClassName function. will will always be MDICLIENT


Have Fun smile