 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Damitr Guest
|
Posted: Tue Nov 15, 2005 12:31 am Post subject: Using SHGetSetSettings to emulate XPs Show Desktop Icons swi |
|
|
In Win XP you can right click on the desktop, select "Arrange Icons by"
then check or uncheck "Show Desktop Icons". I need to emulate this
function programatically. An old thread gave me a clue about using
SHGetSetSettings - but I've gotten stuck. The code below (attached to
a form with a button called btnToggleIcons) gives a "Types of actual
and formal var parameters must be identical" error. But I've tried
every variation I can think of and all I can succeed in doing is
varying the error messages <S>
Can anyone fix my code for me?
************************************
unit uIcons;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls, shlobj;
type
TShellRecord = packed record
fShowAllObjects: bool;
fShowExtensions: bool;
fNoConfirmRecycle: bool;
fShowSysFiles: bool;
fShowCompColor: bool;
fDoubleClickInWebView: bool;
fDesktopHTML: bool;
fWin95Classic: bool;
fDontPrettyPath: bool;
fShowAttribCol: bool;
fMapNetDrvBtn: bool;
fShowInfoTip: bool;
fHideIcons: bool;
fWebView: bool;
fFilter: bool;
fShowSuperHidden: bool;
fNoNetCrawling: bool;
dwWin95Unused: DWORD;
uWin95Unused: UINT;
lParamSort: longint;
iSortDirection: integer;
version: UINT;
uNotUsed: UINT;
fSepProcess: bool;
fStartPanelOn: bool;
fShowStartPage: bool;
fSpareFlags: UINT;
end;
PShellRecord = ^TShellRecord;
TForm1 = class(TForm)
btnToggleIcons: TButton;
procedure btnToggleIconsClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
{TShellFlagState is already defined in shlobj.pas}
procedure SHGetSetSettings(var lpss: TShellFlagState; dwMask: DWORD;
bSet:
BOOL); stdcall;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure SHGetSetSettings; external 'shell32.dll' name
'SHGetSetSettings'
procedure TForm1.btnToggleIconsClick(Sender: TObject);
var
psr: PShellRecord;
msk: cardinal;
bset: longbool;
begin
bset:=false;
SHGetSetSettings(psr, msk, bset);
psr^.fHideIcons:= not psr^.fHideIcons;
bset:=true;
SHGetSetSettings(psr,msk,bset);
end;
end.
| Quote: | From Microsoft:
SHELLSTATE Structure |
Contains settings for the Shell's state. This structure is used with
the SHGetSetSettings function.
Syntax
typedef struct {
BOOL fShowAllObjects:1;
BOOL fShowExtensions:1;
BOOL fNoConfirmRecycle:1;
BOOL fShowSysFiles:1;
BOOL fShowCompColor:1;
BOOL fDoubleClickInWebView:1;
BOOL fDesktopHTML:1;
BOOL fWin95Classic:1;
BOOL fDontPrettyPath:1;
BOOL fShowAttribCol:1;
BOOL fMapNetDrvBtn:1;
BOOL fShowInfoTip:1;
BOOL fHideIcons:1;
BOOL fWebView:1;
BOOL fFilter:1;
BOOL fShowSuperHidden:1;
BOOL fNoNetCrawling:1;
DWORD dwWin95Unused;
UINT uWin95Unused;
LONG lParamSort;
int iSortDirection;
UINT version;
UINT uNotUsed;
BOOL fSepProcess:1;
BOOL fStartPanelOn:1;
BOOL fShowStartPage:1;
UINT fSpareFlags:13;
} SHELLSTATE, *LPSHSHELLSTATE;
Structure Information
Header shlobj.h
|
|
| Back to top |
|
 |
Riki Wiki Guest
|
Posted: Sat Nov 19, 2005 11:49 am Post subject: Re: Using SHGetSetSettings to emulate XPs Show Desktop Icons |
|
|
Hoi Damitr
FYI this newsgroup do not officially exist, that is why there is so few
posts and so few viewers here. The newsgroup you should use is
b.p.d.nativeapi.win32, and you need to post to the Borland news groups
server.
Take a look here:
<http://tinyurl.com/8m5nw>
which links to
<http://delphi.wikicities.com/wiki/Delphi_Newsgroups>
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|