a question about load cursor image

Experts:
 I uses these codes below to load a cursor image  so that draw it on a HDC,
but I always got a Zero (Error).
 why, how to load a cursor image?
var
  Nowcursor:HICON;

  NowCursor:=LoadImage(Hinstance,IDC_WAIT,IMAGE_CURSOR, SM_CXCURSOR , SM_CYCURSOR ,LR_DEFAULTSIZE);
  DrawIconEx(bmp.canvas.handle,NowCursor,Nowpoint.x,nowpoint.y,SM_CXCURSOR , SM_CYCURSOR,0,0,DI_COMPAT);


VenneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
listening
0
rwilson032697Commented:
Try replacing IDC_WAIT with crHourGlass...

Cheers,

Raymond.
0
LischkeCommented:
The load call must be

NowCursor := LoadImage(0, PChar(OCR_WAIT), IMAGE_CURSOR, 0, 0, LR_SHARED);

Ciao, Mike
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

VenneAuthor Commented:
Mike,
thank u, it can obtain a handle, but why? I couldn't draw it on my bitmap's HDC yet!? could u help me?
0
doncovCommented:
In first it is necessary will receive handle of the cursor, and then to define(determine) it(him) in a file of cursors of a component TScreen. The indexes of the predetermined cursors of system are negative, the user can define(determine) the cursor, which index is positive.
Example:
procedure TForm1.Button1Click(Sender: TObject);
var
      h : THandle;
begin
      h := LoadImage(0, 'C:\TheWall\Magic.ani', IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE or
                  LR_LOADFROMFILE);
      if h = 0 then
            ShowMessage('Cursor not loaded')
      else
            begin
                  Screen.Cursors[1] := h;
                  Form1.Cursor := 1;
            end;
end;


0
LischkeCommented:
Hi doncov, welcome at E-E. Please propose answers only if you are very sure you gave a correct one. If other experts are already discussion a particular issue then it is very likely that the solution is not so easy as you might think. Better you read this question again.

Venne, well, I realized that the OEM cursor did not draw on an image but I was in a hurry and could not determine why this is so. Tomorrow I'll investigate this...

Ciao, Mike
0
VenneAuthor Commented:
thank u , Mike, I will try outher solution and wait for your answer also.
------->
Sorry, donconv, maybe you haven't understood my question yet. I don't want show a cursor on screen (That's easy!) I want to get a cursor's image so that draw it on my memory HDC.
Can u give me a better one?
0
LischkeCommented:
He he, I let you confuse me. It's the parameter list of DrawIconEx which is wrong. It must be:

DrawIconEx(bmp.canvas.handle, 0, 0, NowCursor, 0, 0, 0, 0, DI_NORMAL or DI_DEFAULTSIZE);

Ciao, Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VenneAuthor Commented:
Thank u ! that's right!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.