Ok well that confirms your assumption about the value of RAND_MAX, and the print function is the problem. I would try some version of sprintf(). So instead of:
Try:Code:>_tcscpy(ProductID, _T("{%8X-%4X-%4X-%4X-%12X}", rand(), rand(), rand(), rand(), rand()));
And if that doesn't work or there is no such animal, then try sprintf():Code:_tsprintf(ProductID, _T("{%8X-%4X-%4X-%4X-%12X}", rand(), rand(), rand(), rand(), rand()));
Code:_sprintf(ProductID, "{%8X-%4X-%4X-%4X-%12X}", rand(), rand(), rand(), rand(), rand()));