program RegEdit_TPS;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Windows, Messages, Registry, ShlObj;
procedure ProvideExplorerOptions;
var
Progman: HWND;
function EnumDefViewProc(Wnd: HWND;
out DefView: HWND): BOOL;
stdcall;
begin
PostMessage(Wnd, WM_Command, 28931, 0);
Result := true;
end;
begin
Progman := FindWindow('
ProgMan',
nil);
If Progman <> 0
then
begin
PostMessage(ProgMan, WM_Command, 28931, 0);
EnumChildWindows(ProgMan, @EnumDefViewProc, 0);
end;
Progman := FindWindow('
WorkerW',
nil);
If Progman <> 0
then
begin
PostMessage(ProgMan, WM_Command, 28931, 0);
EnumChildWindows(ProgMan, @EnumDefViewProc, 0);
end;
end;
var RegObj : TRegistry;
R : Integer;
begin
try
{ TODO -oUser -cConsole Main : Code hier einfügen }
Writeln ('
Providing Explorer Options...');
Writeln ('
Please wait...');
RegObj := TRegistry.Create;
RegObj.RootKey := $80000001;
if RegObj.OpenKey ('
\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', false)
then
begin
RegObj.WriteInteger ('
HideFileExt',0);
// hier weitere Optionen festlegen...
//
// Versuche ueber Settingchange
Sendmessage(HWND_BROADCAST,WM_SETTINGCHANGE,0,0);
SendMessageTimeout( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0,
SMTO_ABORTIFHUNG, 100, @R );
// Versuch ueber SHChangeNotify
SHChangeNotify(SHCNE_GLOBALEVENTS,SHCNF_NOTIFYRECURSIVE + SHCNF_FLUSH,
nil,
nil);
SHChangeNotify(SHCNE_ASSOCCHANGED,0,
NIL,
NIL);
// Versuch ueber SystemParametersInfo
SystemParametersInfo (SPI_SETDESKWALLPAPER,0,
nil,SPIF_SENDWININICHANGE);
// ... und das Explorerfenster mit allen Unterfenstern ansprechen
ProvideExplorerOptions;
end;
RegObj.Free;
except
on E:
Exception do
begin
Writeln ('
Error during search');
Writeln(E.ClassName, '
: ', E.
Message);
end;
end;
end.