Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Opening a console window from a Windows form project Pin
Zac Howland24-Jul-06 8:53
Zac Howland24-Jul-06 8:53 
GeneralRe: Opening a console window from a Windows form project Pin
David Crow24-Jul-06 8:55
David Crow24-Jul-06 8:55 
Questionmouse & keyboard disabling Pin
RomTibi24-Jul-06 8:06
RomTibi24-Jul-06 8:06 
AnswerRe: mouse & keyboard disabling Pin
Chris Losinger24-Jul-06 8:36
professionalChris Losinger24-Jul-06 8:36 
AnswerRe: mouse & keyboard disabling Pin
Steve Echols24-Jul-06 14:08
Steve Echols24-Jul-06 14:08 
GeneralRe: mouse & keyboard disabling Pin
RomTibi25-Jul-06 7:47
RomTibi25-Jul-06 7:47 
QuestionTile View problem when using Owner Data [modified] Pin
Justin Tay24-Jul-06 7:54
Justin Tay24-Jul-06 7:54 
QuestionPreTranslateMessage not called?? [modified] Pin
Rob Hounsell24-Jul-06 7:40
Rob Hounsell24-Jul-06 7:40 
Hi,

We have a C++ MFC application GUI that in the user thread, posts a user message using "PostMessage(SET_DLG_DATA_EVENT, 0, (LPARAM)pMsg)" to the GUI's message queue. We've also added a PreTranslateMessage method which gets called by the AFX message pump (CWnd::RunModalLoop) in the GUI thread before it dispatches the message it has removed from the queue; if this PreTranslateMessage method sees the message extracted from the queue is the user message posted in the user thread, it handles it and blocks winproc from seeing the user message.

However, whenever the user message is posted while left mouse button is clicked and held in the menu bar, the posted user message somehow gets routed to the winproc and PreTranslateMessage is not called. The stack trace from CWnd::WindowProc when it gets the user message shows no CWnd::RunModalLoop (the message pump): instead I get

> mfc71d.dll!CWnd::WindowProc(unsigned int message=1234, unsigned int wParam=0, long lParam=3320176) Line 1744 C++
mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x0012fcd0, HWND__ * hWnd=0x00200610, unsigned int nMsg=1234, unsigned int wParam=0, long lParam=3320176) Line 241 + 0x1a C++
mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x00200610, unsigned int nMsg=1234, unsigned int wParam=0, long lParam=3320176) Line 389 C++
mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x00200610, unsigned int nMsg=1234, unsigned int wParam=0, long lParam=3320176) Line 209 + 0x15 C++
user32.dll!77d48654()
user32.dll!77d48723()
mfc71d.dll!_AfxMsgFilterHook(int code=0, unsigned int wParam=2083117216, long lParam=2098704) Line 817 C++
user32.dll!77d49153()
user32.dll!77d4ee88()
user32.dll!77d49196()
ntdll.dll!77f75da3()
user32.dll!77d4a4d3()
user32.dll!77d4a017()
user32.dll!77d49f5b()
user32.dll!77d4a96e()
uxtheme.dll!5ad73f9b()
uxtheme.dll!5ad8aad7()
uxtheme.dll!5ad71ae1()
uxtheme.dll!5ad71c89()
user32.dll!77d4a9a4()
user32.dll!77d4a99a()
user32.dll!77d521ec()
user32.dll!77d52311()
user32.dll!77d48654()
user32.dll!77d48723()
user32.dll!77d4a7eb()
user32.dll!77d4aa95()
mfc71d.dll!CWnd::DefWindowProcA(unsigned int nMsg=1241808, unsigned int wParam=2082654585, long lParam=274) Line 1024 + 0x20 C++
mfc71d.dll!CThreadLocal<_AFX_THREAD_STATE>::GetData() Line 177 + 0xd C++
00000001()


If the mouse button is not held down, everything works fine.

Any ideas why the user message posted to the queue is routed differently while the mouse button is held down in the menu bar (non-client area?)

thanks,
Rob




-- modified at 13:49 Monday 24th July, 2006
QuestionPassing a variable Pin
DanYELL24-Jul-06 7:16
DanYELL24-Jul-06 7:16 
AnswerRe: Passing a variable [modified] Pin
Harold_Wishes24-Jul-06 7:24
Harold_Wishes24-Jul-06 7:24 
GeneralRe: Passing a variable Pin
DanYELL24-Jul-06 7:40
DanYELL24-Jul-06 7:40 
GeneralRe: Passing a variable Pin
DanYELL24-Jul-06 7:44
DanYELL24-Jul-06 7:44 
QuestionRe: Passing a variable Pin
David Crow24-Jul-06 8:05
David Crow24-Jul-06 8:05 
AnswerRe: Passing a variable Pin
prasad_som24-Jul-06 19:00
prasad_som24-Jul-06 19:00 
Questioncin issues [modified] Pin
Harold_Wishes24-Jul-06 6:52
Harold_Wishes24-Jul-06 6:52 
AnswerRe: cin issues Pin
David Crow24-Jul-06 6:54
David Crow24-Jul-06 6:54 
GeneralRe: cin issues [modified] Pin
Harold_Wishes24-Jul-06 7:07
Harold_Wishes24-Jul-06 7:07 
QuestionRe: cin issues Pin
David Crow24-Jul-06 7:52
David Crow24-Jul-06 7:52 
AnswerRe: cin issues Pin
Harold_Wishes24-Jul-06 8:08
Harold_Wishes24-Jul-06 8:08 
GeneralRe: cin issues Pin
David Crow24-Jul-06 8:32
David Crow24-Jul-06 8:32 
GeneralRe: cin issues Pin
Zac Howland24-Jul-06 9:13
Zac Howland24-Jul-06 9:13 
GeneralRe: cin issues Pin
David Crow24-Jul-06 9:22
David Crow24-Jul-06 9:22 
GeneralRe: cin issues Pin
Zac Howland24-Jul-06 9:30
Zac Howland24-Jul-06 9:30 
GeneralRe: cin issues [modified] Pin
Harold_Wishes24-Jul-06 9:28
Harold_Wishes24-Jul-06 9:28 
GeneralRe: cin issues Pin
Harold_Wishes24-Jul-06 9:23
Harold_Wishes24-Jul-06 9:23 

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.