Although both direct and ambient light illuminate objects in a scene, they are independent of one another, they have very different effects, and they require that you work with them in completely different ways.
Direct light is just that: direct. Direct light always has direction and color, it is always emitted by an object within a scene, and it is a factor for shading algorithms, such as Gouraud shading. Different types of light objects emit direct light in different ways, creating special attenuation effects. You create lights by calling the IDirect3D3::CreateLight method, set their properties with the IDirect3DLight::SetLight method, and add them to a scene by calling the IDirect3DViewport3::AddLight method.
Ambient light is effectively everywhere in a scene. You can think of it as a general level of light that fills an entire scene, regardless of the objects and their locations within that scene. Ambient light, being everywhere, has no position or direction, only color and intensity. Additionally, ambient light is not factored-in for shading algorithms. If you're using the DrawPrimitive architecture to do your rendering, you set the ambient light level with a single call to the IDirect3DDevice3::SetLightState method, specifying D3DLIGHTSTATE_AMBIENT as the dwLightStateType parameter, and the desired RGBA color as the dwLightState parameter. If you're using execute buffers, you must include the D3DOP_STATELIGHT opcode in the execute buffer, as well as the D3DLIGHTSTATE_AMBIENT flag and color value in the accompanying D3DSTATE structure.
Color values for ambient light are interpreted the same way for both the DrawPrimitive and execute buffer architectures. Ambient light color takes the form of an RGBA value, where each component is an integer value from 0 to 255. (This is unlike most color values in Direct3D Immediate Mode. For more information, see Color Values for Lights and Materials.) You can use the RGBA_MAKE macro to generate RGBA values from integers. The red, green, and blue components combine to make the final color of the ambient light. The alpha component controls the transparency of the color. In ramp emulation, ambient light doesn't have color, so the alpha component is used for brightness. When using hardware acceleration or RGB emulation, the alpha component is ignored.