Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Using a .dat in delphi[Tutorial]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  

Was this useful?
Yes
25%
 25%  [ 1 ]
No
75%
 75%  [ 3 ]
Total Votes : 4

Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jul 11, 2007 7:58 am    Post subject: Using a .dat in delphi[Tutorial] Reply with quote

im gonna share what i just learned with some of you.

this file is a very useful file and will save you alot of trouble.

So you have a Memo, ListBox, w/e and you want the data to be saved use to use

Dont want to create a .txt file or database to save everything?

USE A DAT

Step 1. On the form Create Procedure do this

Code:
procedure TForm1.FormCreate(Sender: TObject);
var
  strm : TFileStream;
begin
  if FileExists('List.dat') then begin
    strm := TFileStream.Create('List.dat',fmOpenRead);
    strm.ReadComponent(ListBox1);
    strm.Free

   end;

Describing the code:
TFileStream is what allows you to stream a file for information.
Code:
if FileExists('List.dat') then begin

This searchs to see if List.dat is there and if it is it will do the if block
Code:
    strm := TFileStream.Create('List.dat',fmOpenRead);
    strm.ReadComponent(ListBox1);
    strm.Free


TFileStream.Create is used to create the stream using List.dat and the function fmOpenRead

ReadComponent(ListBox1) is used to write the List.dat to the ListBox1. You can change it to w/e. Memo1. Edit1.

Free is used to free up the stream so you can access it in other files. If you DONT FREE IT you will get an access share violation Rolling Eyes



Now to actually CREATE the .dat

Step2. On FormClose do this
Code:
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
  strm : TFileStream;
begin
  strm := TFileStream.Create('List.dat', fmCreate);
  strm.WriteComponent(ListBox1);
  strm.Free;
end;

Simple eh?

You know about TFileStream

TFileStream.Create is the function used to create the dat List.dat using fmCreate.

WriteComponent(ListBox1) is used to read ListBox1 and write it to the .dat

Remember to free up the stream Rolling Eyes

These 2 simple blocks will make your programming easier Laughing

_________________
Back to top
View user's profile Send private message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Wed Jul 11, 2007 10:10 am    Post subject: Reply with quote

let me see if i got it right...

whatever you saves in the .dat file, is opened in your delphi application.

If you got a list of names, and you save it as a .dat file, then inside delphi, it will show the names in a memo ect ?

Thanks for taking time to write the tutorial, i love that there is getting more and more tutorials here, but then again i dont want the section to die becuase of lots of topics about the same (Kaspersky... no need to make 2-3 threads about how to make 1 trainer)

but thanks for taking time to write it!! it might become handy for some people. good work.
Back to top
View user's profile Send private message MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jul 11, 2007 10:17 am    Post subject: Reply with quote

.dat can be any file

.dat(a) is an encrypted type of file so it is good for this work

when you save the .dat it saves the info like it would appear in the list box

i think its very handy, i like to do things that involve session to session memory so this is a good tool

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Jul 11, 2007 4:27 pm    Post subject: Reply with quote

You don't have to save as .dat, you can name it as .dykebeard or something if you felt so inclined and read it no problem since it's just plain text.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jul 11, 2007 7:53 pm    Post subject: Reply with quote

Code:
TPF0TListBoxListBox1Left Top Width。Heightチ
ItemHeight
TabOrderTabWidth 


yeah thats the code from the dat

not exactly plain text

You cant see it but it has encryption symbols that wont show on CEF...

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Jul 11, 2007 7:59 pm    Post subject: Reply with quote

If you use special symbols like nextline and tab, it will show up wonky in notepad.

Also .dat files aren't used for anything specific, you can store whatever in them pretty much.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jul 11, 2007 8:15 pm    Post subject: Reply with quote

yea i said you can use them for anything Rolling Eyes

and this is just one simple method so w/e

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites