Solved

AfxGetApp() detaild

Posted on 2004-09-26
8
762 Views
Last Modified: 2013-11-20
Can someone tell me what AFxGetApp() is used for, in simple terms.
This is method belonging to which class.
in one program i have seen recently, what they r doing is there is handle to a cursor.
HCursor l;
and then
then do this
l=AfxGetApp()->LoadStandardCursor(IDC_ARROW)
SetCursor(l);

I know tht this is for changing the cursor to an arrow.
but can u explain the role od AfxGetApp and the cursor handle.SetCursor belongs to which class.
In this all a part of CWnd class.

Please give a "layman"expl
0
Comment
Question by:vikasgkutty
  • 4
8 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 50 total points
Comment Utility
When you create an MFC application with the AppWizard, CWinApp derived object is always created, it is called always 'theApp', no matters how your project is named.
So, basically, AfxGetApp returns you a pointer to this object, so you can use all the functions that have this object class.
In this case, CWinApp has a function called LoadStandardCursor(), because the cursor is normally a resource of the application (.exe) file, or alternatively a system resource like IDC_ARROW.

0
 

Author Comment

by:vikasgkutty
Comment Utility
ok,
so, what is SetCursor, is it also a method of CWinApp
if u dont mind, can u also explaina bit aout handles.
like HCursor.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
HCURSOR is an identifier for a cursor you load into memory, it can be a system cursor o a propietary cursor.
SetCursor is not a mehtod of CWinApp. It is a global function, not related to a specific class.
Have a look to MSDN documentation:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/setcursor.asp
SetCursor needs a handle to your chosen cursor.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
Do you have more doubts?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
I hope I have made an understandable explanation.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now