Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click through transparent form

I have a semi transparent fullscreen form and I need can control my computer over this form.

Actualy we need red screen filter on computer for observing the sky, but we don't want to use something like red plexiglass.

I tried Windows API's (Monitor Configuration Functions) http://msdn.microsoft.com/en-us/library/windows/desktop/dd692964(v=vs.85).aspx but I can't do it. I did transparent form like red filter (everything seems Red and Black tones), but I can't control computer over my form. Anybody help me about that ?

like image 732
user1576239 Avatar asked Aug 04 '12 15:08

user1576239


People also ask

How do I use the transparent form?

It operates in two modes, Transparent and Active, and starts up in Transparent mode. If you click the mouse anywhere in the window, the click falls through to the window behind it. To make the sample window Active, make sure the form has the focus by clicking on its icon in the TaskBar, then hold down the Shift and Ctrl keys.

How to make a form click-throughable?

It appears that a form is transparent, "all or nothing"! In order to get a form to be "click-throughable", you have to modify the Extended Style attributes of the window that is your form. How do we do that?

How do I make a window transparent in GWL?

_InitialStyle = GetWindowLong ( Me .Handle, GWL.ExStyle) ' Set this window to Transparent ' (to the mouse that is!) SetFormToTransparent () ' Just for giggles, set this window ' to stay on top of all others so we ' can see what's happening.

Is there a WTL class that will make any window transparent?

Please Sign up or sign in to vote. A WTL class that will make any window transparent and allow mouse clicks to pass through the window in Windows 2000 and XP. In the December 2005 column of the MSDN magazine Paul DiLascia explained how to create a so called "layered" window which is transparent and passes mouse events through itself.


1 Answers

Create a new VCL project. In the properties of the main form, set Color to clRed, AlphaBlend to true, AlphaBlendValue to 127, WindowState to wsMaximized, FormStyle to fsStayOnTop, and add the following code:

type
  TForm1 = class(TForm)
  private
  protected
    procedure CreateParams(var Params: TCreateParams); override;

...

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle or WS_EX_LAYERED or WS_EX_TRANSPARENT;
end;

(Sample video, Sample compiled EXE, Source)

like image 136
Andreas Rejbrand Avatar answered Oct 13 '22 04:10

Andreas Rejbrand