Solved

SetWindowPos

Posted on 2007-11-16
11
3,085 Views
Last Modified: 2008-03-17
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.
0
Comment
Question by:TonyJix
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 21

Expert Comment

by:developmentguru
ID: 20297957
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
 
LVL 19

Expert Comment

by:MerijnB
ID: 20298102
do you see this leftovers if you move your window manually?
0
 

Author Comment

by:TonyJix
ID: 20298228
No, not when I do it manually..
0
 
LVL 16

Accepted Solution

by:
CodedK earned 500 total points
ID: 20299211
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
 
LVL 16

Expert Comment

by:CodedK
ID: 20299275
Or after the SetWindowPos execute this :
SendMessage(HWND_BROADCAST,WM_WININICHANGE,0,0);
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:CodedK
ID: 20299295
Or use InvalidateRect or ...
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,0,SPIF_SENDCHANGE);

Thats all. I dont think that it will leave any traces now.
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 20299308
that's just a workaround though. The question is why this is happening at all, it just shouldn't.
0
 
LVL 16

Expert Comment

by:CodedK
ID: 20299368
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
 
LVL 16

Expert Comment

by:CodedK
ID: 20299381
I've seen this happen in Windows98.
0
 

Author Comment

by:TonyJix
ID: 20299405
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
 
LVL 16

Expert Comment

by:CodedK
ID: 20299414
Glad i've helped.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 79
calling Tcolordialog in dll make the form disappear 8 103
code issue 8 97
Performance of SQL statement 37 95
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
A short film showing how OnPage and Connectwise integration works.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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

11 Experts available now in Live!

Get 1:1 Help Now