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

C / C++ / MFC

 
QuestionHandle of a Bitmap Image ? Pin
ArunKGoyal18-Dec-02 22:26
ArunKGoyal18-Dec-02 22:26 
AnswerRe: Handle of a Bitmap Image ? Pin
PDStone18-Dec-02 22:34
PDStone18-Dec-02 22:34 
AnswerRe: Handle of a Bitmap Image ? Pin
Dominik Reichl18-Dec-02 22:39
Dominik Reichl18-Dec-02 22:39 
GeneralRe: Problem with CFileDialog Pin
PDStone18-Dec-02 22:24
PDStone18-Dec-02 22:24 
QuestionMessage transfer between two classes? Pin
chen18-Dec-02 21:32
chen18-Dec-02 21:32 
AnswerRe: Message transfer between two classes? Pin
Rage18-Dec-02 21:42
professionalRage18-Dec-02 21:42 
GeneralRe: Message transfer between two classes? Pin
chen18-Dec-02 21:53
chen18-Dec-02 21:53 
AnswerRe: Message transfer between two classes? Pin
Rage18-Dec-02 23:35
professionalRage18-Dec-02 23:35 
Declare
CRITICAL_SECTION m_cs;
int *m_myData;   //or whatever it is


as member variables in B.
In OnInitDialog of B :

InitializeCriticalSection(&m_cs);


So, in the thread A :

CWnd* pWnd=AfxGetMainWnd();
CMainDlg *pMainDlg=(CMainDlg*)pWnd;   //where CMainDlg is your B class

... do some stuff ...

EnterCriticalSection(&pMainDlg->m_cs);
pMainDlg->m_myData[8]=22;  //or whatever
LeaveCriticalSection(&pMainDlg->m_cs);


And in the "show" section of B:

EnterCriticalSection(m_cs);
//Here update Data display
LeaveCriticalSection(m_cs);


So that's the start. You may have member variables in B which simply copies member variables of A just for display purposes. Of course, this is not a _good_ way to do multithreading, but i think that it is simple enough, and it works if the updating of data in the thread is not too time-critical.

If this doesn't work, you're going to use CEvent's ...









~RaGE();
GeneralRe: Message transfer between two classes? Pin
Joe Woodbury19-Dec-02 5:33
professionalJoe Woodbury19-Dec-02 5:33 
GeneralRe: Set current date and time from the computer.Pls Help..Thanks Pin
Christian Graus18-Dec-02 20:42
protectorChristian Graus18-Dec-02 20:42 
GeneralRe: Set current date and time from the computer.Pls Help..Thanks Pin
Rage18-Dec-02 21:33
professionalRage18-Dec-02 21:33 
GeneralRe: Set current date and time from the computer.Pls Help..Thanks Pin
dianazheng18-Dec-02 21:57
dianazheng18-Dec-02 21:57 
GeneralRe: Set current date and time from the computer.Pls Help..Thanks Pin
Rage18-Dec-02 23:18
professionalRage18-Dec-02 23:18 
GeneralRe: Set current date and time from the computer.Pls Help..Thanks Pin
Rage19-Dec-02 0:06
professionalRage19-Dec-02 0:06 
GeneralRe: Set current date and time from the computer.Pls Help..Thanks Pin
dianazheng19-Dec-02 15:22
dianazheng19-Dec-02 15:22 
QuestionMust I call DeleteObject after CStatic::SetBitmap ??? Pin
Daniel Strigl18-Dec-02 20:21
Daniel Strigl18-Dec-02 20:21 
AnswerRe: CStatic - SetBitmap - DeleteObject ??? Pin
Christian Graus18-Dec-02 20:44
protectorChristian Graus18-Dec-02 20:44 
GeneralRe: CStatic - SetBitmap - DeleteObject ??? Pin
Daniel Strigl18-Dec-02 20:52
Daniel Strigl18-Dec-02 20:52 
GeneralRe: CStatic - SetBitmap - DeleteObject ??? Pin
Christian Graus18-Dec-02 21:11
protectorChristian Graus18-Dec-02 21:11 
AnswerRe: CStatic - SetBitmap - DeleteObject ??? Pin
Joan M18-Dec-02 20:45
professionalJoan M18-Dec-02 20:45 
GeneralRe: CStatic - SetBitmap - DeleteObject ??? Pin
Daniel Strigl18-Dec-02 20:54
Daniel Strigl18-Dec-02 20:54 
GeneralPainting Toolbar's parent window while it is floating Pin
Anonymous18-Dec-02 20:15
Anonymous18-Dec-02 20:15 
QuestionHow to open browser Pin
Anonymous18-Dec-02 20:15
Anonymous18-Dec-02 20:15 
AnswerRe: How to open browser Pin
Christian Graus18-Dec-02 20:45
protectorChristian Graus18-Dec-02 20:45 
AnswerRe: How to open browser Pin
Rage18-Dec-02 21:46
professionalRage18-Dec-02 21:46 

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.