Code:
unsigned int uiStride;
bool bTex = false, bCham = false;

LPDIRECT3DTEXTURE9 pTexture[2];

const BYTE bRed[60] = { 0x42, 0x4D, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 
0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
0x01,0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x0B, 
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 
0x00, 0x01 };

const BYTE bYellow[60] = { 0x42, 0x4D, 0x3C, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 
0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x0B, 
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 
0x00, 0x01 };


HRESULT APIENTRY pIDirect3DDevice9::BeginScene() 
{

  if(bTex == false)
  {

    D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bRed, sizeof(bRed), 
    &pTexture[0]);
    D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bYellow, sizeof(bYellow), 
    &pTexture[1]);

    bTex = true;

  }

  return pDevice->BeginScene();

}


HRESULT APIENTRY pIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,
INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, 
UINT primCount)
{

  if(GetAsyncKeyState(VK_F1)&1)
  bCham = !bCham;

  if(bCham == true && uiStride == 52)
  {

        pDevice->SetRenderState(D3DRS_ZENABLE, false);      
    
    pDevice->SetTexture(0, pTexture[0]);

    pDevice->DrawIndexedPrimitive(PrimitiveType, BaseVertexIndex,
        MinVertexIndex, NumVertices, startIndex, primCount); 

    pDevice->SetRenderState(D3DRS_ZENABLE, true);

        pDevice->SetTexture(0, pTexture[1]);

        return pDevice->DrawIndexedPrimitive(PrimitiveType, BaseVertexIndex,
        MinVertexIndex, NumVertices, startIndex, primCount);

  }

  return pDevice->DrawIndexedPrimitive(PrimitiveType, BaseVertexIndex,
  MinVertexIndex, NumVertices, startIndex, primCount);

}


HRESULT APIENTRY pIDirect3DDevice9::SetStreamSource(UINT StreamNumber,
IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) 
{

  if(StreamNumber == 0)
  uiStride = Stride;
    
  return pDevice->SetStreamSource(StreamNumber, pStreamData, OffsetInBytes, 
  Stride);

}
what am i doing wrong in this?