Относно console application ...
5 отговора
273 прегледа
Относно console application ...
Как може в програма от тип console application (с включен MFC) да се вгради TIMER и да се привърже функция за обработка на събитията, които той генерира ?
Re: Относно console application ...
Kum koi prozorec 6te pra6ta6 tezi suob6teniq (handle ???) :)
Re: Относно console application ...
Отделна нишка със sleep-ове вътре, или някой event обект, дето да таймаутва.
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>
<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>
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.
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.