| View previous topic :: View next topic |
| Author |
Message |
CSI Guest
|
Posted: Tue Nov 16, 2004 8:50 am Post subject: saving cur-files |
|
|
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
|
Posted: Tue Nov 16, 2004 7:53 pm Post subject: Re: saving cur-files |
|
|
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
|
Posted: Mon Nov 22, 2004 7:51 am Post subject: Re: saving cur-files |
|
|
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
|
Posted: Mon Nov 22, 2004 7:13 pm Post subject: Re: saving cur-files |
|
|
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
|
Posted: Thu Nov 25, 2004 6:55 am Post subject: Re: saving cur-files |
|
|
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
|
Posted: Thu Nov 25, 2004 2:28 pm Post subject: Re: saving cur-files |
|
|
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
|
Posted: Thu Nov 25, 2004 6:39 pm Post subject: Re: saving cur-files |
|
|
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 |
|
 |
|