The DirectX SDK (June 2010) has 4 HDR-related D3DX9 sample solutions. In particular, the HDRPipeline example illustrates individual steps - source image, brightness pass, down-sampling, horiz- and vert-blur, luminance passes, etc. It can be a bit of a struggle to work through the examples piece-by-piece, but there are several steps to the process (as mentioned in kauna's link) that you'll have to integrate and implement. The shader code, however, is provided.
If you have the DX SDK installed, browse through the SampleBrowser for descriptions of each project.