?
Solved

Move Left...

Posted on 2004-08-28
4
Medium Priority
?
200 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 92 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 88 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 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