Click here to Skip to main content
15,877,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to covert CString to TCHAR and CString to LPCWSTR? Pin
julych30-Jun-03 1:26
julych30-Jun-03 1:26 
AnswerRe: How to covert CString to TCHAR and CString to LPCWSTR? Pin
RChin30-Jun-03 1:39
RChin30-Jun-03 1:39 
AnswerRe: How to covert CString to TCHAR and CString to LPCWSTR? Pin
Peter Weyzen30-Jun-03 8:45
Peter Weyzen30-Jun-03 8:45 
Generalpointer to the app Pin
andyg.10130-Jun-03 1:16
andyg.10130-Jun-03 1:16 
GeneralRe: pointer to the app Pin
RChin30-Jun-03 1:43
RChin30-Jun-03 1:43 
GeneralRe: pointer to the app Pin
andyg.10130-Jun-03 2:21
andyg.10130-Jun-03 2:21 
GeneralRe: pointer to the app Pin
David Crow30-Jun-03 2:43
David Crow30-Jun-03 2:43 
GeneralRe: pointer to the app Pin
RChin30-Jun-03 3:23
RChin30-Jun-03 3:23 
DavidCrow wrote:
Yes, but it will return you a CWinApp pointer, not a CtheApp pointer

Exactly.
AfxGetApp() Returns a CWinApp class pointer. If you want to reference your specific class, you have to cast the returned pointer to your application class. This will allow you to access your member functions. The olden way of casting used to be of the form:
CMyClass* pClass = (CMyClass*)(ParentClass);
<pre>
</code>

But the (now) standard way of casting C++ classes take the form:
<pre>
<code>
CMyClass* pClass = static_cast<CMyClass*>(ParentClass);
</code>





"..Even my comments have bugs!"

Inspired by Toni78

GeneralVisual Studio 6.0 Pin
Bernhard30-Jun-03 1:13
Bernhard30-Jun-03 1:13 
GeneralRe: Visual Studio 6.0 Pin
Ryan Binns30-Jun-03 2:27
Ryan Binns30-Jun-03 2:27 
GeneralGot problems with COptionTree Pin
mike :D30-Jun-03 0:16
mike :D30-Jun-03 0:16 
GeneralRe: Got problems with COptionTree Pin
Dominik Reichl30-Jun-03 0:41
Dominik Reichl30-Jun-03 0:41 
GeneralRe: Got problems with COptionTree Pin
mike :D30-Jun-03 2:00
mike :D30-Jun-03 2:00 
GeneralRe: Got problems with COptionTree Pin
mike :D30-Jun-03 4:01
mike :D30-Jun-03 4:01 
Generalabout disable or enable Network card Pin
BensonCHUANG30-Jun-03 0:06
BensonCHUANG30-Jun-03 0:06 
GeneralDisassembler for IBM PC (SoftIce) Pin
BhaskarBora29-Jun-03 23:45
BhaskarBora29-Jun-03 23:45 
GeneralRe: Disassembler for IBM PC (SoftIce) Pin
Dominik Reichl30-Jun-03 0:47
Dominik Reichl30-Jun-03 0:47 
GeneralRe: Disassembler for IBM PC (SoftIce) Pin
BhaskarBora30-Jun-03 2:49
BhaskarBora30-Jun-03 2:49 
GeneralCreateService() Hangs Pin
vlvl29-Jun-03 23:42
vlvl29-Jun-03 23:42 
GeneralProblem about &quot;SetTimer&quot; function Pin
TERRY_LUK200329-Jun-03 23:17
TERRY_LUK200329-Jun-03 23:17 
GeneralRe: Problem about &quot;SetTimer&quot; function Pin
Dominik Reichl30-Jun-03 0:50
Dominik Reichl30-Jun-03 0:50 
GeneralRas connection statistics Pin
no_body6929-Jun-03 23:02
no_body6929-Jun-03 23:02 
GeneralRe: Ras connection statistics Pin
Dominik Reichl30-Jun-03 0:54
Dominik Reichl30-Jun-03 0:54 
GeneralRe: Ras connection statistics Pin
no_body6930-Jun-03 1:01
no_body6930-Jun-03 1:01 
QuestionHow To Create a Non Rectangular Control Pin
Vikrant Vikrant29-Jun-03 21:48
Vikrant Vikrant29-Jun-03 21:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.