Sign in to follow this  
Followers 0
raca

Creating A 45bits Struct

4 posts in this topic

#1 ·  Posted (edited)

I want do call to SHGetSettings and it need a pointer to a struct SHELLSTATE

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;
    UINT fRestFlags:3;
} SHELLFLAGSTATE, *LPSHELLFLAGSTATE;

the struct has 45bits... i can't create it with DllStructCreate

or there is away around that i don't know?

Edited by raca

Share this post


Link to post
Share on other sites



$struct = DllStructCreate("int;int;int;int;int;int;int;int;int;int;int;int;int;uint")


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

:think:

thanks a lot

this what i have done, a script do disable activedesktop on winxp

$shellstate=DllStructCreate("int[13];uint")
;$enable=0x40
DllStructSetData ($shellstate,1,0)
$SSF_DESKTOPHTML=0x00000200
DllCall("shell32.dll","none","SHGetSetSettings","ptr",DllStructGetPtr($shellstate),"int",$SSF_DESKTOPHTML,"int",TRUE);
ControlSend("Program Manager","",1,"{F5}")

it gave me a loooot of work.... to make it work on 4 lines lol

cheers

Share this post


Link to post
Share on other sites

Actually, you're all wrong. The structure as defined is 16 bits, however, C++'s sizeof operator says it's 4 bytes (32 bits). All the BOOL values are stored in a single bit each. The unsigned integer is stored in 3 bits. This makes a total of 16 bits. You can safely store that structure in a single int. However, you have to use BitAnd() to check each of the fields since each field is a single bit. This is called (oddly enough) a bit-field. You don't need DllStruct for this at all, in fact. Use the basic int type of DllCall() and the BitAnd/BitOR functions to retrieve/set the fields. However, I don't know which 16 bits are used (the upper or lower). I also don't know why the length is padded to 32-bits when only 16 are needed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0