const BYTE* pBits = rect.pBits;
The error says:
error C2440: 'initializing' : cannot convert from 'void *' to 'const BYTE'
D3DCOLOR readPixel(LPDIRECT3DTEXTURE9 pTexture, UINT x, UINT y){ // Lock the texture: D3DLOCKED_RECT rect; HRESULT hResult = pTexture->LockRect(0, &rect, NULL, D3DLOCK_READONLY); if(FAILED(hResult)) { // Failed to lock the texture, error return 0; } // Get the bits as a BYTE* const BYTE* pBits = rect.pBits; // Seek to the correct pixel and read it DWORD nBytesPerPixel = 4; const DWORD* pPixel = (DWORD*)(pBits + y * rect.Pitch + x*nBytesPerPixel); DWORD dwPixel = *pPixel; // Unlock the texture pTexture->UnlockRect(0); // Return the pixel return dwPixel;}