Click here to Skip to main content
16,011,611 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sending non-keyboard chars Pin
phlipping27-Jul-03 15:25
phlipping27-Jul-03 15:25 
GeneralRe: Sending non-keyboard chars Pin
Beer2627-Jul-03 15:51
Beer2627-Jul-03 15:51 
GeneralRe: Sending non-keyboard chars Pin
phlipping27-Jul-03 16:48
phlipping27-Jul-03 16:48 
GeneralRe: Sending non-keyboard chars Pin
Abin27-Jul-03 17:33
Abin27-Jul-03 17:33 
GeneralRe: Sending non-keyboard chars Pin
phlipping27-Jul-03 18:04
phlipping27-Jul-03 18:04 
GeneralRe: Sending non-keyboard chars Pin
Beer2627-Jul-03 18:20
Beer2627-Jul-03 18:20 
GeneralRe: Sending non-keyboard chars Pin
phlipping27-Jul-03 18:32
phlipping27-Jul-03 18:32 
GeneralMDI window title when created Pin
michael_cowan27-Jul-03 13:35
michael_cowan27-Jul-03 13:35 
Hi,

I need to be able to get the window name of a MDI window when it is created. I tried adding the following code to CProjectNameDoc::OnNewDocument() :
<br />
CProjectNameDoc::OnNewDocument()<br />
{<br />
	if (!CDocument::OnNewDocument()) return FALSE;<br />
<br />
	CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();<br />
	<br />
	HWND	hWnd;<br />
	TCHAR	szWndTitle[256];<br />
<br />
	hWnd = ::GetWindow(pMainFrame->m_hWndMDIClient, GW_CHILD);<br />
	<br />
	::GetWindowText(hWnd,szWndTitle,<br />
               sizeof(szWndTitle)/sizeof(szWndTitle[0]));<br />
<br />
	AfxMessageBox(szWndTitle);<br />
}<br />

This however does not work correctly. The name displayed when I create a new window is the name of the window before.

The reason for this (as far as I can tell) is that OnNewDocument() is called before the window is created, so the name of the currently selected one is returned.

Any ideas how to fix this?

Thanks,
Mike

I also need to get a pointer to this window. I tried:
((CMainFrame *)AfxGetMainWnd())->GetActiveFrame()
But this seems to have the same time problem as before. I get a pointer to the window before the one being created ... Confused | :confused:


There are 10 people in the world
Those who understand binary and those who dont

GeneralRe: MDI window title when created Pin
Beer2627-Jul-03 14:26
Beer2627-Jul-03 14:26 
GeneralWin98 DDK --&gt;XP Pin
Kuniva27-Jul-03 10:48
Kuniva27-Jul-03 10:48 
GeneralRe: Win98 DDK --&gt;XP Pin
J. Dunlap27-Jul-03 10:50
J. Dunlap27-Jul-03 10:50 
GeneralRe: Win98 DDK --&gt;XP Pin
Kuniva27-Jul-03 10:58
Kuniva27-Jul-03 10:58 
GeneralRe: Win98 DDK --&gt;XP Pin
Kuniva27-Jul-03 12:14
Kuniva27-Jul-03 12:14 
GeneralRe: Win98 DDK -->XP Pin
Beer2627-Jul-03 12:16
Beer2627-Jul-03 12:16 
GeneralRe: Win98 DDK --&gt;XP Pin
Alexander M.,27-Jul-03 12:59
Alexander M.,27-Jul-03 12:59 
GeneralRe: Win98 DDK --&gt;XP Pin
Kuniva27-Jul-03 23:22
Kuniva27-Jul-03 23:22 
QuestionHow to access a local variable from a different Dialog box Pin
Deepak Samuel27-Jul-03 10:30
Deepak Samuel27-Jul-03 10:30 
AnswerRe: How to access a local variable from a different Dialog box Pin
Joe Woodbury27-Jul-03 10:43
professionalJoe Woodbury27-Jul-03 10:43 
Generalcreating virtual directory in vc++ Pin
NewSilence27-Jul-03 10:08
NewSilence27-Jul-03 10:08 
QuestionFormView and MDI ????? Pin
_skidrow_vn_27-Jul-03 8:24
_skidrow_vn_27-Jul-03 8:24 
GeneralError on OLECHAR FAR* Pin
Small Rat27-Jul-03 5:49
Small Rat27-Jul-03 5:49 
GeneralRe: Error on OLECHAR FAR* Pin
Beer2627-Jul-03 6:01
Beer2627-Jul-03 6:01 
GeneralRe: Error on OLECHAR FAR* Pin
Small Rat27-Jul-03 6:15
Small Rat27-Jul-03 6:15 
GeneralRe: Error on OLECHAR FAR* Pin
Beer2627-Jul-03 6:23
Beer2627-Jul-03 6:23 
GeneralRe: Error on OLECHAR FAR* Pin
Small Rat27-Jul-03 11:01
Small Rat27-Jul-03 11:01 

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.