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

x
?
Solved

CWnd for monitoring needed

Posted on 2009-04-22
3
Medium Priority
?
253 Views
Last Modified: 2013-12-14
Hi experts,

I need a window that allows me to click on it, but that doesn't want  the focus.

I have some dialogs that start / stop a network connection. Therefore I want to have another window that monitors the status of the network.
The monitor status dialog should be always visible beside the modal dialogs.
As a common way to display status text, I use a CListCtrl.
Problem: The modal dialogs doesn't allow me to click on the CListCtrl of the Status window - which would be nice to allow the user to scroll the CListCtrl.

In my case, there are more than one modal dialogs following after one another.
Therefore I don't want a parent window-child window relation between the modal dialogs and the status monitor window.
Thanks experts.
class CMyMonitor : public CWnd
{
private:
	CListCtrl m_data;
public:
    CMyMonitor(void);
    ~CMyMonitor(void);
	void Init(CRect& pos);
	void AddString(CString s);
	void ClearMonitor(void);
 
protected:
 
    DECLARE_DYNCREATE(CMyMonitor)
    DECLARE_MESSAGE_MAP()
};
 
IMPLEMENT_DYNCREATE(CMyMonitor, CWnd)
 
BEGIN_MESSAGE_MAP(CMyMonitor, CWnd)
END_MESSAGE_MAP()
 
CMyMonitor::CMyMonitor(void)
{
}
CMyMonitor::~CMyMonitor(void)
{
	m_data.DestroyWindow();
}
void CMyMonitor::Init(CRect& pos)
{	
	m_data.DestroyWindow();
	m_data.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_LIST | LVS_NOCOLUMNHEADER, pos, AfxGetMainWnd(), 1);
}
void CMyMonitor::AddString(CString s)
{
	if(::IsWindow(m_data.m_hWnd))
	{
		m_data.InsertItem(0, s);
	}
}
void CMyMonitor::ClearMonitor(void)
{
	if(::IsWindow(m_data.m_hWnd))
	{
		m_data.DeleteAllItems();
	}
}

Open in new window

0
Comment
Question by:stev75
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 1000 total points
ID: 24204142
Hi stev75,

have you tried to show that 'monitor' as a modeless dialog? You can create such a modeless dialog before showing the first modal dialog. As parent of the modeless dialog you can use the desktop window (or a parent window of your modal dialogs if one exists) so there shouldn't be a problem showing multiple modal dialogs one after the other.

ZOPPO
0
 

Author Closing Comment

by:stev75
ID: 31573248
Hi Zoppo,

thanks, easy solution. I had the parent AfxGetMainWnd() before, so it was under the modal loop control of the application. Now it's the desktop, andf it works!! Very Good!
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 24204418
Fine, I'm glad I could help you ...

have a nice day,

best regards,

ZOPPO
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

580 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