Click here to Skip to main content
16,016,076 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to generate Keyboard events ? Pin
Member 383463023-Jul-09 0:43
Member 383463023-Jul-09 0:43 
AnswerRe: How to generate Keyboard events ? Pin
Adam Roderick J23-Jul-09 18:26
Adam Roderick J23-Jul-09 18:26 
QuestionGetting client computer name using its IP Pin
sunny_vc22-Jul-09 21:09
sunny_vc22-Jul-09 21:09 
AnswerRe: Getting client computer name using its IP Pin
Stuart Dootson22-Jul-09 21:40
professionalStuart Dootson22-Jul-09 21:40 
AnswerRe: Getting client computer name using its IP Pin
Emilio Garavaglia22-Jul-09 21:58
Emilio Garavaglia22-Jul-09 21:58 
QuestionHow to handle WM_KEYDOWN and WM_CHAR messages in Combo Box Pin
Pryabu22-Jul-09 20:21
Pryabu22-Jul-09 20:21 
AnswerRe: How to handle WM_KEYDOWN and WM_CHAR messages in Combo Box Pin
Code-o-mat22-Jul-09 21:19
Code-o-mat22-Jul-09 21:19 
QuestionResource Sharing issue Pin
georgekjolly22-Jul-09 20:03
georgekjolly22-Jul-09 20:03 
Dear All,
I have resource sharing issue in my MFC programming. Below, I will describe the scenario.
I am using VC++ 6.o version

I have a dialog(modeless) based application.
Main dialog box has a Button( say "Button1" ) with OnButton1(), that will call member function DisplayChildDialog()
I have a worker thread also, that will call DisplayChildDialog() using PostMessage() of main dialog.
DisplayChildDialog() will dispaly a child dialog(modal). Child dialog's object is created locally in DisplayChildDialog().

So DisplayChildDialog() will always called from the GUI thread.

Scenario:

When I clicks on "Button1", OnButton1() will call a member function DisplayChildDialog() and a child dialog(modal) will appear.
This time worker thread will also call DisplayChildDialog() using PostMessage() of Main dialog.

When I click on "Button1" DisplayChildDialog() will also call from worker thread using PostMessage(). of the main dialog. So two dialogs will appear simultaniously.

To avoid this situation I made the second caller of DisplayDialog() to enter in a MessageLoop, and will check a flag that will infrom whether the first caller has left the DisplayChildDialog() or not.

I wrote the message loop in DisplayDialog() like this.

DisplayDialog()
{
if( CChildDlg::m_bDisply == true )
{
while( GetMessage( &stMsg, 0, 0, 0 ))
{
TranslateMessage( &stMsg );
DispatchMessage( &stMsg );
if( false == CChildDialog::m_bDisply )
{
OutputDebugString( _T( "### Message loop false************************" ));
return;
}
}
}

CChildDlg::m_bDisply = true;

CChildDlg objChild;
objChild.DoModal();

CChildDlg::m_bDisply = false;
}

But this will work 5 or 6 times correctly. But after that, when I clicks on "Button1", the first caller of DisplayDialog() will terminate before showing the dialog box it will just make CChildDlg::m_bDisply = true. So the second caller will enter in Message loop and never exit.

I tried this too instead of above given message loop:
while( CChildDlg::m_bDisply && WaitMessage())
{
AfxGetApp()->PumpMessage();
}

But both given same result..

Please help me.
AnswerRe: Resource Sharing issue Pin
Code-o-mat22-Jul-09 21:40
Code-o-mat22-Jul-09 21:40 
QuestionHow can i make "make File" from VS 2005? Pin
bankey101022-Jul-09 19:40
bankey101022-Jul-09 19:40 
AnswerRe: How can i make "make File" from VS 2005? Pin
002comp22-Jul-09 19:47
002comp22-Jul-09 19:47 
GeneralRe: How can i make "make File" from VS 2005? Pin
bankey101022-Jul-09 19:59
bankey101022-Jul-09 19:59 
GeneralRe: How can i make "make File" from VS 2005? Pin
«_Superman_»22-Jul-09 20:12
professional«_Superman_»22-Jul-09 20:12 
GeneralRe: How can i make "make File" from VS 2005? Pin
bankey101022-Jul-09 20:26
bankey101022-Jul-09 20:26 
GeneralRe: How can i make "make File" from VS 2005? Pin
Stuart Dootson22-Jul-09 21:38
professionalStuart Dootson22-Jul-09 21:38 
AnswerRe: How can i make "make File" from VS 2005? Pin
_AnsHUMAN_ 22-Jul-09 22:34
_AnsHUMAN_ 22-Jul-09 22:34 
QuestionHiding Dialogs Pin
002comp22-Jul-09 19:31
002comp22-Jul-09 19:31 
AnswerRe: Hiding Dialogs Pin
chandu00422-Jul-09 19:37
chandu00422-Jul-09 19:37 
GeneralRe: Hiding Dialogs Pin
002comp22-Jul-09 19:40
002comp22-Jul-09 19:40 
GeneralRe: Hiding Dialogs Pin
chandu00422-Jul-09 19:44
chandu00422-Jul-09 19:44 
GeneralRe: Hiding Dialogs Pin
002comp22-Jul-09 19:46
002comp22-Jul-09 19:46 
GeneralRe: Hiding Dialogs Pin
chandu00422-Jul-09 19:48
chandu00422-Jul-09 19:48 
GeneralRe: Hiding Dialogs Pin
002comp22-Jul-09 19:54
002comp22-Jul-09 19:54 
AnswerRe: Hiding Dialogs Pin
hanq_3891013022-Jul-09 19:50
hanq_3891013022-Jul-09 19:50 
GeneralRe: Hiding Dialogs Pin
002comp22-Jul-09 19:53
002comp22-Jul-09 19:53 

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.