Important info!

I was just encountering a bug where assignment of a DWORD var wasn't working right.
I was converting a float directly to a DWORD during the assignment. It worked most of the time, but every now and then it didn't.
I'm not completely sure what causes this problem, but I'm guessing it has to do with the byte alignment of the var in the memory.
So, just wanted to say... always convert your floats into longs before converting them to DWORDs, and convert your doubles to long-longs before converting them to QWORDs.

“I just want to use my computer in a productive manner, not learn how to use it.” — Elysia“A year spent in artificial intelligence is enough to make one believe in God.” — Alan Jay Perlis

I don't think it can help to cast your float to a long and then cast it to DWORD, because in a couple of Windows headers, you'll simply find

Code:

typedef unsigned long DWORD

The first link you give multiplies the floating point value by UINT_MAX; I am not very surprised that things come out wrong in that case. The second link is just one of the many reasons to eschew .NET - it has nothing to do with C++ per se.

Can't you make a (small) test program which shows your problem in a few lines of code?