#include "asynctmr.h"
#include "main.h"
static int main_panel;
static int sec;
int CVICALLBACK Timer_Seconds(int reserved,int timerId,int event,void
*callbackData,int eventData1,int eventData2)
{
if(sec == 59)
sec == 0;
else
sec++;
SetCtrlVal(main_panel,PANEL_SEC,sec);
return(0);
}
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR
lpszCmdLine, int nCmdShow)
{
if ((main_panel = LoadPanel (0, "main.uir", PANEL)) < 0)
return -1;
DisplayPanel (main_panel);
NewAsyncTimer(1.0,-1,1,Timer_Seconds,0);
RunUserInterface ();
DiscardPanel (main_panel);
return 0;
}
int CVICALLBACK MainPanel_Exit (int panel, int control, int event,void
*callbackData, int eventData1, int eventData2)
{
switch(event)
{
case EVENT_COMMIT:
QuitUserIn
terface(0);
break;
}
return 0;
}
Marlise wrote in message
news:393e6d06@newsgroups.ni.com...
>
> I am using Timer() to time the response time of a serial port but when I
move
> the panel or maximize and minimize any other applications the timer values
> are way off and stay that way. I have read the suggestions of using
NewAsyncTimer,
> but I am not sure exactly how it works. Could someone explain
NewAsyncTimer
> function to me, or show me an example of how it can replace the basic
Timer
> function? Thank you.