bool   CreateAvi(HWND hwnd, char* FileName,int xsize,int ysize,int fps,int freq,int bits,int channels)

    Create, and open the avi file. The output file will be in 32 bits color in all cases. And the source buffer is the  GR_BUFFER_RENDERTARGET  (see at the savetga()). The input and output sound format needs be same.
 
    Hwnd: The hwnd of window with DitectX, or 0 is same thing.
    Str: The name of output file. It MUST include the the path, end extension.

xsize,ysize: The output screen size, it is scaling the screen automatically. If it is 0, so the size will be by the backbuffer size.
fps: Set the avi frame rate. It must be a correct value. Normally it can be 20..
freq: The frequency of the in/out sound. If it is 0, so the avi will not include sound stream.
bits: The bit depth of the in/out sound. Normally it can be 8, or 16.
channels: The The number of in/out soubd channels. It is 1 in mono mode, and it is 2 in stereo mode. If it is 0, so the avi will not include sound stream.

    Result:
    Success