delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback



Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi








Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (12)


How to create / read from a structured storage file Part 2Go to colin pringle's websiteComponent available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
structured storage part 2
Product:
Delphi all versions
Category:
Database-VCL
Skill Level:
Scoring:
Last Update:
12/26/2001
Search Keys:
delphi delphi3000 article borland vcl code-snippet Structured file odbs file text database sql data blob dbx
Times Scored:
4
Visits:
7093
Uploader: colin pringle
Company: cjpsoftware
Reference: cjpsoftware.com
Component Download: http://www.cjpsoftware.com/cjparticle/sspart2.ZIP
 
Question/Problem/Abstract:
How to read data from a structured storage file
Answer:



Article discontinued Due To Abuse.



// Part 2
// Author Cjpsoftware.. Not for commercial use...
// contact C J Pringle support@cjpsoftware.com
// Part 2 on how to read / write from a structured
// storage file..
// Copy / paste this unit into a new application
// add 1 edit box and two buttons
// When you are ready.
// Click on Write data 1000 the number will be wrote to the
// storage file
// click read data the sturctured file will br openned and
// the stream read. The value will be displayed in the edit box.
//  I have provided the unit you can download

unit testunit;

interface

uses
  Windows, Messages, SysUtils,activex,axctrls, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,comobj;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;

    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    FRootStorage: IStorage;
    stm: IStream;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

// Write data fromn ss file
//
procedure TForm1.Button1Click(Sender: TObject);
var

  strfile: PWideChar;
  Myvalue: Integer;
  BytesWritten: Longint;

begin
// Structured Storeage File

Strfile  := 'Sh.ss';

// ===

  if not SUCCEEDED(StgOpenStorage(Strfile, nil,
    STGM_READWRITE or STGM_SHARE_EXCLUSIVE,
    nil, 0, FRootStorage)) then
    Begin
    StgCreateDocFile(strfile,
      STGM_CREATE or STGM_READWRITE or STGM_SHARE_EXCLUSIVE,
      0, FRootStorage);

    FRootStorage.CreateStream('Index',
      STGM_CREATE or STGM_READWRITE or STGM_SHARE_EXCLUSIVE, 0, 0, stm);
    End;

  Myvalue := 1000;

// Write Datat To Stream
  Olecheck(Stm.Write(@MyValue,sizeof(Integer),@BytesWritten));
end;


// read Data from ss file
//
procedure TForm1.Button2Click(Sender: TObject);
Var  Myvalue: Integer;
     Bytesread: Longint;
begin
// Open Storage File
If SUCCEEDED(StgOpenStorage('sh.ss', nil,
    STGM_READWRITE or STGM_SHARE_EXCLUSIVE,
    nil, 0, FRootStorage)) Then
    Begin
// Open the stream within the ss file
    OleCheck(FRootstorage.OpenStream('Index',Nil,STGM_READWRITE or STGM_SHARE_EXCLUSIVE,0,Stm));
    Stm.read(@MyValue,Sizeof(integer),@Bytesread);
    Edit1.text := Inttostr(MyValue);
    End;


end;

end.





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
WARNING ! WARNING ! WARNING ! WARNING !
    Periklis Koutsogiannis (Dec 24 2001 7:47PM)

webmaster,

AGAIN THIS INDIRECT ADVERTISING OF IS TOOL BY POSTING ARTICLES.

WHAT IS HAPPENING ? NOONE IS READING ?

PLEASE STOP THIS.

PS: WEBMASTER: IF YOU CONTINUE ALLOWING THIS I WILL STARTING POSTIN ARTICLES INCLUDING MY ADVERTISEMENT !

Respond

RE: WARNING ! WARNING ! WARNING ! WARNING !
Delphi C4F (Dec 25 2001 12:53PM)

I second that. I visit delphi3000 to read articles, not to see advertisements from other people. If this was a free service then I guess it's was acceptable. Now the most of us are paying to use this service it's intolerable this kind of actions by article writers.

Respond

RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
colin pringle (Dec 25 2001 1:13PM)

Well I dont get paid for posting my articles so I thinks its only fare.
The one thing you both are forgetting is that im giving you my years of exp for free...

Respond

RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
colin pringle (Dec 25 2001 1:17PM)

If this is such a problem Ill remove all my articles and everybody will loose out.. Ive had over 3000 views of my articles and Ive only started posting them in the last 3 weeks...
Respond

RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
Delphi C4F (Dec 25 2001 1:28PM)

I'm sorry but I do not find our articles worth the advertisements.

For example why didn't you just wrote "How to create / read from a structured storage" instead of Part 1, Part 2, Part 3, .... ?!?
Anyone that whises to learn how to use the structured storage objects will have to read all the parts you write. Of course this is good to you because more pages = more advertisement.
Respond

RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
colin pringle (Dec 25 2001 1:49PM)

Explain to me then why should I give my knowledge away for free that I've spent time learning.. So you can Copy/Paste My work.. Look people are interested in this article because I've had feedback for more information.. And no complaints. Away you must be interested in the article or we would not be posting message back and forth.
Respond

RE: RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
Periklis Koutsogiannis (Dec 25 2001 3:49PM)

Colin,

perhaps you don't know what the word CONTRIBUTE really means.
The purpose of this forum is just to contribute to the delphi community.

And please tell me ...

WHY YOU ARE THE ONLY ONE WHO TRIES TO ADVERTISE BY ABUSING THIS SERVICE ?

PS: You thing that BLACKMAILING me and all the other users by threating that you will remove your postings will bring something ?

Respond

RE: RE: RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
colin pringle (Dec 25 2001 9:24PM)

This isn1 a blackmale due to your harasment I have desided to discontinue structured storage. IMy reason for this is due to the fact you said this is a communitity when it isnt people pay delphi 3000 to view articles. But the authors receive no moneys. And most of the code is copied from other authors code. As where my code is mine. If you look on the left / right hand side of this page what do you see button adds. So I carnt see what the problem is. I have now thought twice about giving my knowledge away. Ill assume you want to use structured in a project and you carn`t wait for all the information. If that is the case why don`t you just say so. Know you are out of look. I would contact delphi 3000 and tell them to pay people like me. Then you would have all the information you require.
Respond

RE: RE: RE: RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
Periklis Koutsogiannis (Dec 26 2001 12:33AM)

Colin,

Contact anyone you want. People like you who demand MONEY to share the knowledge that can be found EVERYWHERE, really don't provide quality in knowledge.

KNOWLEDGE DON'T BELONG TO ANYONE AND HAS NO OWNER


Do NOT forget it colin ...it will help you in the future.

Periklis.

PS: I am a system programmer since 1985 - DR-DOS contributing author and author of major system utilities. Through these many years I learned to respect the sharing of knowledge ... believe me ...
Respond

RE: RE: RE: RE: RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
Periklis Koutsogiannis (Dec 26 2001 12:39AM)

Colin,

about the ads.

THE PEOPLE ARE PAYING (HELLO !) TO PUT THEIR ADS THERE !


Periklis
Respond

RE: RE: RE: RE: RE: RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
colin pringle (Dec 26 2001 11:09AM)

Im not getting paid for this and I don`t what to get paid for it. Im posting my articles out of good will.

but you say its your right to have my knowledge (I thnink not). Yes you may beable to find information on ss but my units work.

Good Luck With Your Hunt..
Respond

RE: RE: RE: RE: RE: RE: RE: RE: RE: RE: WARNING ! WARNING ! WARNING ! WARNING !
Periklis Koutsogiannis (Dec 26 2001 11:17AM)

colin,

you think that we have NO BRAIN ?

You DO get paid !

Indirect, when the user sees your ADs, visits your site, getting one of your progs and registers it ...

please respect our iq ...

periklis

PS: I saw that someone posted yesterday a similar article that works too ... and has no ads ...
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


   


  Community Ad of
L. Rosenstein
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)