Относно console application ...

5 отговора 273 прегледа
#1

Относно console application ...

Как може в програма от тип console application (с включен MFC) да се вгради TIMER и да се привърже функция за обработка на събитията, които той генерира ?

Отговор
в отговор на LNL #2

Re: Относно console application ...

Kum koi prozorec 6te pra6ta6 tezi suob6teniq (handle ???) :)

Отговор
в отговор на LNL #3

Re: Относно console application ...

Отделна нишка със sleep-ове вътре, или някой event обект, дето да таймаутва.

Отговор
в отговор на LNL #4

Re: Относно console application ...

wij SetWaitableTimer

Отговор
в отговор на LNL #5

Re: Относно console application ...

ami shte si napishesh callback funkcia
<MSDN>
An application can also create a timer whose WM_TIMER messages are processed not by the main window procedure but by an application-defined callback function, as in the following code sample, which creates a timer and uses the callback function MyTimerProc to process the timer's WM_TIMER messages.

// Set the timer.

SetTimer(hwnd, // handle to main window
IDT_TIMER3, // timer identifier
5000, // 5-second interval
(TIMERPROC) MyTimerProc); // timer callback
</MSDN>

Отговор
в отговор на muku #6

Re: Относно console application ...

и сега ако беше дочел страницата :

Remarks
An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER.

Отговор