DWORD-aligned bytes is needed.

Instead of
Code:
#define TJPAD(p) (((p)+3)&(~3))
int paddedRow = TJPAD(bitmap.bmWidth*bitmap.bmBitsPixel/8);
Have
Code:
#define TJPAD(bits) ((((bits) + 31) & ~31) >> 3)
int paddedRow = TJPAD(bitmap.bmWidth*bitmap.bmBitsPixel);
The division is done at the end (with ">>3", which is the same than "/ 8") instead of being done in the middle of the computation. Therefore we need to use 31 instead of 3.

Let's take an example where an image has only one row of 3 pixels, with 2 bits per pixel
It is obvious we need 4 bytes for that picture.

1. With your algortihm:
3 * 2 / 8 = 0
0 + 3 = 3
3 & ~3 = ...0011 & ...1100 = ...0000 = 0
0 byte, sorry, that's not enough!

2. With the new algorithm:
3 * 2 = 6
6 + 31 = 37
37 & ~31 = ...00010111 & ...11100000 = 32
32 >> 3 = 4
4 bytes, It's ok.

You also need to switch the comments on your lines:
Code:
	//BmInfo->bmiHeader.biSizeImage	  = ((m_nSizeX * m_nBitsPerPixel +31) & ~31) /8 * m_nSizeY;
	BmInfo->bmiHeader.biSizeImage	  = m_nSizeY * TJPAD(m_nSizeX*m_nBitsPerPixel/8);