I sent more or less this info yesterday, but it bounced (my ISP doesn't like redirecting email from my work IP address!!!).... I think the CreateProcess idea is better than this one, but just in case...
Assuming you have a window with the caption 'Untitled - Notepad' (running notepad.exe will get you this) Function ResizeWindow(const Caption: pchar; const AWidth, Aheight: integer): boolean; var h: Thandle; r: Trect; Width, Height, Left, Top: integer; begin Result := False; h := FindWindow( nil, Caption ); if (h <> 0) and GetWindowRect(h, r) then begin Width := (r.right - r.left); Height := (r.Bottom - r.top); Left := r.Left; Top := r.Top; if (Awidth = Width) and (Aheight = height) then exit; //don't bother if the size is same Windows.MoveWindow(h, Top, Left, Width, Height, true); //DOH!! Silly api name M$ 2 API's would have been //easier... If you want to move the window you //must track it's size too!!!! Result := True; //<--- only return true is we do a resize.... You could put this above the line // "if (Awidth..." if you want to know that you 'found the window' but // didn't necessarily move it. end; end; Therefore: Resizewindow('Untitled - Notepad', 10, 10); > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Bernhard Steffen > Sent: 28 February 2003 12:07 > To: [EMAIL PROTECTED] > Subject: [fpc-pascal]Re: How to resize window under win32? > (Jeff Pohlmeyer) > > > > > I'm launching another program from Freepascal program > through "exec" > > > I need code that can set the position and size of the started > > > program. > > > > I haven't used Windows in a while, but I think you need > > CreateProcess() instead of WinExec() > > [...] > > If you have access to the source code of the launched > program, you can use the SetWindowPos function to set the > window position and size from within that program. > > Bernhard > > -- > [EMAIL PROTECTED] > http://www.bernhard-steffen.de/ > > _______________________________________________ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/f> pc-pascal > _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal