Solved

Move Left...

Posted on 2004-08-28
4
195 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-
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

696 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