1. Colour Cursors

Hello,
I'm trying to use colour cursors in my windows program (rather than just the
monochrome ones win32lib allows).  I've never messed around with low level
Windows stuff before though so inevitably it hasn't worked.  Can anyone tell
me where I've gone wrong?

Thanks,
chris.

include win32lib.ew --version 0.45r

constant fIcon=allot(Long),
xHotspot=allot(DWord),
yHotspot=allot(DWord),
hbmMask=allot(Long),
hbmColor=allot(Long),
SIZEOF_ICONINFO=allotted_size(),

,
main=create(Window,"My Window",0,Default,Default,330,330,0)

atom struc_pt, bmp_pt, mask_pt, cursor_pt
struc_pt=allocate_struct(SIZEOF_ICONINFO)
bmp_pt=loadBitmapFromFile("cursor.bmp")
mask_pt=loadBitmapFromFile("mask.bmp")
store(struc_pt,xHotspot,1)
store(struc_pt,yHotspot,1)
store(struc_pt,hbmMask,mask_pt)
store(struc_pt,hbmColor,bmp_pt)
cursor_pt=c_func(xCreateIconIndirect,{struc_pt})
trackCursor(cursor_pt)  --shouldn't this be documented by the way?

procedure onOpen_main()
    setMousePointer(main,cursor_pt)
end procedure
onOpen[main]=routine_id("onOpen_main")

WinMain(main,Normal)

new topic     » topic index » view message » categorize

2. Re: Colour Cursors

------=_NextPart_000_003D_01C0183C.D51FA860
        charset="iso-8859-1"

Oh and here are the files mentioned in the code - just squiggles to see if
it works, really.

chris.

> Hello,
> I'm trying to use colour cursors in my windows program (rather than just
the
> monochrome ones win32lib allows).  I've never messed around with low level
> Windows stuff before though so inevitably it hasn't worked.  Can anyone
tell
> me where I've gone wrong?
>
> Thanks,
> chris.



------=_NextPart_000_003D_01C0183C.D51FA860
        name="cursor.zip"

new topic     » goto parent     » topic index » view message » categorize

3. Re: Colour Cursors

i tried to help you but it seems it's pretty complicated thing, again one of
those windows complicated things, like so many.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Colour Cursors

> i tried to help you but it seems it's pretty complicated thing, again one
of
> those windows complicated things, like so many.
>
Oh well, thanks to anyone who had a look at it.  Since this looks too
difficult, I thought about loading the cursor from a .cur file instead.
However, I haven't managed to get further than this:-

include win32lib.ew
constant
ER)

For some reason I get an error message saying it can't link to
LoadCursorFromFile.  I can't understand it.  I'm using the WinAPI help file
linked to by the RDS site and that lists this function.  What's going on?

chris.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Colour Cursors

Oooh I've got it working!  I downloaded a DLL viewer and found that there
was no LoadCursorFromFile in user32.dll - but there was a
LoadCursorFromFileA (which works) and a LoadCursorFromFileW (which doesn't).
What's the difference between them and why do you have to go to such methods
to find out what they're *actually* called?  Anyway here's a demo for the
curious.

--begin tested code
include win32lib.ew

constant
TER),
main=create(Window,"My Window",0,Default,Default,330,330,0)

atom str, hcursor
str=allocate_string("mycursor.cur")
hcursor=c_func(xLoadCursorFromFile,{str})
free(str)
trackCursor(hcursor)

procedure onOpen_main()
    setMousePointer(main,hcursor)
end procedure
onOpen[main]=routine_id("onOpen_main")

WinMain(main,Normal)
--end

chris.

> Oh well, thanks to anyone who had a look at it.  Since this looks too
> difficult, I thought about loading the cursor from a .cur file instead.
> However, I haven't managed to get further than this:-
>
> include win32lib.ew
> constant
>
> ER)
>
> For some reason I get an error message saying it can't link to
> LoadCursorFromFile.  I can't understand it.  I'm using the WinAPI help
file
> linked to by the RDS site and that lists this function.  What's going on?
>
> chris.
>

new topic     » goto parent     » topic index » view message » categorize

6. Re: Colour Cursors

The "A" version is for ASCII and the "W" is for Unicode (Wide-characters).

----- Original Message -----
From: "chrissy" <tubby.toast at NTLWORLD.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Friday, September 08, 2000 7:55 AM
Subject: Re: Colour Cursors


> Oooh I've got it working!  I downloaded a DLL viewer and found that there
> was no LoadCursorFromFile in user32.dll - but there was a
> LoadCursorFromFileA (which works) and a LoadCursorFromFileW (which
doesn't).
> What's the difference between them and why do you have to go to such
methods
> to find out what they're *actually* called?  Anyway here's a demo for the
> curious.
>
> --begin tested code
> include win32lib.ew
>
> constant
>
> TER),
> main=create(Window,"My Window",0,Default,Default,330,330,0)
>
> atom str, hcursor
> str=allocate_string("mycursor.cur")
> hcursor=c_func(xLoadCursorFromFile,{str})
> free(str)
> trackCursor(hcursor)
>
> procedure onOpen_main()
>     setMousePointer(main,hcursor)
> end procedure
> onOpen[main]=routine_id("onOpen_main")
>
> WinMain(main,Normal)
> --end
>
> chris.
>
> > Oh well, thanks to anyone who had a look at it.  Since this looks too
> > difficult, I thought about loading the cursor from a .cur file instead.
> > However, I haven't managed to get further than this:-
> >
> > include win32lib.ew
> > constant
> >
>
> > ER)
> >
> > For some reason I get an error message saying it can't link to
> > LoadCursorFromFile.  I can't understand it.  I'm using the WinAPI help
> file
> > linked to by the RDS site and that lists this function.  What's going
on?
> >
> > chris.
> >

new topic     » goto parent     » topic index » view message » categorize

7. Re: Colour Cursors

>
> Oooh I've got it working!  I downloaded a DLL viewer and
> found that there
> was no LoadCursorFromFile in user32.dll - but there was a
> LoadCursorFromFileA (which works) and a LoadCursorFromFileW
> (which doesn't).
> What's the difference between them and why do you have to go
> to such methods
> to find out what they're *actually* called?  Anyway here's a
> demo for the
> curious.

As Derek mentioned, it's the difference between ASCII and Unicode
characters.  I don't know of any surefire method to determine this in every
case, but a combination of Quickview'ing a DLL, looking at the source code
header (winuser32.h, in this case), looking at other sources of
documentation (Win32.hlp, MSDN, etc), and Trial and Error(tm) seem to cover
it.  Trial and Error seems to be quicker quite often, as long as you know
that sometimes functions have the 'A/W' suffix, and sometimes have an 'x'
prefix.

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu