Solved

AfxGetApp() detaild

Posted on 2004-09-26
8
795 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
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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 86
Replacement selected text 2 61
scoreUp challenge 14 62
Capture logon name 13 73
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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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