SetTimer not working

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello,

I have a welcome dialog which registers my users to a web server just after
the application is installed. This registragion may take from 5 to 30
seconds:

void CWelcomeDlg::OnBnClickedOK()

{

DoLengthyProcessing();

this->EndDialog(1);

}



As I said, the processing takes long to finish, so I wanted to show a
feedback to my users that the program hasn't stopped working. I inserted a
Static control and implemented a simple animation:



void CWelcomeDlg::OnTimer(UINT_PTR nIDEvent)

{

CStatic* pLabel = (CStatic*)GetDlgItem(IDC_LBL_PROCESSING);

CString strVal;

pLabel->GetWindowText(strVal);

if (strVal == L"/")

pLabel->SetWindowTextW(L"\\");

else if (strVal == L"\\")

pLabel->SetWindowTextW(L"/");

CDialog::OnTimer(nIDEvent);

}



and changed the previous click event shown before to start the timer:



void CWelcomeDlg::OnBnClickedOK()

{

m_nTimer = SetTimer(1, 1000, NULL);

DoLengthyProcessing();

KillTimer(m_nTimer);

this->EndDialog(1);

}



The problem is the timer isn't working while the lengthy procesing is
running. If I put the SetTimer() and KillTimer() inside the click event of
two command buttons, it works fine.

The processing connects with a Windows Service via named pipe, and the
Windows Service makes the needed registration via web.

Why the timer isn't working? How can I do the same if not with timer?

I tried moving the lengthy processing into a thread and kept the timer in
the main thread, but it not worked as well.

Please help.



Jeova


.



Relevant Pages

  • Re: device driver for the SGI system clock, mmtimer
    ... Here is the driver with the interrupt support "killed". ... The timer hardware was designed around the multimedia timer specification by ... +static int mmtimer_ioctl; ... * of the page where the registers are mapped) for the counter in question. ...
    (Linux-Kernel)
  • Re: SetTimer not working
    ... I have a welcome dialog which registers my users to a web server just after ... have the message pump stop. ... The problem is the timer isn't working while the lengthy procesing is ... Start a thread or an asynchronous I/O operation and return to the main message pump. ...
    (microsoft.public.vc.mfc)
  • Re: 89C51ED2
    ... clock, of course) and you set "timer compare" registers, which toggle ... I'm not sure how many of these timer compare register it has, ... number of events as long as your ISR is quick enough to not block other ...
    (sci.electronics.design)
  • Re: 89C51ED2
    ... clock, of course) and you set "timer compare" registers, which toggle ... I'm not sure how many of these timer compare register it has, ... number of events as long as your ISR is quick enough to not block other ... The "timer capture" input just responds to the timer input ...
    (sci.electronics.design)