Here is how I do it:
void DrawLine ( float x, float y, float z, float x2, float y2, float z2, int R, int G, int B )
{
LPD3DXLINE line;
D3DXCreateLine ( dbGetDirect3DDevice(), &line );
D3DXVECTOR3 a[2];
a[0].x = x;
a[0].y = y;
a[0].z = z;
a[1].x = x2;
a[1].y = y2;
a[1].z = z2;
D3DXMATRIX projMatrix, viewMatrix;
dbGetDirect3DDevice()->GetTransform( D3DTS_PROJECTION, &projMatrix );
dbGetDirect3DDevice()->GetTransform( D3DTS_VIEW, &viewMatrix );
D3DXMatrixMultiply( &projMatrix, &viewMatrix, &projMatrix );
line->Begin();
line->DrawTransform( a, 2, &projMatrix, D3DCOLOR_XRGB( R, G, B ) );
line->End();
line->Release();
}
But be aware that this is very inefficient (I'm re-creating and deleting the LPD3DXLINE each call!).
Maybe you can figure out how to improve it on your own.
At least this is good enough (for me) to draw a quick 3D line for debugging purposes...
Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.