Thanks for the info,
I will probably go with the send a general broadcast message rather than
finding all the windows. That's the sort of thing I was looking for but
couldn't remember the message I would need.
Thanks,
Phil.
From: "Alistair George" <[EMAIL PROTECTED]> AT tawa on 24/02/99 14:34 ZE12
To: Multiple recipients of list delphi <[EMAIL PROTECTED]> AT
tawa@kauripo@CCMAIL
cc: (bcc: Phillip Middlemiss/NZ Forest Research Institute/NZ)
Subject: [DUG]: Repainting the desktop
Had another idea; you will have to search for it though.
I have forgotten, but there is a Windows API call to get the handle of each
window on the desktop. By doing this, you will be able to refresh each one.
Sorry I misconstrued your requirement - thought you meant the desktop
itself.
Cheers,
Alistair
Have just checked on some info I have here maybe either/or helps:
The Windows 95 Desktop is overlayed with a ListView component.
You simply need to get a handle to the ListView. Example:
function GetDesktopListViewHandle: THandle;
var
S: String;
begin
Result := FindWindow('ProgMan', nil);
Result := GetWindow(Result, GW_CHILD);
Result := GetWindow(Result, GW_CHILD);
SetLength(S, 40);
GetClassName(Result, PChar(S), 39);
if PChar(S) <> 'SysListView32' then Result := 0;
end;
Once you have the handle, you can use the list view-related API
functions in the CommCtrl unit to manipulate the desktop. See
the LVM_xxxx messages in the Win32 online help.
For example the following line of code:
SendMessage(GetDesktopListViewHandle,LVM_ALIGN,LVA_ALIGNLEFT,0);
will align the desktop icons to the left side of the Windows 95 desktop.
I would run with the following even though you havent made a WinInI change:
SendMessage (the Windows API function) takes a number of parameters. First
is
the window handle;
HWND_BROADCAST is correct for that. Next comes the message,
WM_WININICHANGE. The
last two parameters
are the wParam and lParam (word parameter and long parameter) for the
message.
For this particular message, the
wParam must be 0, and the lParam is the address of a string containing the
name
of the section that the changes were in. If
lParam is NIL (zero), it means the windows receiving this message shoudl
check
ALL sections for changes, but that's slow;
don't send 0 unless you've made changes in many sections.
SO it might go like this:
VAR
S : ARRAY[0..40] OF Char;
...
StrCopy(S, 'Desktop');
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, LongInt(@S));
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Had another idea; you will have to search for
it
though.</FONT></DIV>
<DIV><FONT face=Arial size=2>I have forgotten, but there is a Windows API
call to get the handle of each window on the desktop. By doing this, you
will be able
to refresh each one.</FONT></DIV>
<DIV><FONT face=Arial size=2>Sorry I misconstrued your requirement -
thought you
meant the desktop itself.</FONT></DIV>
<DIV><FONT face=Arial size=2>Cheers,</FONT></DIV>
<DIV><FONT face=Arial size=2>Alistair</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Have just checked on some info I have here
maybe
either/or helps:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT color=#800000 face=Arial size=2>The Windows 95 Desktop is
overlayed with a ListView component.<BR>You simply need to get a handle to
the ListView. Example:<BR> function GetDesktopListViewHandle:
THandle;<BR> var<BR> S:
String;<BR> begin<BR> Result := FindWindow('ProgMan',
nil);<BR> Result := GetWindow(Result, GW_CHILD);<BR> Result :=
GetWindow(Result, GW_CHILD);<BR> SetLength(S,
40);<BR> GetClassName(Result, PChar(S), 39);<BR> if PChar(S)
<> 'SysListView32' then Result := 0;<BR> end;<BR> <BR>Once
you have the handle, you can use the list view-related API<BR>functions in
the CommCtrl unit to manipulate the desktop. See<BR>the LVM_xxxx messages
in the Win32 online help. <BR> <BR>For example the following line of
code:<BR> <BR>SendMessage(GetDesktopListViewHandle,LVM_ALIGN,LVA_ALIGN
LEFT,
0);<BR> <BR>will
align the desktop icons to the left side of the Windows 95
desktop.</FONT></DIV> <DIV><FONT color=#800000 face=Arial
size=2></FONT> </DIV> <DIV><FONT color=#800000 face=Arial size=2><FONT
color=#000000>I would run with the following even though you havent made a
WinInI change:</FONT></FONT></DIV> <DIV><FONT color=#800000 face=Arial
size=2><FONT
color=#000000></FONT></FONT> </DIV>
<DIV><FONT color=#800000 face=Arial size=2><FONT color=#0000ff>SendMessage
(the Windows API function) takes a number of parameters. First is the
window handle; <BR>HWND_BROADCAST is correct for that. Next comes the
message, WM_WININICHANGE.
The last two parameters <BR>are the wParam and lParam (word parameter and
long parameter) for the message. For this particular message, the
<BR>wParam must be 0, and the lParam is the address of a string containing
the name of the section that the changes were in. If <BR>lParam is NIL
(zero), it means the windows receiving this message shoudl check ALL
sections for changes, but that's slow; <BR>don't send 0 unless you've made
changes in many
sections.</FONT></FONT></DIV>
<DIV><FONT color=#800000 face=Arial size=2><FONT
color=#0000ff></FONT></FONT> </DIV>
<DIV><FONT color=#800000 face=Arial size=2><FONT color=#0000ff>SO it might
go
like this:</FONT></FONT></DIV>
<DIV><FONT color=#800000 face=Arial size=2><FONT
color=#0000ff></FONT></FONT> </DIV>
<DIV><FONT color=#800000 face=Arial size=2><FONT color=#0000ff>VAR
<BR> S : ARRAY[0..40] OF Char;<BR> ...<BR> StrCopy(S,
'Desktop');<BR>
SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0,
LongInt(@S));<BR></FONT><BR></FONT></DIV></BODY></HTML>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz