BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

saving cur-files

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
CSI
Guest





PostPosted: Tue Nov 16, 2004 8:50 am    Post subject: saving cur-files Reply with quote



Hi,

I need to save an cursor into a file (*.cur).

I've tried this:

....
var iinfo: TIconInfo;
icon: TIcon;

....

if GetIconInfo( screen.cursors[ crDrag], iinfo) then begin
icon := TIcon.Create;
icon.Handle := CreateIconIndirect( iinfo);
icon.savetofile( 'myicon.cur');
icon.free;
end;

....

But it doesn't save :-(

He tells me: <

Can anybody help me? I'm going crazy about it :-)

THX
CSI
Back to top
Peter Below (TeamB)
Guest





PostPosted: Tue Nov 16, 2004 7:53 pm    Post subject: Re: saving cur-files Reply with quote



In article <4199bf4f$1 (AT) newsgroups (DOT) borland.com>, Csi wrote:
Quote:
I need to save an cursor into a file (*.cur).

I've tried this:

....
var iinfo: TIconInfo;
icon: TIcon;

....

if GetIconInfo( screen.cursors[ crDrag], iinfo) then begin
icon := TIcon.Create;
icon.Handle := CreateIconIndirect( iinfo);

Way too complicated. You can use

icon.Handle := CopyIcon(screen.cursors[ crDrag]);

Even

icon.handle := screen.cursors[ crDrag];

should work without problems since the VCL uses an internal caching
mechanism for GDI objects.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
CSI
Guest





PostPosted: Mon Nov 22, 2004 7:51 am    Post subject: Re: saving cur-files Reply with quote



Thanks for your reply, but saving still don't work.

I tried your suggestion:

Quote:
icon.Handle := CopyIcon(screen.cursors[ crDrag]);

or this:

Quote:
icon.handle := screen.cursors[ crDrag];


But Delphi raised the < error again.
Is this an Delphi bug?
I've the UpdatePack 1 (D5 prof.) installed.

THX!!

Back to top
Peter Below (TeamB)
Guest





PostPosted: Mon Nov 22, 2004 7:13 pm    Post subject: Re: saving cur-files Reply with quote

r> Date: Tue, 16 Nov 2004 09:50:08 +0100
Quote:
Thanks for your reply, but saving still don't work.

I just tried this:

procedure TForm1.Button1Click(Sender: TObject);
var
i: TIcon;
Begin
i:= TIcon.Create;
try
i.Handle := Screen.Cursors[crHourglass];
i.SaveToFile('C:temp.ico');
finally
i.free;
end;
end;

and it does work, saves the icon file, Explorer correctly shows it. D
7.01, Win2K. Tried the same with D5, works as well. No idea what your
problem may be, sorry.


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
CSI
Guest





PostPosted: Thu Nov 25, 2004 6:55 am    Post subject: Re: saving cur-files Reply with quote

Peter Below (TeamB) wrote:
Quote:
r> Date: Tue, 16 Nov 2004 09:50:08 +0100

Thanks for your reply, but saving still don't work.


I just tried this:

procedure TForm1.Button1Click(Sender: TObject);
var
i: TIcon;
Begin
i:= TIcon.Create;
try
i.Handle := Screen.Cursors[crHourglass];
i.SaveToFile('C:temp.ico');
finally
i.free;
end;
end;


Its crazy. I tried your code and I get the "Bitmap invalid" error.

Is there an further update available for D5 (especially for
graphics.pas)? I have the UpdatePack1 for Delphi...

Back to top
Norma
Guest





PostPosted: Thu Nov 25, 2004 2:28 pm    Post subject: Re: saving cur-files Reply with quote

CSI wrote on 11/24/2004 22:55 PST:
Quote:

Its crazy. I tried your code and I get the "Bitmap invalid" error.

Is there an further update available for D5 (especially for
graphics.pas)? I have the UpdatePack1 for Delphi...

Same here, with same setup as Peter has (D 7.01 Win2K).

--
Norma

Back to top
Peter Below (TeamB)
Guest





PostPosted: Thu Nov 25, 2004 6:39 pm    Post subject: Re: saving cur-files Reply with quote

In article <41a581db$1 (AT) newsgroups (DOT) borland.com>, Csi wrote:
Quote:
Its crazy. I tried your code and I get the "Bitmap invalid" error.

Is there an further update available for D5 (especially for
graphics.pas)? I have the UpdatePack1 for Delphi...


D5.01 was the only update for D5 and is what i was using as well for
the test. What Windows platform are you running this code on? Perhaps
that is also a factor. I use Windows 2000, SP3.

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.