> > Is there a way to set the focus to the freshly opened graph window > > from within my program? (eg: open a graph window and define this as > > the foremost window, in front even of the opening program) > > > > Any help appreciated, thanks in advance > > Hmmm, I wrote the graph unit for win32 and I don't know an "official" > way, so I guess you've to modify the graph unit sources.
I have no idea if this will help or not, but if the original poster can either get the windows handle or find the handle from the class/title of the window, they can use Win API calls to gain focus. [I'm assuming this is a regular WinAPI window.] Something like: var h: Thandle; begin h := FindWindow( nil, 'Graph Window Title' ); //replace with your window title if ( h <> 0 ) then begin //bring the window to the front if not(SetForegroundWindow( h )) then writeln( 'Failed to bring window to front.' ); //give the window focus (i.e. remove focus from any controls) if not( SendMessage( h, WM_SETFOCUS, 0, 0 ) = 0 ) then writeln( 'Failed to set focus to window.' ); end else writeln('Window was not found.'); end; You can substitute the 'WM_SETFOCUS' part to use the handle of the actual control you wish to have focus, or leave it out and the default windows functionality will happen. Matt _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal