[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

AfxGetApp() detaild

Posted on 2004-09-26
8
Medium Priority
?
871 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
5 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 200 total points
ID: 12155305
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
ID: 12155468
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
ID: 12155689
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
ID: 12171594
Do you have more doubts?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12560496
I hope I have made an understandable explanation.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

872 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