Solved

Move Left...

Posted on 2004-08-28
4
193 Views
Last Modified: 2010-04-05
Hello, I have a HWND how can I set the left.

e.g
Form1.Left:= 100;
MyHWND.Left:= 100;

Thanks.
0
Comment
Question by:-Karamja-
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Colin_Dawson
ID: 11922113
You need to use the GetWindowPos and SetWindow pos API calls.

Call GetWindowPos to get all the position information for the window, then use SetWindowPos to move the window.  Changing the left parameter to 100 of course ;-)

0
 
LVL 4

Accepted Solution

by:
LMuadDIb earned 23 total points
ID: 11922127
use API "MoveWindow"

example:

procedure TForm1.Button1Click(Sender: TObject);
var
  FWnd: HWND;
  iLeft ,iTop,iWidth,iHeight : integer;
begin
  FWnd := form1.Handle;
  iLeft := 0; { or whatever }
  iTop:= 0;
  iWidth:= 100;
  iHeight := 100;
  MoveWindow(FWnd, iLeft ,iTop,iWidth,iHeight,true) ;
end;
0
 
LVL 2

Author Comment

by:-Karamja-
ID: 11922160
Thanks for the reply,

I dont want to beable to resize the window, Just move.
Would there be a way to get the current, Width & Height?
0
 
LVL 4

Assisted Solution

by:Colin_Dawson
Colin_Dawson earned 22 total points
ID: 11922231
oops, there's no get windowPos.
 Replace Handle with your HWND and this will work.


var
  lpRect: TRect;
begin
  GetWindowRect(Handle,lpRect);

  MoveWindow(Handle,100,
    lpRect.Top,
    lpRect.Right-lpRect.Left,
    lpRect.Bottom-lpRect.Top,
    True);
end;
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question