Solved

i have problems with Timage

Posted on 1999-01-12
3
154 Views
Last Modified: 2010-04-06
I use an Timage for capture an image of Clipboard (Ctrl+V), then when the user press the
button (save) my code is:

Procedure Tform1.Button1click(Sender:Tobject);
var
  st:Tfilestream;
begin
  if not table1.findkey([key.text]) then
  begin
    table1.appendrecord([key.text,name.text]);
    st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);
    image1.picture.graphic.savetostream(st);
    Table1.edit;
    Tblobfield(table1.fieldbyname('Photo')).loadfromstream(St);
    table1.post;
  end;
end;
     
and i have other Button

Tform1.Button2click(Sender:Tobject) ;
var
  st:Tfilestream;
begin
  if table1.findkey([key.text]) then
  begin
    name.text:=table1.fieldbyname('Name').asstring;
    st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);
    Tblobfield(Table1.fieldbyname('Photo')).savetostream(st);
    image1.picture.graphic.loadfromstream(st);
  end
  else
    caption:='Error';
end;

the 2 procedures not mark noting error, but when i press the Button2 only The Name.text
are filled but the Image1 noting

why

Thanks

i wait for not bother : )
0
Comment
Question by:jamiguel
  • 2
3 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356186
The LoadFromStream call does not recognise the file extension. You should set it to the approprite one (eg: .BMP for bitmap etc)

Cheers,

Raymond.
0
 

Author Comment

by:jamiguel
ID: 1356187
but the extension is that of less, since I have proven without extension, or I have to put you the extension .BMP, what is the way perfect, can you  illustrate me with any code the correct form?
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 0 total points
ID: 1356188
I think you should change this line

   st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);

to this

   st:=Tfilestream.create('c:\temp\temp.bmp',fmcreate);

I would also reset the stream position before reading in the image eg:

   st.position := 0;
   image1.picture.graphic.loadfromstream(st);


Raymond
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now