Yes, that's better. I've whittled it down to this...
Code:
void Snooks::FocusMIDIEditor(COMMAND_T* ct)
{
HWND editor = MIDIEditor_GetActive();
if (editor != NULL) {
DockWindowActivate(editor); // in case it's docked and not visible
FocusWindow(GetPianoView(editor));
}
}
... which you could eat your dinner off, if I do say so myself.