I started out with this:
program Demonstrate;
var
o,d,i:integer; //o - the original client window handle
begin //d - the debug window handle
//i - the fade loop counter variable
//Display a 250 x 250 block of the client window
DisplayDebugImgWindow(250, 250);
CopyCanvas(GetClientCanvas, GetDebugCanvas, 12, 17, 262, 267, 0, 0, 250, 250);
Wait(500);
//Save the original client window handle
o := GetClientWindowHandle;
//Make the client transparent
MakeWindowTransparent(o, 50);
//Get the debug window's handle
FindWindowTitlePart('Debug I',false);
//Save the debug window's handle
d := GetClientWindowHandle;
//Fade the debug window
for i := 255 downto 1 do
begin
MakeWindowTransparent(d, i);
wait(1);
end;
//Manipulate the debug image while transparent
CopyCanvas(GetDebugCanvas, GetDebugCanvas, 0, 0, 250, 250, 250, 250, 0, 0);
for i := 1 to 255 do
begin
MakeWindowTransparent(d, i);
wait(1);
end;
//Set the handle back to what it was originally
SetClientWindowHandle(o);
//Flip the debug image back to normal
CopyCanvas(GetDebugCanvas, GetDebugCanvas, 0, 0, 250, 250, 250, 250, 0, 0);
//Make the original window opaque again
MakeWindowTransparent(o, 255);
//By setting the original winow opaque in the end, this script
//shows that it does not lose the client
end.
I have since refined it into this procedure:
procedure MakeDebugTransparent(howmuch:integer);
var
o,d:integer;
begin
if(howmuch > 255)then
howmuch := 255;
if(howmuch < 0)then
howmuch := 0;
//Save the original client window handle
o := GetClientWindowHandle;
//Get the debug window's handle
FindWindowTitlePart('Debug I',false);
//Save the debug window's handle
d := GetClientWindowHandle;
//Make the debug window transparent
MakeWindowTransparent(d, howmuch);
//Set the handle back to what it was originally
SetClientWindowHandle(o);
end;