Step by step procedures for creating the BD/Ex1 example 

  1. Make sure you have register the ActiveCDX.OCX, see install.htm for more information on this. 
  2. Create a new application.
  3. Insert the CDXVisual Control, rename it to CDXVisual. If needed, you can also create the unit from the CDXVisual Control. This can be done from the Component-Import ActiveX.
  4. Add a private member Splash to the TForm1 (the form class). This Splash is the handle of the Splash Surface and should have variable type of longint.
  5. Add the procedure of CDXError to the TForm1:
        procedure TForm1.CDXError(msg:PChar);
        begin
            MessageBox(0, msg, 'CDX Error', MB_OK);
            CDXVisual.Destroy;
            Application.Terminate;
        end;
    This procedure will be called when there is an error and will terminate the application.
  6. Add the Form-Create event handler:
        procedure TForm1.FormCreate(Sender: TObject);
        begin
            if not CDXVisual.CreateWindowed(Handle, 640, 480) then
                CDXError('Failed creating windowed CDX');
            Splash := CDXVisual.CreateSurface4('c:\cdx\acdx\examples\res\splash.bmp', 2);
            if Splash = 0 then
                CDXError('Failed loading c:\cdx\acdx\examples\res\splash.bmp');
        end;
    The above code will create and initialize the CDX into windowed mode. After that, it will create a surface containing the splash bitmap. Value 2 for the last parameter indicated that the surface should be located in the vidmem, and if it's not possible then the surface can be put in the sysmem. It's the same value as CDXSYS_VIDTHENMEM. 
  7. Add a private procedure PaintBitmap to the TForm1:
        procedure TForm1.PaintBitmap;
        begin
            CDXVisual.DrawFast(CDXVisual.GetBack, 0, 0, Splash);
            CDXVisual.Flip;
        end;
    This two line of code will blit the Splash surface to the backbuffer. The Flip command will copy the backbuffer to the primary buffer, thus allow the splash screen to be visible.
  8. Now, what you need to do is to call the PaintBitmap in the event of paint and resize:
        procedure TForm1.FormPaint(Sender: TObject);
        begin
            PaintBitmap;
        end;
        procedure TForm1.FormResize(Sender: TObject);
        begin
            PaintBitmap;
        end;