I have not used 'pair' before so I changed what the function returns(not tested):
D3DXVECTOR2 ConvertWorldSpaceToViewSpace(int Camera,float x,float y,float z)
{
int ScreenX = 0;
int ScreenY = 0;
D3DXMATRIX VM=dbGetViewMatrix(Camera);
D3DXMATRIX PM=dbGetProjectionMatrix(Camera);
D3DXMATRIX WVP;
D3DXMatrixMultiply(&WVP,&VM,&PM);
D3DXVECTOR3 pos=D3DXVECTOR3(x,y,z);
D3DXVECTOR3 result;
D3DXVec3TransformCoord(&result,&pos,&WVP);
if(result.z<1){
ScreenX=(result.x+1)*dbScreenWidth()/2;
ScreenY=(1-result.y)*dbScreenHeight()/2;
}
return D3DXVECTOR2( ScreenX, ScreenY );
}
You should then be able to do the following:
D3DXVECTOR2 myVec;
myVec = ConvertWorldSpaceToViewSpace(int Camera,float x,float y,float z);
Your coordinates are then easily accessed from myVec.