I search to store simple states in a STANDALONE exe.
Obviously they are numerous way for do this, but this time i not need to store datas, but just one or several state.
So i know the DATA method, with creating a copy of an exe, poke inside datas, and run it another time for read new datas poked, but this heavy method is not really necessary for just few bits.
Furthermore i don't want use the BDR
So i have try numerous things for modify hitself the attribute of an exe
The firsts who works is #PB_FileSystem_System / #PB_FileSystem_Archive / #PB_FileSystem_ReadOnly that i can modify dynamicaly even if the EXE run
But i'm a little bit affraid, because sometime windows explorer change without alert this attribute

And i have also found another attribute #FILE_ATTRIBUTE_TEMPORARY or #FILE_ATTRIBUTE_ENCRYPTED

I suppose this CONSTANT is not really used in the case of personal exe ? so why not use it myself for my own need ?

Create an EXE of this code, run the exe, the first time the MsgBox is "32" and all the futur time "256"
Code: Select all
MyExe.s = ProgramFilename()
Attribute = GetFileAttributes(MyExe)
If Attribute = 32
MessageRequester("Temporary attribute", Trim(Str(Attribute)))
Attribut = #FILE_ATTRIBUTE_TEMPORARY ; or #FILE_ATTRIBUTE_ENCRYPTED
SetFileAttributes(MyExe, Attribut)
Else
MessageRequester("Temporary attribute", Trim(Str(Attribute)))
EndIf
Have a good day