Article View: borland.public.cppbuilder.nativeapi
Article #8341Re: How to Place at Window at X/Y-Position?
From: Ed Mulroy [TeamB]
Date: Mon, 01 Nov 2004 15:22
Date: Mon, 01 Nov 2004 15:22
32 lines
1686 bytes
1686 bytes
By the handle I assume that you have the HWND of the window.
Assuming that you have two variables, xnew and ynew, which are the new top and left positions for the window then something like this should do it.
------------
bool WINAPI NewWinPos(HWND hwnd, int xnew, int ynew)
{
bool result = false;
RECT r;
if (IsWindow(hwnd) &&
GetWindowRect(hwnd, &r))
{
int wide = r.right - r.left;
int high = r.bottom - r.top;
result =
(MoveWindow(hwnd, xnew, ynew,
wide, high, TRUE) != 0);
}
return result;
}
------------
. Ed
> PC Hua wrote
> If I only have the handle of a showing
> window how can I set it to a certain
> X/Y-position?
Technical Details
Message-ID:
<418662da$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<opsgra7cxppmxkmr@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,86d67b2eb1b4a88c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Sender: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Reply-To: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Subject: Re: How to Place at Window at X/Y-Position? Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 24.74.175.102 References: <opsgra7cxppmxkmr@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <418662da$1@newsgroups.borland.com> Date: 1 Nov 2004 08:22:50 -0700 X-Trace: newsgroups.borland.com 1099326170 207.105.83.66 (1 Nov 2004 08:22:50 -0700) Lines: 33 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail