here's workining code for setting the forms background transparent in windows thank to all for the help
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, windows;
const
LWA_COLORKEY = 1;
LWA_ALPHA = 2;
LWA_BOTH = 3;
WS_EX_LAYERED = $80000;
GWL_EXSTYLE = -20;
{Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal Color As Long, ByVal X As Byte, ByVal alpha As Long) As Boolean }
function SetLayeredWindowAttributes (hWnd:Longint; Color:Longint; X:Byte; alpha:Longint):bool stdcall; external 'USER32';
{not sure how to alias these functions here ???? alias setwindowlonga!!}
{Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long }
Function SetWindowLongA (hWnd:Longint; nIndex:longint; dwNewLong:longint):longint stdcall; external 'USER32';
{Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long }
Function GetWindowLongA ( hWnd:Longint; nIndex:longint):longint stdcall; external 'user32';
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure SetTranslucent(ThehWnd: Longint; Color: Longint; nTrans: Integer);
var
attrib:longint;
begin
{SetWindowLong and SetLayeredWindowAttributes are API functions, see MSDN for details }
attrib := GetWindowLongA(ThehWnd, GWL_EXSTYLE);
SetWindowLongA (ThehWnd, GWL_EXSTYLE, attrib Or WS_EX_LAYERED);
{anything with color value color will completely disappear if flag = 1 or flag = 3 }
SetLayeredWindowAttributes (ThehWnd, Color, nTrans,1);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
transparency:longint;
begin
{the color were going to make transparent the red that the form backgroud is set to}
transparency:= $000002EE;
{call the function to do it}
SetTranslucent (form1.Handle, transparency, 0);
end;
initialization
{$I unit1.lrs}
end.
all newbs this hung me up be sure and goto the form events tab oncreate click it and make the drop down menu say formcreate. Also set the form color to $000002EE that's the only color the form will go transparent to unless you change the transparency =
bpsoftware I did find your webpage in the forums thank you however setting windows regions and blending the colors to create transparency is very different. I admire your work to create a transparent bunny etc by scanning for and makeing the region for controls however I didn't think that would be easy or work for me as I want the control to animate. this is the starting point for me to animate pictures across my desktop. Like makeing an active desktop.
all the rest of you guys I'll be sure and look at the new svn version however I think it's going to make the form fade in and out and the controls along with it and there was already code to do that in the forums however please correct me if I'm wrong. I guess I poorly worded my original question, It should have been how do I set the tforms backgroud color to transparent?