|
I used SetTimer() API too.
Well, wouldit be easier if I post some code here?
Main dialog:
BOOL CTestDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
<br />
m_TimerId = SetTimer(1, 300, NULL);<br />
<br />
if (!::IsWindow(m_monitorDlg.GetSafeHwnd()))<br />
m_monitorDlg.Create(IDD_DIALOG_MONITOR, this); <br />
m_monitorDlg.ShowWindow(SW_SHOW);<br />
<br />
return TRUE;
}<br />
void CTestDlg::OnTimer(UINT nIDEvent) <br />
{<br />
if (nIDEvent == 1)<br />
::PostMessage(m_monitorDlg.GetSafeHwnd(), WM_USER+1, 0, 0);<br />
CDialog::OnTimer(nIDEvent);<br />
}
Monitor Dialog:
LRESULT CMonitorDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) <br />
{<br />
if (message == WM_USER+1)<br />
{<br />
m_list.InsertItem(0, "New message from Main dialog!");<br />
} <br />
return CDialog::WindowProc(message, wParam, lParam);<br />
}
In my opinion, it's all clear and simple. Any idea pls?!
Have a good time!
KEMI
|
|
|
|
|
I think it is because of the timer messages stop coming when you press and hold the left or right mouse buttons on the title bar etc. Then when you release the button, all the messages arrive that were stuck in the queue.
The solution could be to use multi-media timers.
this is this.
|
|
|
|
|
I have an app I wipped up and the timer messages arrive just find when I'm dragging the dialog.
Steve
|
|
|
|
|
Yes, the timer messages come just fine when dragging the window, but when you have the left button down on the Control-box the X button etc, that they stop. Also when you keep your Right-button down on the title-bar, that they stop coming as well.
this is this.
|
|
|
|
|
You're right. I didn't know that. You live and learn.
Steve
|
|
|
|
|
I've tried with multi-media timer already in SDI test application. It SEEMED work.
But when pressing and hold mouse buttons on title bar, application still blocked. And when mouse released, I found that some messages was added to list control in a batch. It seems like the message was queued and the interface still looks blocked. That not what I expected to see.
Thanks for your suggestion. Any other ideas?
Have a good time!
KEMI
|
|
|
|
|
I think you should check it again. I tried using the MM timer with a callback function and it worked well:
void CALLBACK MyTymer(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
Now that is the callback. You could start the timer using:
timeSetEvent(1000,1,MyTymer,(DWORD)this,TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
Notice the this as the user-argument. It will come to the Callback in the dwUser parameter. You can use it to call any parent's function from the Callback.
It does seem to be working.
this is this.
|
|
|
|
|
Ok, I missed the redraw part.
It seems that some controls do not draw properly during the blocking time.
You can try:
m_List.RedrawWindow(); to force a redraw. It should work.
this is this.
|
|
|
|
|
I added m_List.RedrawWindow(); right after m_list.InsertItem(0, "New message from Main dialog!");
But it still does not work. Messages are only inserted to list when mouse released as a bundle.
Have a good time!
KEMI
|
|
|
|
|
I have never tried with sending messages, which may be the problem. However, I used the member variables of the second dialog directly:
Here, m_Second is the second dialog.
CMainDlg* p = (CMainDlg*)dwUser;<br />
p->m_Second.m_List2.InsertItem(0,"Some text");<br />
p->m_Second.m_List2.RedrawWindow();
Still I am confused. I do suspect the PostMessage() etc to be the problem. Maybe.
this is this.
|
|
|
|
|
Well, it seems there is no solution to this problem. At least I can get my communication tread working in background. But not the interface!!
Thank you all!
and
Have a good time!
KEMI
|
|
|
|
|
Hi,
The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions post this message only when no other higher-priority messages are in the thread's message queue.
I think high priority messages are generated when the user press and hold mouse buttons on control box or title bar(as in your case).
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions post this message only when no other higher-priority messages are in the thread's message queue.
I read this from MSDN already.;)
Have a good time!
KEMI
|
|
|
|
|
VisuallC wrote: do you create timer in the monitor dialog and (if necessary post event timer dialog monitor to main dialog)
No! I created timer in the main dialog and post message to monitor dialog.
Have a good time!
KEMI
|
|
|
|
|
I am facing a problem i.e
"LNK4017: DESCRIPTION statement not supported for the target platform; ignored"
what is the cause of this warning and how best can we overcome this problem.
Can anyone suggest pls.
Thanks,
---Arun.
|
|
|
|
|
|
I want my program to know the network connection is alive or not, but I dont want to check this periodically.Is there any way to inform my program when the network goes down. ie when the network connection goes down it is informed to my code.
|
|
|
|
|
I call CreateProcess() to Start another exe,but it fail,
I use GetLastError() ,the ErrorCode is 299;
my code is:
CString strUninstallProc = "c:\\1.exe";
char buffer[20];
CString strCommandLine = " /n ";
strCommandLine += " /p 873w ";
strCommandLine += strPartCmdLine;
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
ZeroMemory(&siStartInfo, sizeof(STARTUPINFO) );
siStartInfo.cb = sizeof(STARTUPINFO);
BOOL bCreation = CreateProcess(strUninstallProc,
strCommandLine.GetBuffer(strCommandLine.GetLength()),
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&siStartInfo,
&piProcInfo);
strCommandLine.ReleaseBuffer();
if (bCreation)
{}
else
{}
thanks
|
|
|
|
|
My problem is that I want to export a MFC class inside a DLL. Normally, We only export a function of a DLL. Now, I want to export a class, but I don't know. Would you tell me this technique or point me to the specific websites.
|
|
|
|
|
class __declspec(dllexport) CYourMFC_Class:public CMFCObject
{
public:
};
You have to change the above to the following in your header file where you are using it... i.e the place where you are using the dll .
class __declspec(dllimport) CYourMFC_Class:public CMFCObject
{
public:
};
Owner drawn
Jesus Loves
|
|
|
|
|
Hi,
I'm having an odd problem with a separate window I'm popping up in my application using a richedit;
When the richedit control is fully scrolled to the bottom, and the window is minimized, and text is added to the richedit, when the window is maximized, it will be blank. It appears that it has arbitrarily scrolled down an extra 'page' so put all the text out of view. However, once the scrollbar is clicked on, everything immediately displays properly. I've searched around for what might cause the problem but can't find the culprit, so I was thinking I could simply simulate sending a 'clicked on scrollbar' message to the window as soon as focus was set to it.
However I haven't been able to find the windows message that is sent when a scrollbar is clicked on (not necessarily moved, just clicked on).
Which message is this?
Or any other thoughts as to how to fix the problem?
Thanks!!
Kelly Ryan
|
|
|
|
|
Found a way to fix it, nevermind.
Kelly Ryan
|
|
|
|
|
How?
Owner drawn
Jesus Loves
|
|
|
|
|
Does a static data member come into existence in memory before, at the same time as, or after any instances of its class?
|
|
|
|
|
It would exist independently of the class, I'd imagine that as it has to exist prior to the first time it is accessed, it's probably created when your program starts.
Christian Graus - Microsoft MVP - C++
|
|
|
|