whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

52 Visitors Online


 
...change the size and position of foreign windows?
Autor: Henning Huncke
Homepage: http://www.kraftda.de
[ Print tip ]  

Tip Rating (12):  
     


{
Diese function liefert True wenn das ändern der Fenstergröße erfolgreich war
und False wenn nicht. (True=changed with success False=changes couldn't be performed)

Handle = Fenster Handle von dem zu bearbeitendem Fenster
dHeight = Die neue Höhe des Fensters
dWidth = Die neue Breite des Fensters
ScreenCenter = Wenn True dann wird das Fenster auch direkt Zentriert wenn
False bleibts an der alten Position
}

function ChangeSize(Handle: Hwnd; dHeight, dWidth: Integer; ScreenCenter: Boolean): Boolean;
var
P: TRect;
begin
Result := False;
try
GetWindowRect(Handle, P); {Der TRect var die Positions daten des Fenster übergeben}
if ScreenCenter then
MoveWindow(Handle, (Screen.Width-dWidth) div 2, (Screen.Height-dHeight) div 2, dHeight, dWidth, True)
else
MoveWindow(Handle, P.Left, P.Top, dHeight, dWidth, True);
except
Result := False;
end;
Result := True;
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners