Solved

Move Left...

Posted on 2004-08-28
4
191 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
Comment Utility
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
Comment Utility
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-
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now