![]() To an RC file, you can add a cursor resource, which amounts to specifying the path to the ICO file. You've surely seen the resource file if you've done any Windows programming before. Fortunately, Windows provides a way to do this as part of an binary's resources. Instead, a cursor should be linked directly into your application's binary. If that file ever gets deleted, or isn't included, your application stops working. Why? Because you don't want to have to deploy a CUR file along with your application. But, other than for testing purposes, you probably won't find yourself ever using LoadCursorFromFile. You give it a path to a CUR file, and it loads it right up as a cursor, passing you a handle to that cursor ( HCURSOR). You have already found the LoadCursorFromFile function, and indeed, this one does exactly what its name suggests. With that out of the way, we don't really have to worry about the right way to call SetSystemCursor. It's totally fine if you want to display a funky cursor over a control in your application, but it is not okay if you replace the system-wide arrow cursor with a funky one! ![]() That's up to the user to change, if she wants to customize her desktop. That function gives you a way to change the global cursor settings-you know, the same ones you change in the Mouse control panel. Under no circumstances, then, would you be calling the SetSystemCursor function. For more background on this, you should definitely read Raymond Chen's article, "What is the process by which the cursor gets set?" This function takes a single parameter, a handle to the cursor ( HCURSOR). ![]() Upon receipt of this message, you will call the SetCursor function to set the cursor that should be displayed. If you want to change the cursor when it's over a particular control, you need to handle the WM_SETCURSOR message for that control's window. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |