Solved

Modeless Dialog access in Console based applications

Posted on 2003-11-18
7
347 Views
Last Modified: 2013-11-20

I am trying to develop Console based application with Modless Dialog box.
This application has many class which does different operations like sending messages,
getting messages and various update process which I have to display on the modless dialog box.

I have created console based project with MFC support using App Wizard. Also able to create modless dialog

CModlessDlg *pDlg = new CModlessDlg;
pDlg->Create(IDD_DIALOG_MODLESS);
pDlg->ShowWindow(SW_SHOW);
..
call ClassA which gets messages and updates modless dlg on how many messges were received
call ClassB which sends messages and updates modless dlg on how many messges were sent
..
delete pDlg;

PROBLEM: I have to update this modless dialog box with how many messages recieved, how many messages sent etc from different class.

I tried GetDlgItem, GetDlgCtrlID in ClassA, ClassB but I am unsuccessfull and I am unable to get the handle of ModlessDlg and access its variable to update.
I think I am not using it in right way!!!

What is the best way do it?

As my application is console based unlike dialog based.
what extra plumbing is required to update the modless dlg ?

If anyone knows a better approach (other than modless) do let me know.

Thanks for all your help.

0
Comment
Question by:parekodi
  • 2
  • 2
7 Comments
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
Create dialog-based application using MFC Application Wizard - this is a better approach. When you work using the standard way, you have no problems.
0
 

Author Comment

by:parekodi
Comment Utility
I did use MFC Application Wizard. (Console application with MFC support)
But how can I communicate (or update) with a modeless dlg from different classes ?
Thanks.
0
 

Author Comment

by:parekodi
Comment Utility
I cannot use Dialog based MFC as many other programs call this application with command line parameters.
Thanks
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 50 total points
Comment Utility
MFC Win32 application can be called with command-line parameters. They are available in CWinApp::m_lpCmdLine member.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
either24  challenge 19 83
haveThree challenge 22 100
MaxSpan challenge 9 65
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 45
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now