Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

Modeless Dialog access in Console based applications


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
parekodi
Asked:
parekodi
  • 2
  • 2
1 Solution
 
AlexFMCommented:
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
 
parekodiAuthor Commented:
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
 
parekodiAuthor Commented:
I cannot use Dialog based MFC as many other programs call this application with command line parameters.
Thanks
0
 
AlexFMCommented:
MFC Win32 application can be called with command-line parameters. They are available in CWinApp::m_lpCmdLine member.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now