Click here to Skip to main content
15,921,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change the name of MFC application Pin
vandana728-May-08 6:04
vandana728-May-08 6:04 
AnswerRe: Change the name of MFC application Pin
_AnsHUMAN_ 28-May-08 1:26
_AnsHUMAN_ 28-May-08 1:26 
QuestionMaximize Window Pin
vandana728-May-08 0:50
vandana728-May-08 0:50 
AnswerRe: Maximize Window Pin
Hamid_RT28-May-08 1:09
Hamid_RT28-May-08 1:09 
GeneralRe: Maximize Window Pin
vandana728-May-08 6:14
vandana728-May-08 6:14 
GeneralRe: Maximize Window Pin
Hamid_RT28-May-08 18:24
Hamid_RT28-May-08 18:24 
AnswerRe: Maximize Window Pin
SandipG 28-May-08 1:16
SandipG 28-May-08 1:16 
QuestionParent and Child in separate UI Threads Pin
Denis Adamchuk28-May-08 0:30
Denis Adamchuk28-May-08 0:30 
Hi,

I have an application very similar to the MTMDI sample from MSDN but instead
of deriving CBounceWnd from CWnd and drawing a flying ball I derived it
from CDialog and placed there some controls (CButton and CEdit).
So I have a window running in a separate thread with a parent window in the
main thread.

But on moving/resizing the CBounceWnd is not painted correctly. It has areas
which are not repainted.

We have a workaround for solving a problem with painting in 2 UI threads and
I would be VERY glad if you have any ideas about risks of implementing it.
Say, CSeparateThreadWnd is a CWnd that runs in a separate thread and has a
parent in the main thread. And we do the following:
BOOL CSeparateThreadWnd::PreTranslateMessage(MSG* pMsg) 
{
   return m_pParentWnd->SendMessage(ID_SOMETHING, reinterpret_cast<wparam>(pMsg), 0);
}

LRESULT CParentWnd::OnID_SOMETHING(WPARAM i_wParam, LPARAM)
{
   return AfxPreTranslateMessage(reinterpret_cast<msg*>(i_wParam));
}
</msg*></wparam>


I suppose it's related to the fact that MFC has two different
Permanent HWND<->CWnd maps for 2 threads and when PreTranslateMessage()
is executed in the second thread it reverses by a tree child-parent and
when finds a parent from the first thread assumes that CWnd is NULL and
aborts further traversing.
So we manually throw a message to the main thread to handle all parent
windows operations that were not done.

Is it acceptable?

Is there another solution for the task of placing a child window in a
separate thread?

Thanks a lot!
QuestionCan I download any file from any website automaticlly? Pin
sumit.durg27-May-08 23:55
sumit.durg27-May-08 23:55 
AnswerRe: Can I download any file from any website automaticlly? Pin
Nibu babu thomas28-May-08 0:17
Nibu babu thomas28-May-08 0:17 
GeneralRe: Can I download any file from any website automaticlly? Pin
sumit.durg28-May-08 1:03
sumit.durg28-May-08 1:03 
GeneralRe: Can I download any file from any website automaticlly? Pin
Nibu babu thomas28-May-08 1:07
Nibu babu thomas28-May-08 1:07 
QuestionHorizontal Scrollbar in Workspace? Pin
Le@rner27-May-08 23:39
Le@rner27-May-08 23:39 
QuestionRegarding Reference variable Pin
kuttiam27-May-08 22:47
kuttiam27-May-08 22:47 
AnswerRe: Regarding Reference variable Pin
CPallini27-May-08 22:55
mveCPallini27-May-08 22:55 
AnswerRe: Regarding Reference variable Pin
Jijo.Raj27-May-08 22:56
Jijo.Raj27-May-08 22:56 
AnswerRe: Regarding Reference variable [modified] Pin
Nibu babu thomas27-May-08 22:57
Nibu babu thomas27-May-08 22:57 
Questioncannot add icon to tree control [modified] Pin
tataxin27-May-08 21:06
tataxin27-May-08 21:06 
AnswerRe: cannot add icon to tree control Pin
SandipG 27-May-08 21:18
SandipG 27-May-08 21:18 
NewsRe: cannot add icon to tree control Pin
tataxin27-May-08 21:39
tataxin27-May-08 21:39 
QuestionTrack the internet download and upload usage Pin
vicky0000027-May-08 20:54
vicky0000027-May-08 20:54 
AnswerRe: Track the internet download and upload usage Pin
sumit.durg28-May-08 0:10
sumit.durg28-May-08 0:10 
GeneralRe: Track the internet download and upload usage Pin
vicky000006-Jul-08 23:10
vicky000006-Jul-08 23:10 
AnswerRe: Track the internet download and upload usage Pin
Rajkumar R28-May-08 2:28
Rajkumar R28-May-08 2:28 
QuestionPaint Problem Pin
john563227-May-08 20:35
john563227-May-08 20:35 

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.