Board index » delphi » Custom cursor image fails to display for Windows 98

Custom cursor image fails to display for Windows 98

Sometimes a custom cursor image will fail to display.  Standard Delphi
cursors appear normally, but not custom cursor images.  This problem appears
to occur only on Windows 98 machines.  In fact, this issue has been tested
on many different machines across the United States, and only Windows 98
machines are having this difficulty.  Here are some facts:

1.  The cursor images are in the EXE resource.
2.  Whether the executable uses a BPL, or not, makes no difference.
3.  The main form declares the resource file containing cursor images.
Next, I am using this format to assign my custom cursor:
edtMyEditBox.Cursor := LoadCursor( Handle, 'MYCURSOR' );
4.  I have tried calling this in OnCreate, in OnShow, and in an OnClick
event of a button.  It makes no difference which procedure I use to assign
the custom cursor.

I have tested this with different executables, and it is malfunctioning for
only one of them.  I conclude that Windows 98 does support custom cursors,
as long as certain requirements are met.

Has anyone encountered this problem, or a similar problem?  If so, what was
the fix?

-- Byron

 

Re:Custom cursor image fails to display for Windows 98


Hmmmm, I have a few custom cursors I created and put into my resource file so
that it builds with my EXE file and then the first thing I do is to load the
icon from the resource into an Icon handle and then I setup the Screen.Icons
array thing and then everything seems to work. Hmmmm

I also use 95 and 98

Davie

Quote
Byron Upchurch wrote:
> Sometimes a custom cursor image will fail to display.  Standard Delphi
> cursors appear normally, but not custom cursor images.  This problem appears
> to occur only on Windows 98 machines.  In fact, this issue has been tested
> on many different machines across the United States, and only Windows 98
> machines are having this difficulty.  Here are some facts:

> 1.  The cursor images are in the EXE resource.
> 2.  Whether the executable uses a BPL, or not, makes no difference.
> 3.  The main form declares the resource file containing cursor images.
> Next, I am using this format to assign my custom cursor:
> edtMyEditBox.Cursor := LoadCursor( Handle, 'MYCURSOR' );
> 4.  I have tried calling this in OnCreate, in OnShow, and in an OnClick
> event of a button.  It makes no difference which procedure I use to assign
> the custom cursor.

> I have tested this with different executables, and it is malfunctioning for
> only one of them.  I conclude that Windows 98 does support custom cursors,
> as long as certain requirements are met.

> Has anyone encountered this problem, or a similar problem?  If so, what was
> the fix?

> -- Byron

Re:Custom cursor image fails to display for Windows 98


Yes, this is essentially my method also.  It usually works, except for this
one executable.  It is a very large EXE at 11 MB, and uses a BPL.  Compared
with the executables whose custom cursors do work, it is several times
larger by comparison.  It is a known fact that Windows 95/98 has a size
constraint on executables, and we are very close to it.  I wonder if that is
the problem.

Does this sound familiar to anyone?

-- Byron

Quote
Davie <smatt...@smatters.com> wrote in message

news:38F63FA8.6D2CAAD1@smatters.com...
Quote
> Hmmmm, I have a few custom cursors I created and put into my resource file
so
> that it builds with my EXE file and then the first thing I do is to load
the
> icon from the resource into an Icon handle and then I setup the
Screen.Icons
> array thing and then everything seems to work. Hmmmm

> I also use 95 and 98

> Davie

> Byron Upchurch wrote:

> > Sometimes a custom cursor image will fail to display.  Standard Delphi
> > cursors appear normally, but not custom cursor images.  This problem
appears
> > to occur only on Windows 98 machines.  In fact, this issue has been
tested
> > on many different machines across the United States, and only Windows 98
> > machines are having this difficulty.  Here are some facts:

> > 1.  The cursor images are in the EXE resource.
> > 2.  Whether the executable uses a BPL, or not, makes no difference.
> > 3.  The main form declares the resource file containing cursor images.
> > Next, I am using this format to assign my custom cursor:
> > edtMyEditBox.Cursor := LoadCursor( Handle, 'MYCURSOR' );
> > 4.  I have tried calling this in OnCreate, in OnShow, and in an OnClick
> > event of a button.  It makes no difference which procedure I use to
assign
> > the custom cursor.

> > I have tested this with different executables, and it is malfunctioning
for
> > only one of them.  I conclude that Windows 98 does support custom
cursors,
> > as long as certain requirements are met.

> > Has anyone encountered this problem, or a similar problem?  If so, what
was
> > the fix?

> > -- Byron

Re:Custom cursor image fails to display for Windows 98


Quote
In article <8d4vf5$f...@bornews.borland.com>, Byron Upchurch wrote:
> Next, I am using this format to assign my custom cursor:
> edtMyEditBox.Cursor := LoadCursor( Handle, 'MYCURSOR' );

That would not compile and even if it did it would be plain wrong. The
Cursor property of TCOntrol & Cie. stores an *index* into the
Screen.Cursors array, not a cursor handle (which is what LoadCursor
returns). So you have to store the cursor handle into a custom slot of
the Screen.Cursors array and then use the index you selected for this
slot.

What are you *really* doing?

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Re:Custom cursor image fails to display for Windows 98


Is the cursor of standard size?

Re:Custom cursor image fails to display for Windows 98


Normally, we do use the index to the cursor, which we assign in an array.
As part of testing however, I began using the method I mentioned, hoping to
"force" the cursor to display.  First, to see if it would work, I tried this
method in other executables, and it did work.  My objective was to find some
way -- even if it was not the clean, standard way -- to display the custom
cursor.

-- Byron

Peter Below (TeamB) <100113.1...@compuXXserve.com> wrote in message
news:VA.00004d9c.01083899@antispam.compuserve.com...

Quote
> In article <8d4vf5$f...@bornews.borland.com>, Byron Upchurch wrote:
> > Next, I am using this format to assign my custom cursor:
> > edtMyEditBox.Cursor := LoadCursor( Handle, 'MYCURSOR' );

> That would not compile and even if it did it would be plain wrong. The
> Cursor property of TCOntrol & Cie. stores an *index* into the
> Screen.Cursors array, not a cursor handle (which is what LoadCursor
> returns). So you have to store the cursor handle into a custom slot of
> the Screen.Cursors array and then use the index you selected for this
> slot.

> What are you *really* doing?

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitly requested!

Re:Custom cursor image fails to display for Windows 98


They are 32 x 32.

-- Byron

Quote
Robert Marquardt <robert_marqua...@gmx.de> wrote in message

news:38F7F958.2DFD2096@gmx.de...
Quote
> Is the cursor of standard size?

Re:Custom cursor image fails to display for Windows 98


I've had problems too.  My work around was to use a Windows API function to
force windows to display the cursor.

Load in the custom cursor thusly:
Screen.Cursors[nn] := LoadCursor(HInstance, 'CUSTOM_CURSOR_NAME');

Force windows to set the Screen object's current custom cursor:
SetCursor(Screen.Cursors[nn]);
nn = a constant for the cursor number, you should use a number > 22  because
windows uses the lower numbers for the default cursors.

This always works on 98 and 98se...

Mouse

Other Threads