Loading the Image, or setting up the surface, requires opening a bmp file and copying the information from it to the surface. The following code uses a DC for this purpose since BitBlt will convert from the 24-bit BMP's I use to the 16-bit format of the surface supplied. You could of course write all this yourself, or better yet load from a image file that already has an alpha value in it, but that's not the purpose of this tutorial. That and I haven't done it myself :)
HBITMAP hBM;
BITMAP BM;
HDC hDCImage, hDC;
hBM = ( HBITMAP ) LoadImage( NULL, FileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION );
GetObject( hBM, sizeof( BM ), &BM );
hDCImage = CreateCompatibleDC( NULL );
SelectObject( hDCImage, hBM );
if( SUCCEEDED( TheSurface->GetDC( &hDC )))
{
BitBlt( hDC, 0, 0, TextureWidth, TextureHeight, hDCImage, 0, 0, SRCCOPY );
TheSurface->ReleaseDC( hDC );
}
DeleteDC( hDCImage );
DeleteObject( hBM );