Link to home
Start Free TrialLog in
Avatar of TonyJix
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.
Avatar of MerijnB
MerijnB
Flag of Netherlands image

what kind of window is it? Is it one of yourself of from another app?
Avatar of TonyJix
TonyJix

ASKER

Another app.
Avatar of TonyJix

ASKER

I know the Handle, and then I do:

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)?
Avatar of TonyJix

ASKER

^ This is doing fine with many Apps... just this one App won't move... So i figured maybe theres an alternative.
Avatar of TonyJix

ASKER

Anyone an alternative to SetWindowPos?
like MerijnB posted some apps don't allow to resize (see Constraints property of form in delphi)

ziolko.
Avatar of TonyJix

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.
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?
Avatar of TonyJix

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
Avatar of TonyJix

ASKER

Not moving the winwdow...
Avatar of TonyJix

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?
Avatar of TonyJix

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.
from where you get that application
Using Microsoft's Spy++ check the message flow while using mouse and using Code.
Avatar of TonyJix

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.
Avatar of TonyJix

ASKER

Is it possible to move window with a SendMessage command?
ASKER CERTIFIED SOLUTION
Avatar of Hardi
Hardi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial