Registriert seit: 14. Jul 2013
1 Beiträge
|
SSF_SHOWSUPERHIDDEN (Hide/Show protected system files) not working
24. Jan 2022, 12:38
Gentlemen, help me figure out why SSF_SHOWSUPERHIDDEN does not want to work on Hiding / Showing protected system files?
Code:
type
tagSHELLSTATEW = record
Data: DWORD;
{ fShowAllObjects: BOOL:1;
fShowExtensions: BOOL:1;
fNoConfirmRecycle: BOOL:1;
fShowSysFiles: BOOL:1;
fShowCompColor: BOOL:1;
fDoubleClickInWebView: BOOL:1;
fDesktopHTML: BOOL:1;
fWin95Classic: BOOL:1;
fDontPrettyPath: BOOL:1;
fShowAttribCol: BOOL:1;
fMapNetDrvBtn: BOOL:1;
fShowInfoTip: BOOL:1;
fHideIcons: BOOL:1;
fWebView: BOOL:1;
fFilter: BOOL:1;
fShowSuperHidden: BOOL:1;
fNoNetCrawling: BOOL:1;}
dwWin95Unused: DWORD;// Win95 only - no longer supported pszHiddenFileExts
uWin95Unused: UINT; // Win95 only - no longer supported cbHiddenFileExts
// Note: Not a typo! This is a persisted structure so we cannot use LPARAM
lParamSort: Integer;
iSortDirection: Integer;
version: UINT;
// new for win2k. need notUsed var to calc the right size of ie4 struct
// FIELD_OFFSET does not work on bit fields
uNotUsed: UINT;// feel free to rename and use}
Data2: DWORD;
{ fSepProcess: BOOL:1;
// new for Whistler.
fStartPanelOn: BOOL:1;
fShowStartPage: BOOL:1;
// new for Windows Vista
fAutoCheckSelect: BOOL:1;
fIconsOnly: BOOL:1;
fShowTypeOverlay: BOOL:1;
// If you need a new flag, steal a bit from from fSpareFlags.
// Also, keep SHELLFLAGSTATE and SHGetSettings in sync when adding new flags.
fSpareFlag: UINT:13;}
end;
SHELLSTATEA = tagSHELLSTATEW;
SHELLSTATEW = tagSHELLSTATEW;
SHELLSTATE = SHELLSTATEW;
TShellState = SHELLSTATE;
PShellState = ^TShellState;
const
//Data
fShowAllObjects = $00000001;
fShowExtensions = $00000002;
fNoConfirmRecycle = $00000004;
fShowSysFiles = $00000008;
fShowCompColor = $00000010;
fDoubleClickInWebView = $00000020;
fDesktopHTML = $00000040;
fWin95Classic = $00000080;
fDontPrettyPath = $00000100;
fShowAttribCol = $00000200;
fMapNetDrvBtn = $00000400;
fShowInfoTip = $00000800;
fHideIcons = $00001000;
fWebView = $00002000;
fFilter = $00004000;
fShowSuperHidden = $00008000;
fNoNetCrawling = $00010000;
//Data2
fSepProcess = $00000001;
fStartPanelOn = $00000002;
fShowStartPage = $00000004;
fAutoCheckSelect = $00000008;
fIconsOnly = $00000010;
fShowTypeOverlay = $00000020;
const
SSF_SHOWALLOBJECTS = $00000001;
SSF_SHOWEXTENSIONS = $00000002;
SSF_HIDDENFILEEXTS = $00000004;
SSF_SERVERADMINUI = $00000004;
SSF_SHOWCOMPCOLOR = $00000008;
SSF_SORTCOLUMNS = $00000010;
SSF_SHOWSYSFILES = $00000020;
SSF_DOUBLECLICKINWEBVIEW = $00000080;
SSF_SHOWATTRIBCOL = $00000100;
SSF_DESKTOPHTML = $00000200;
SSF_WIN95CLASSIC = $00000400;
SSF_DONTPRETTYPATH = $00000800;
SSF_SHOWINFOTIP = $00002000;
SSF_MAPNETDRVBUTTON = $00001000;
SSF_NOCONFIRMRECYCLE = $00008000;
SSF_HIDEICONS = $00004000;
SSF_FILTER = $00010000;
SSF_WEBVIEW = $00020000;
SSF_SHOWSUPERHIDDEN = $00040000;
SSF_SEPPROCESS = $00080000;
SSF_NONETCRAWLING = $00100000;
SSF_STARTPANELON = $00200000;
SSF_SHOWSTARTPAGE = $00400000;
procedure SHGetSetSettings(var lpss: TShellState; dwMask: DWORD; bSet: BOOL) stdcall; external 'shell32.dll';
procedure SHSetStatus_(Mask: Dword; MaskData: Dword; dwSet: Boolean);
var
StateValue : TShellState;
dwMask : Cardinal;
dwMaskData : DWORD;
begin
ZeroMemory(@StateValue, SizeOf(StateValue));
dwMask := Mask;
dwMaskData := MaskData;
SHGetSetSettings(StateValue, dwMask, False);
if dwSet then begin
StateValue.Data := 0;
SHGetSetSettings(StateValue, dwMask, True);
end else begin
StateValue.Data := dwMaskData;
SHGetSetSettings(StateValue, dwMask, True);
end;
end;
//Show|Hide system files
procedure TForm1.buttonSetClick(Sender: TObject);
begin
if checkboxShowProtectdeFiles.Checked
then SHSetStatus_(SSF_SHOWSUPERHIDDEN, fShowSuperHidden, False)
else SHSetStatus_(SSF_SHOWSUPERHIDDEN, fShowSuperHidden, True);
end;
|
|
Zitat
|