Web Development

General discussion


changing mouse pointer in c

By mmmova ·
Greeetings everyone,
I just wanted a bit of help. I am making a program with mouse input it works fine. Now all i need is that I want to load the .cur files. I have already used some XOR And masks they work fine. How can I load the cur file in c.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Loading custom cursors.

by zorwizard In reply to changing mouse pointer in ...

// If you like you can email me at zorwizard@lycos.com
// I have several cursors that I have build myself
// thay are in the resource file `Cursors.res'
// I declare them and assign them thus...
// Notice these are assigned as a negative integer...
// the system cursors (when I last checked...)
// are valued from -1 through -20, or something like that
// that is why my custom cursors start at -21 and proceed DOWN...

const int crRight = -21;
const int crLeft = -22;
const int crUp = -23;
const int crDown = -24;
const int crThis = -25;
const int cr4Way = -26;

#pragma resource "Cursors.res"

// Later in my applications (a CAD program) main initialization function
// I use a function called `LoadCursor()' (From the windows API...
// HInstance (actually `hInstance) is, `Identifies an instance of the
// module whose executable file contains the cursor to be loaded. ' and
// the second argument (which is `lpCursorName) is `Points to a null-
// terminated string that contains the name of the cursor resource
// to be loaded.' The functionreturns a `HCURSOR' which is a handle
// to the new cursor. Which in my example is stored in an array of
// cursors called `Cursors', an element of `Screen' (as you can see...)

Screen->Cursors[crRight] = LoadCursor((void *)HInstance, "RIGHT");
Screen->Cursors[crLeft] = LoadCursor((void *)HInstance, "LEFT");
Screen->Cursors[crUp] = LoadCursor((void *)HInstance, "UP");
Screen->Cursors[crDown] = LoadCursor((void *)HInstance, "DOWN");
Screen->Cursors[crThis] = LoadCursor((void *)HInstance, "THIS");
Screen->Cursors[crWhiteX] = LoadCursor((void *)HInstance, "WHITEX");


Related Discussions

Related Forums