Click here to Skip to main content
16,005,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionany body knows structures??? Pin
Inder gujral7-Jun-06 15:17
Inder gujral7-Jun-06 15:17 
AnswerRe: any body knows structures??? Pin
Christian Graus7-Jun-06 17:01
protectorChristian Graus7-Jun-06 17:01 
GeneralRe: any body knows structures??? Pin
bob169727-Jun-06 18:31
bob169727-Jun-06 18:31 
AnswerRe: any body knows structures??? Pin
Michael Dunn7-Jun-06 19:29
sitebuilderMichael Dunn7-Jun-06 19:29 
GeneralRe: any body knows structures??? Pin
NiceNaidu7-Jun-06 19:59
NiceNaidu7-Jun-06 19:59 
QuestionHow to enable CDialogBar always? Pin
Yusuf7-Jun-06 14:53
Yusuf7-Jun-06 14:53 
QuestionASSERT(::IsWindow(m_hWnd)); Pin
DanYELL7-Jun-06 14:01
DanYELL7-Jun-06 14:01 
AnswerRe: ASSERT(::IsWindow(m_hWnd)); [modified] Pin
bob169727-Jun-06 17:26
bob169727-Jun-06 17:26 
First off, the class CView1 will need to know about the dlg class so lets say the dlg class is called CMyDialog.

In your CView1 cpp file, you will need to include "mydialog.h"
/*
Note: When you do this with an SDI/MDI app, whenever you include the view, you will also need to include the doc, in that order because the view has some references to the doc that will generate errors if it can't figure out what the doc class is.
*/

Now in this class, you can call

void CView1::DoStuff()
{
CMyDialog* pWnd=(CMyDialog*)AfxGetMainWnd();
CString sEdit;

if (pWnd) {
pWnd->m_Edit1.GetWindowText(sEdit);
TRACE(sEdit);
}
}

/*
Remember that when you get asserts like that to make sure the window you are trying to get a pointer to exists. If you put this code in the constructor of CView1, for example, you will likely get asserts or errors of some kind.
*/

For other generic CWnd functions, you won't need the cast or the include.

Usually, any code that accesses the dialogs children is probably best placed in the dialog class to avoid dependent coupling like this. However, I hate it when people question "why" I'm doing this or that a certain way so as not to become a hypocrite, just consider that last statement a passing, friendly, reminder or helpful hint.;)

Take care

-- modified at 23:27 Wednesday 7th June, 2006
QuestionCallback function arguments Pin
vasanth10047-Jun-06 12:42
vasanth10047-Jun-06 12:42 
AnswerRe: Callback function arguments Pin
Cedric Moonen7-Jun-06 20:20
Cedric Moonen7-Jun-06 20:20 
GeneralRe: Callback function arguments Pin
vasanth10048-Jun-06 3:51
vasanth10048-Jun-06 3:51 
GeneralRe: Callback function arguments Pin
Cedric Moonen8-Jun-06 3:58
Cedric Moonen8-Jun-06 3:58 
GeneralRe: Callback function arguments Pin
vasanth10048-Jun-06 4:45
vasanth10048-Jun-06 4:45 
GeneralRe: Callback function arguments Pin
Cedric Moonen8-Jun-06 4:57
Cedric Moonen8-Jun-06 4:57 
QuestionRetrieve Process %CPU Usage and Thread Count Pin
Nonna147-Jun-06 11:19
Nonna147-Jun-06 11:19 
AnswerRe: Retrieve Process %CPU Usage and Thread Count Pin
Naveen7-Jun-06 17:43
Naveen7-Jun-06 17:43 
AnswerRe: Retrieve Process %CPU Usage and Thread Count Pin
ThatsAlok7-Jun-06 19:54
ThatsAlok7-Jun-06 19:54 
Questionplugin support coding in c++ project(advice please) Pin
sawerr7-Jun-06 11:14
sawerr7-Jun-06 11:14 
AnswerRe: plugin support coding in c++ project(advice please) Pin
Chris Losinger7-Jun-06 11:54
professionalChris Losinger7-Jun-06 11:54 
GeneralRe: plugin support coding in c++ project(advice please) Pin
sawerr7-Jun-06 18:00
sawerr7-Jun-06 18:00 
GeneralRe: plugin support coding in c++ project(advice please) Pin
Chris Losinger8-Jun-06 1:11
professionalChris Losinger8-Jun-06 1:11 
QuestionMFC71.dll missing export link SHLWAPI.dll:UrlUnescapeA Pin
tbrake7-Jun-06 10:23
tbrake7-Jun-06 10:23 
AnswerRe: MFC71.dll missing export link SHLWAPI.dll:UrlUnescapeA Pin
bob169727-Jun-06 19:23
bob169727-Jun-06 19:23 
QuestionRemote Desktop with UDP socket [modified] Pin
lynchspawn7-Jun-06 9:52
lynchspawn7-Jun-06 9:52 
QuestionMDI Tab and more Pin
bingshen7-Jun-06 9:49
bingshen7-Jun-06 9:49 

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.