There is a simple solution you have to cast the BYTE type to DWORD or the opposite like:
if (++(*pIdx) >= (BYTE)n) // error corrected
But this does lead me to question what you are doing. A DWORD is a much bigger storage that the BYTE type the pointer addresses - this comparison therefore looks dangerously like a spot where a subtle overflow bug might occur when n > 255.
Also you ruse of the ++ operator seems confusing - are you clear that this operator is NOT incrementing the pointer onto the next byte, but rather incrementing the value of the byte currently pointed to?