Thread: Load a cursor...

  1. #1
    A source of questions... Benji Wiebe's Avatar
    Join Date
    Mar 2011
    Location
    Durham, Kansas
    Posts
    69

    Load a cursor...

    I would like to load a cursor after a push-button is clicked.
    Here is my code.
    Code:
                           HCURSOR corroded;
                                     ......................
                 case IDC_LOAD_CURSOR:
                      corroded=LoadCursor (  hInst,
                                               MAKEINTRESOURCE(IDI_CURSOR1));
                      SetCursor(corroded);
                       return TRUE;
                                  .............................
    Is there a simple function I have overlooked?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok... you have a cursor in your resources, coupled to IDI_CURSOR1... hInst is the HINSTANCE of your program?
    It should work.

    What errors are you getting?
    What is the value of corroded after the call... If LoadCursor() fails it will return NULL, so you should probably test for that before calling SetCursor().

  3. #3
    A source of questions... Benji Wiebe's Avatar
    Join Date
    Mar 2011
    Location
    Durham, Kansas
    Posts
    69

    What????

    When I run the program, the cursor is supposed to change to 'corroded' when I click the push button. When the program is run, though, all it does is nothing. The cursor still is the default cursor.
    Last edited by Benji Wiebe; 04-20-2011 at 06:47 PM. Reason: clarity

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok... are you getting compiler errors? what are they?
    Have you checked if the button actually fires the case event? (hint: Put a Beep(500,100); in there so you can hear it fire.)
    Have you checked the return value of LoadCursor() to see if it's actually loading the cursor?
    Have you checked the return value of SetCursor() to see if it's actually trying to set the cursor?

    Really... "WHAT???" ... just doesn't cut it here...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My ini load code.
    By RMDan in forum C Programming
    Replies: 16
    Last Post: 06-25-2009, 12:07 AM
  2. How can i load a picture ?
    By Skull in forum C++ Programming
    Replies: 0
    Last Post: 12-30-2007, 04:11 PM
  3. Can't Load TGA?
    By arew264 in forum Game Programming
    Replies: 9
    Last Post: 05-02-2007, 11:37 AM
  4. App or DLL Load address
    By bman1176 in forum Windows Programming
    Replies: 2
    Last Post: 02-28-2006, 02:36 PM
  5. Cpu Load
    By Fric in forum C Programming
    Replies: 9
    Last Post: 03-28-2005, 06:26 PM