TonyJix
asked on
SetWindowPos alternative ?
Hi,
Sometimes SetWindowPos doesn't work. It doesn't move the program at all. Why? And is there an alternative to move it anyway?
Thank you.
Sometimes SetWindowPos doesn't work. It doesn't move the program at all. Why? And is there an alternative to move it anyway?
Thank you.
what kind of window is it? Is it one of yourself of from another app?
ASKER
Another app.
ASKER
I know the Handle, and then I do:
SetWindowPos(Wnd, 0, 100, 100, 0, 0, 0);
SetWindowPos(Wnd, 0, 100, 100, 0, 0, 0);
it's quite possible the window itself doesn't allow it to be resized.
Did you try this same code on another window (from another app)?
Did you try this same code on another window (from another app)?
ASKER
^ This is doing fine with many Apps... just this one App won't move... So i figured maybe theres an alternative.
ASKER
Anyone an alternative to SetWindowPos?
like MerijnB posted some apps don't allow to resize (see Constraints property of form in delphi)
ziolko.
ziolko.
ASKER
I don't want to resize, I want to move the App.
Should be possible, since my mouse is able to move the app too.
Should be possible, since my mouse is able to move the app too.
there is MoveWindow() but I doub't if that will work.
Are you sure that the coordinates you give to SetWindowPos() result in the same size as the window already has?
Are you sure that the coordinates you give to SetWindowPos() result in the same size as the window already has?
ASKER
Yes, I set the NOSIZE flag.
try like this
WinRect: TRect;
begin
GetWindowRect(wnd, WinRect);
MoveWindow(wnd, 100, 100, WinRect.Right-WinRect.Left , WinRect.Bottom-WinRect.Top , True);
end
WinRect: TRect;
begin
GetWindowRect(wnd, WinRect);
MoveWindow(wnd, 100, 100, WinRect.Right-WinRect.Left
end
ASKER
Not moving the winwdow...
ASKER
Maybe it's possible to move the mouse to the title bar of the window, let it hold the left mouse button, and then move the mouse to a position... Possible ?
How you get the window handle?
Is that window handle is correct?
ASKER
Yes, it is...
I even did GetWindowText to verify.
Besides, the code I use works with Notepad and many other Apps.. just not this one.
I even did GetWindowText to verify.
Besides, the code I use works with Notepad and many other Apps.. just not this one.
from where you get that application
Using Microsoft's Spy++ check the message flow while using mouse and using Code.
ASKER
The problem is not Delphi... it is Windows Vista setting...
On my laptop (Vista), the code won't move the window, but on this computer (Also Vista), it will move the App... weird... used to work on both.
On my laptop (Vista), the code won't move the window, but on this computer (Also Vista), it will move the App... weird... used to work on both.
ASKER
Is it possible to move window with a SendMessage command?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.