I've tried both of these ways:
Code:
messagebox(0,PChar(S),'TEST',MB_OK or MB_TOPMOST or MB_SETFOREGROUND);
messagebox(ev.hWndMain,PChar(S),'TEST',MB_OK or MB_TOPMOST or MB_SETFOREGROUND);
neither show in front of the full screen game window. Are you using full screen exclusive mode? If so, do you switch this exclusive mode off before displaying the error function? Is there something I'm missing or is this just impossible to do from outside the engine?