SetWindowPos

Hello,

When I do:
SetWindowPos(Wnd, 0, 100, 100, 500, 500, 0);

Then the window moves and resizes fine. The only problem is that the old position and size of the window are still visible. Kind of burnt into the desktop. If I move another app window over it, it will start to disappear.
Why won't it disappear after using SetWindowPos() ?

Greetings.
TonyJixAsked:
Who is Participating?
 
CodedKConnect With a Mentor Commented:
You could send a desktop refresh :


procedure RefreshDesktop;
var c1 : cardinal;
begin
  c1:=FindWindowEx(FindWindowEx(windows.FindWindow('Progman','Program Manager'),0,'SHELLDLL_DefView',''),0,'SysListView32','');
  PostMessage(c1,WM_KEYDOWN,VK_F5,0);
  PostMessage(c1,WM_KEYUP,VK_F5,1 shl 31);
end;

Open in new window

0
 
developmentguruPresidentCommented:
I would try using the SetWindowPos type function built into your Delphi form and see if there is a difference.

SetBounds(Left, Top, Width, Height);

It sounds like there is an issue with your Windows setup though.

Let me know if that helps.
0
 
MerijnBSr. Software EngineerCommented:
do you see this leftovers if you move your window manually?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
TonyJixAuthor Commented:
No, not when I do it manually..
0
 
CodedKCommented:
Or after the SetWindowPos execute this :
SendMessage(HWND_BROADCAST,WM_WININICHANGE,0,0);
0
 
CodedKCommented:
Or use InvalidateRect or ...
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,0,SPIF_SENDCHANGE);

Thats all. I dont think that it will leave any traces now.
0
 
MerijnBSr. Software EngineerCommented:
that's just a workaround though. The question is why this is happening at all, it just shouldn't.
0
 
CodedKCommented:
Yes it shouldnt.
Tony Jix can you see if this happens in a new application ?

It doesnt happen in my machine not in yours too i guess MerijnB. I cant replicate it, so the asker must provide further info. In the meantime this could be a graphic card issue or even the system needs a reboot. I dont thing that this is a workaround but a must have after resizing a window to cover all the situations if this program is going to run in other pcs.

0
 
CodedKCommented:
I've seen this happen in Windows98.
0
 
TonyJixAuthor Commented:
It's an app in a VMWARE OS. I guess that's why... I was looking for a fix. With VMWARE that's just the way it is. Thank you.
0
 
CodedKCommented:
Glad i've helped.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.