Instead of creating those buff0 and buff1 variables before the loop, I should have done:
for (int i = 0; i < 10; ++i) { unsigned a = i; unsigned b = i+1; msg->a = a; msg->b = b; SendWord(a); SendWord(b); }