| |
|
|
|
Description:
WritePrivateProfileStruct writes a Bytefolge under the angegebenen Rubrik and the angegebenen Eintragsnamen in a INI File. this Bytefolge becomes a Checksumme appended. declared can also whole Rubriken and Deleting Entries and the cache the INI on The Festplatte write.
Deklaration:
Def @WritePrivateProfileStruct(5) !KERNEL32,WritePrivateProfileStructA
Parameter:
1.Parameter: address one Strings or Memory-Variable with a String, the The Rubrik for entry contains. is this worth, Parameter 2 and Parameter 3 zero, becomes the cache the INI on The disk written. 2.Parameter: address one Strings or Memory-Variable with a String, the whom Eintragsnamen contains. is this worth 0, becomes The angegebene Rubrik deleted (unless, Parameter 1 is zero). 3.Parameter: Memory-Variable with the hinzuzufügenden data . is this worth 0, becomes the entry deleted (unless, Parameter 1 and 2 is zero). 4.Parameter: Size the Bereichs from Parameter 3 in Bytes as LongInt. 5.Parameter: address one Strings or Memory-Variable with a String, the names and way the INI contains. existing The File not, becomes tappt im dunkeln created.
Return Value:
1 If the String successful registered watts, 0 with failure or if the cache on The Festplatte written watts.
Examples:
CompileMarkSeparationDef @WritePrivateProfileStruct(5) !"KERNEL32","WritePrivateProfileStructA"
Def @GetPrivateProfileStruct(5) !"KERNEL32","GetPrivateProfileStructA"
Declare Section$,Key$,Wert$,File$,FileLöschen&,SectionDel&,KeyLesen&,KeyDel&,Flush&,Buffer#,Buffer%
DEclare Ausgelesen#,Ausgelesen$,Default$,Länge%
Windowstyle 31+512
Windowtitle "Struktur in eine INI schreiben und auslesen"
Window 0,0-640,440
Let Section$="Eigene Daten"
Let Key$="Mein Eintrag"
Let Wert$="Mein eigener Wert"
LET FILE$="C:TEST.INI"
Let FileLöschen&=@CreateButton(%HWND,"INI Löschen",20,200,150,30)
Let KeyLesen&=@CreateButton(%HWND,"Key "+Key$+" lesen",200,200,200,30)
Let Flush&=@CreateButton(%HWND,"INI flushen",450,200,150,30)
Let SectionDel&=@CreateButton(%HWND,"Sektion "+Section$+" Löschen",20,250,230,30)
Let KeyDel&=@CreateButton(%HWND,"Key "+Key$+" Löschen",280,250,230,30)
Let Buffer%=@len(Wert$)+1
Dim Buffer#,Buffer%
Clear Buffer#
String Buffer#,0=Wert$
@WritePrivateProfileStruct(@Addr(Section$),@Addr(Key$),Buffer#,Buffer%,@Addr(File$))
Dispose Buffer#
While %MENUITEM<>-2
Waitinput
IF @Getfocus(KeyLesen&)
CLS
Locate 0,0
Set("Errorlevel",-1)
Let Buffer%=((@len(@READINI$(File$,Section$,Key$))-2)/2)
LET AUSGELESEN$=@READINI$(File$,Section$,Key$)
Set("Errorlevel",0)
CASE BUFFER%<=0 : Let Buffer%=4
DIM Ausgelesen#,Buffer%
Clear Ausgelesen#
PRINT "Ausgelesene Struktur="+AUSGELESEN$
@GetPrivateProfileStruct(@Addr(Section$),@Addr(Key$),Ausgelesen#,Buffer%,@Addr(File$))
Print "Ausgelesener String="+@String$(Ausgelesen#,0)
LET Länge%=@len(AUSGELESEN$)-@len(@String$(Ausgelesen#,0))*2
PRINT "Checksumme=$"+@RIGHT$(AUSGELESEN$,Länge%)
Dispose Ausgelesen#
Beep 1
ElseIF @Getfocus(SectionDel&)
@WritePrivateProfileStruct(@Addr(Section$),0,0,0,@Addr(File$))
Beep 1
ElseIF @Getfocus(KeyDel&)
@WritePrivateProfileStruct(@Addr(Section$),@Addr(Key$),0,0,@Addr(File$))
Beep 1
ElseIF @Getfocus(FileLöschen&)
Assign #1,File$
Erase #1
Beep 1
ElseIF @Getfocus(Flush&)
@WritePrivateProfileStruct(0,0,0,0,@Addr(File$))
Beep 1
endif
ss=s4 href='./../../Function-References/XProfan/wend/'>Wend
|
|
|
| |
|
|