Solved

i have problems with Timage

Posted on 1999-01-12
3
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert a string into a TDateTime 5 78
how to send memory stream from ics Client To ics server ? 11 203
control image tags in a string ? 12 165
Get weeknumber and year from date 4 53
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

742 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