Solved

Refreshing the desktop

Posted on 2000-03-17
10
171 Views
Last Modified: 2010-04-04
I have an application that set the work area of the desktop (Windows API). So I would like to redraw all opened windows.

Did anybody know how to do that ?

Thanks

Gustavo
0
Comment
Question by:voxel
  • 5
  • 4
10 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 2629322
I'm not sure what you want. Can you please say it again a bit more detailed?
0
 

Author Comment

by:voxel
ID: 2629609
Edited text of question.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2629628
Redraw or resize?

To enumerate all windows use "EnumWindows". To resize the windows use "SetWindowPos". To refresh them use "InvalidateRect".
0
 

Author Comment

by:voxel
ID: 2629861
and how I use the EnumWindows function ?
0
 
LVL 17

Expert Comment

by:inthe
ID: 2629911
hi,
here a cpuple of waus to refresh desktop:

SendMessage(FindWindow('Progman', 'Program Manager'), WM_COMMAND, 106597,
0);

or:

procedure RefreshDesktop;
var
 c : cardinal;
begin
c:=FindWindowEx(FindWindowEx(FindWindow('Progman','Program Manager'),0,'SHELLDLL_DefView',''),0,'SysListView32','');
  PostMessage(c,WM_KEYDOWN,VK_F5,0); PostMessage(c,WM_KEYUP,VK_F5,1 shl 31);
end;
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.

 

Author Comment

by:voxel
ID: 2629930
I think you didn't understand my question.
0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 2630883
If you have D4 or D5 you can download my free unit "enumStuff" from my homepage

http://beam.to/madshi

Look at the function "GetWindowList".

If you have D2/D3, do something like this:

function EnumWindowsProc(window: dword; lParam: integer) : bool; stdcall;
begin
  result := true;
  // Windows calls this function one time for each top level window
  // so here use GetWindowPos/SetWindowPos with "window"
  // or/and InvalidateRect with "window"
end;
 
  EnumWindows(@EnumWindowsProc, 0);

Regards, Madshi.
0
 

Author Comment

by:voxel
ID: 2631510
I still didn't find how to resize windows to fit in the new work area set by my application.

But i'm giving you the points.

thanks
0
 

Author Comment

by:voxel
ID: 2631513
Do you know how to resize all windows to fit the new work area (desktop) set by my application ?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2632119
Well, for each window do this:

(1) Call "GetWindowRect(window)" to get the window position/size.
(2) See, whether this rectangle fits in your work area. If not, change the rectangle, so that it does fit. Then call "SetWindowPos(window, ...)" to realize the new rectangle.
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
Delphi 10 Seattle Dataset Actions 5 79
how do i create updater to My Activex application? 3 79
How to debug For loops? 3 46
Delphi...Split view - idea? 1 42
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

16 Experts available now in Live!

Get 1:1 Help Now