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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
LischkeConnect With a Mentor Commented:
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
 
rwilson032697Commented:
listening
0
 
rwilson032697Commented:
Try replacing IDC_WAIT with crHourGlass...

Cheers,

Raymond.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
LischkeCommented:
The load call must be

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

Ciao, Mike
0
 
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
 
VenneAuthor Commented:
Thank u ! that's right!
0
All Courses

From novice to tech pro — start learning today.