CDocument & CMainFrame.
-
Is that any way that call CMainFrame's function from my CDocument class? Best Regards. MJM.
-
Is that any way that call CMainFrame's function from my CDocument class? Best Regards. MJM.
What's wrong with
AfxGetMainWnd()
?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
What's wrong with
AfxGetMainWnd()
?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
Do u mean i use
AfxGetMainWnd()
& then usePostMessage
to handling that with CMainFrame class? -
Do u mean i use
AfxGetMainWnd()
& then usePostMessage
to handling that with CMainFrame class?You indicated that you wanted to "call CMainFrame's function from my CDocument class."
AfxGetMainWnd()
is used to get a pointer to the frame window object. With that, you can call whatever function you need.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
You indicated that you wanted to "call CMainFrame's function from my CDocument class."
AfxGetMainWnd()
is used to get a pointer to the frame window object. With that, you can call whatever function you need.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
But i can not access function that i declare in
CMainFrame
object! for example i wroteCreatePane
function inCMainFrame
object. i wanna call this function fromCMyDocument
! i useAfxGetMainWnd
butm_pMainWnd
can not access CreatePane orCreatePane
did not declare in FrameWnd object! best Regards. MJM. -
But i can not access function that i declare in
CMainFrame
object! for example i wroteCreatePane
function inCMainFrame
object. i wanna call this function fromCMyDocument
! i useAfxGetMainWnd
butm_pMainWnd
can not access CreatePane orCreatePane
did not declare in FrameWnd object! best Regards. MJM.mostafa_pasha wrote:
But i can not access function that i declare in CMainFrame object!
Why not?
mostafa_pasha wrote:
but m_pMainWnd can not access CreatePane or
Probably because you forgot to cast the return value from
AfxGetMainWnd()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
mostafa_pasha wrote:
But i can not access function that i declare in CMainFrame object!
Why not?
mostafa_pasha wrote:
but m_pMainWnd can not access CreatePane or
Probably because you forgot to cast the return value from
AfxGetMainWnd()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
Thanks a lot , i forget casting! Best Regards. MJM.