A couple of things I notice about your code...
First, in your if
Code:
if (SQLInitTimer1 = false)
{
QueryPerformanceCounter(&SQLStrtTime);
SQLInitTimer1 = true;
}
you really need
Code:
if (SQLInitTimer1 == false)
and instead of
Code:
else if (SQLInitTimer1 = true)
you need
Code:
else if (SQLInitTimer1 == true)
Secondly, in this block
Code:
if (SQLInitTimer1 == false)
{
QueryPerformanceCounter(&SQLStrtTime);
SQLInitTimer1 = true;
}
else if (SQLInitTimer1 == true)
{
QueryPerformanceCounter(&SQLCurrTime);
QueryPerformanceFrequency(&SQLFreq);
SQLDiff = ((double)(SQLCurrTime.QuadPart - SQLStrtTime.QuadPart) / (double)(SQLFreq.QuadPart)) * 1000;
if (SQLDiff >= 500)
{
UpdateSQL();
SQLInitTimer1 = false;
}
}
If the initial state of SQLInitTime1 is not false, you will fall directly into your else if and SQLStartTime has not yet been initialized.
Hope that helps.
PS - Indentation and the use of code tags would really help you see the flow.