• Create Account

#Actualmaya18222

Posted 28 December 2012 - 02:44 PM

I'm trying to devise a way of a getting some kind of timer to signal an event in my WPF application with an interval of around 5ms. My attempts with using a DispatchTimer or a Timer and having the interval set to 1ms, lead to their "tick" events being triggered at only around 60 times a second, which isnt fast enough.

Is there any way I can achieve something faster? either through some event mechanism or by any other means?

I would like something similar to that of a win32 application, as shown below.
int Application::run(){   while(msg.message != WM_QUIT)   {	    if(PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) // If there are Window messages then process them.	    {			 TranslateMessage( &msg );			 DispatchMessage( &msg );	    }	    else // Otherwise, do my work	    {    		    	    }   return (int)msg.wParam;}
I assume this is how WPF is doing it in the background with its Application.Run(Window()) method. Is there anyway of getting some kind of callback on that "else" branch?

#2maya18222

Posted 28 December 2012 - 02:44 PM

I'm trying to devise a way of a getting some kind of timer to signal an event in my WPF application with an interval of around 5ms. My attempts with using a DispatchTimer or a Timer and having the interval set to 1ms, lead to their "tick" events being triggered at only around 60 times a second, which isnt fast enough.

Is there any way I can achieve something faster? either through some event mechanism or by any other means?

I would like something similar to that of a win32 application, as shown below.
int Application::run(){   while(msg.message != WM_QUIT)   {	    if(PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) // If there are Window messages then process them.	    {			 TranslateMessage( &msg );			 DispatchMessage( &msg );	    }	    else // Otherwise, do my work	    {    		    	    }   return (int)msg.wParam;}
I assume this is how WPF is doing it in the background with its Application.Run(Window()) method. Is there anyway of getting some kind of callback on that "else" branch?

#1maya18222

Posted 28 December 2012 - 02:43 PM

I'm trying to devise a way of a getting some kind of timer to signal an event in my WPF application with an interval of around 5ms. My attempts with using a DispatchTimer or a Timer and having the interval set to 1ms, lead to their "tick" events being triggered at only around 60 times a second, which isnt fast enough.

Is there any way I can achieve something faster? either through some event mechanism or by any other means?

I would like something similar to that of a win32 application, as shown below.

int Application::run()
{
while(msg.message != WM_QUIT)
{
if(PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) // If there are Window messages then process them.
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else // Otherwise, do my work
{

}
return (int)msg.wParam;
}

I assume this is how WPF is doing it in the background with its Application.Run(Window()) method. Is there anyway of getting some kind of callback on that "else" branch?

PARTNERS