Delphi method of establishing, reading and storing INI file "II" _delphi

Source: Internet
Author: User

Get a string from an. ini file
Var
Strresult:pchar;
Begin
GetPrivateProfileString (
´windows´,//[] The name of the title in
´nullport´,//= number before the name
´nil´,//If the string is not found, the default value returned
Strresult,//Store get character
100,//Get maximum allowable length of character
FileName of the ´c:\forwin95\win.ini´//call
);
Edit1.text:=strresult; Show Get string
Get an integer from an. ini file
Edit1.text:=inttostr (Getprivateprofileint (
´intl´,//[] The name of the title in
´icountry´,//= number before the name
0,//If an integer is not found, the default value returned
FileName of the ´c:\forwin95\win.ini´//call
));
Writing a string to an. ini file
WritePrivateProfileString (
´windows´,//[] The name of the title in
´load´,//String to be written before "="
´accca´,//data to be written
FileName of the ´c:\forwin95\win.ini´//call
);
Writing an integer to an. ini file
Writeprivateprofilesection (
´windows´,//[] The name of the title in
´read=100´,//data to be written
FileName of the ´c:\forwin95\win.ini´//call
);
The above approach is to invoke API functions, and here's another way to do this from the. ini file without the API
Methods to get characters
var myini:tinifile;
Begin
Myini: = Tinifile.create (´win. Ini´);//The file name of the call
Edit1.text:=myini.readstring (´desktop´,´wallpaper´,´´);
Get character
End
Ways to write characters to an. ini file
var myini:tinifile;
Begin
Myini: = Tinifile.create (´win. Ini´);//The file name of the call
Delphiini.writestring (´desktop´,´wallpaper´,´c:\a.bmp´);
End

Of course, this is very easy and cracked, you can use XOR to do different or operation, or reverse
Value... It depends on how you do it. In short, this article is only a tip.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.