If having the child window show transparency is something you want, you may want to consider using a Layered Window. Similar to this, but yours would only require 1 layered window whereas this one uses 3.
Code: Select all
;***************************************************************************************************
;***************************************************************************************************
;***************************************************************************************************
#Include <My Altered Gdip Lib> ;<------ Replace with your copy of GDIP
;***************************************************************************************************
;***************************************************************************************************
;***************************************************************************************************
#SingleInstance, Force
SetBatchLines, -1
BGMain := New LayeredWindow( x := "" , y := "" , w := 300 , h := 200 , window := 1 , title := "Toggle Clicker v2" , smoothing := 2 , options := "+AlwaysOnTop -DPIScale" , autoShow := 1 , GdipStart := 1 , WinMover := "" , BackgroundColor := "" )
BBrush := Gdip_BrushCreateSolid( "0xFF880000" ), BPen := Gdip_CreatePen( "0xFF555555" , 1 ), BP := []
Loop, 50
BP.Push({X:Ran(-10,300),Y:Ran(-10,200),W:Ran(5,30),Phase:Ran(0,1),Co:Ran(0,3),Max: Max:=Ran(10,50),Min:Ran(3,Max)})
pBanner := BannerTag("Wash Your Hands" )
BannerWin := New LayeredWindow( x := 30 , y := 0 , w := 240 , h := 40 , window := 2 , title := " " , smoothing := 2 , options := "-DPIScale +Parent1" , autoShow := 1 , GdipStart := 0 , WinMover := "" , BackgroundColor := "" )
Banner := {Bitmap1:BannerTag("Wash Your Hands"),Bitmap2:BannerTag("HB Toggle Clicker"),X:20,Y:0,W:160,H:30,Dir1:1,Dir2:1,PhaseCo:0,Phase:1}
Gdip_DrawImage(BannerWin.G, Banner.Bitmap2, Banner.X, Banner.Y, Banner.W, Banner.H)
BannerWin.UpdateWindow()
Bit:=Banner.Bitmap2
Gui,2:Add,Text,x0 y0 w300 h30 BackgroundTrans gMoveWin
InnerWin1 := New LayeredWindow( x := 10 , y := 40 , w := 280 , h := 150 , window := 3 , title := " " , smoothing := 2 , options := "-DPIScale +Parent1" , autoShow := 1 , GdipStart := 0 , WinMover := "" , BackgroundColor := "0x22000000" )
INPen1 := Gdip_CreatePen( "0xFF440000" , 1 )
Gdip_DrawRectangle(InnerWin1.G, INPen1,0, 0, InnerWin1.W-1, InnerWin1.H-1)
Gdip_DrawImage(InnerWin1.G, TogClButtSet1(), 0, 0, InnerWin1.W, InnerWin1.H)
InnerWin1.UpdateWindow()
Butts := []
Gui,3:Add,Text,x30 y35 w220 h30 BackgroundTrans hwndhwnd gHotkeysWindow
Butts[hwnd]:=1
Gui,3:Add,Text,x30 y75 w220 h30 BackgroundTrans hwndhwnd gClickSpeedWindow
Butts[hwnd]:=2
Gui,3:Add,Text,x30 y115 w220 h30 BackgroundTrans hwndhwnd gMoreOptionsWindow
Butts[hwnd]:=3
SetTimer, Hover, 50
SetTimer, BannerM, 50
SetTimer, Ani, 100
return
GuiClose:
GuiContextMenu:
*ESC::
ExitApp
Ran(Min,Max){
Random, Out, Min, Max
return Out
}
Hover:
MouseGetPos,,,,ctrl,2
if(Butts[ctrl]&&!Active){
LCtrl := ctrl
InnerWin1.ClearWindow()
Gdip_DrawImage(InnerWin1.G, WiniBit := TogClButtSet1(Active := Butts[ctrl]), 0, 0, InnerWin1.W, InnerWin1.H)
Gdip_DrawRectangle(InnerWin1.G, INPen1,0, 0, InnerWin1.W-1, InnerWin1.H-1)
InnerWin1.UpdateWindow()
Gdip_DisposeImage( WiniBit )
}else if(Butts[LCtrl]!=Butts[ctrl]&&Active){
InnerWin1.ClearWindow()
Gdip_DrawImage(InnerWin1.G, WiniBit := TogClButtSet1(Active := 0), 0, 0, InnerWin1.W, InnerWin1.H)
Gdip_DrawRectangle(InnerWin1.G, INPen1,0, 0, InnerWin1.W-1, InnerWin1.H-1)
InnerWin1.UpdateWindow()
Gdip_DisposeImage( WiniBit )
}
return
MoveWin:
PostMessage, 0xA1, 2,,,Toggle Clicker v2
return
HotkeysWindow:
ToolTip, here in hotkeys
return
ClickSpeedWindow:
ToolTip, here in Click Speed
return
MoreOptionsWindow:
ToolTip, here in Options
return
BannerM:
(Banner.Dir1=1&&Banner.X>=10)?(Banner.X-=2):(Banner.Dir1=1&&Banner.X<10)?(Banner.Dir1:=2)
(Banner.Dir1=2&&Banner.X<=70)?(Banner.X+=3):(Banner.Dir1=2&&Banner.X>70)?(Banner.Dir1:=1)
(Banner.Dir2=1&&Banner.Y<=10)?(Banner.Y+=.3):(Banner.Dir2=1&&Banner.Y>10)?(Banner.Dir2:=2)
(Banner.Dir2=2&&Banner.Y>=2)?(Banner.Y-=.3):(Banner.Dir2=2&&Banner.Y<2)?(Banner.Dir2:=1)
(++Banner.PhaseCo>30)?(Banner.PhaseCo:=0,(Banner.Phase=1)?(Bit:=Banner.Bitmap2,Banner.Phase:=2):(Bit:=Banner.Bitmap1,Banner.Phase:=1))
BannerWin.ClearWindow()
Gdip_DrawImage(BannerWin.G, Bit, Banner.X, Banner.Y, Banner.W, Banner.H)
BannerWin.UpdateWindow()
return
Ani:
;~ BGMain.ClearWindow()
BGMain.PaintBackground( BackgroundColor := "0x19171719" )
;~ BGMain.PaintBackground( BackgroundColor := "0xff171719" )
loop, % BP.Length(){
(BP[A_Index].Phase=1&&BP[A_Index].W<BP[A_Index].Min)?(BP[A_Index].Phase := 0):(BP[A_Index].Phase=0&&BP[A_Index].W>BP[A_Index].Max)?(BP[A_Index].Phase := 1 , BP[A_Index].Co += 1)
(BP[A_Index].Phase=1)?(BP[A_Index].X += 1,BP[A_Index].Y += 1,BP[A_Index].W -= 2,BP[A_Index].H -= 2):(BP[A_Index].X -= 1,BP[A_Index].Y -= 1,BP[A_Index].W += 2,BP[A_Index].H += 2)
(BP[A_Index].Co>4)?(BP[A_Index] := {X:Ran(-10,300),Y:Ran(-10,200),W:Ran(5,30),Phase:Ran(0,1),Co:Ran(0,3),Max: Max:=Ran(10,50),Min:Ran(3,Max)})
;~ Brush3 := Gdip_CreateLineBrushFromRect( BP[A_Index].x, BP[A_Index].y, BP[A_Index].w, BP[A_Index].w , "0x77660000" , "0xff000000" , 1 , 1 )
Brush3 := Gdip_CreateLineBrushFromRect( BP[A_Index].x, BP[A_Index].y, BP[A_Index].w, BP[A_Index].w , "0xff660000" , "0xff000000" , 1 , 1 )
Gdip_FillEllipse(BGMain.G, Brush3, BP[A_Index].x, BP[A_Index].y, BP[A_Index].w, BP[A_Index].w)
Gdip_DeleteBrush( Brush3 )
Gdip_DrawRectangle(BGMain.G, BPen,0, 0, 299, 199)
}
BGMain.UpdateWindow()
return
;######################################################################################################################################################################################
;######################################################################################################################################################################################
;######################################################################################################################################################################################
class LayeredWindow {
__New( x := 0 , y := 0 , w := 100 , h := 100 , window := 1 , title := " " , smoothing := 4 , options := "" , autoShow := 1 , GdipStart := 0 , WinMover := "" , BackgroundColor := "" ){
This.X := x , This.Y := y , This.W := w , This.H := h , This.Window := window , This.Title := title , This.Options := options , This.Smoothing := smoothing
( GdipStart ) ? ( This.Token := Gdip_Startup() )
This._CreateWindow()
( autoShow ) ? ( This.ShowWindow() )
This._SetUpdateLayeredWindow()
( WinMover ) ? ( This._AddMoveTrigger( WinMover ) )
( BackgroundColor ) ? ( This.PaintBackground( BackgroundColor , 1 ) )
}_CreateWindow(){
Gui , % This.Window ": New" , % " +E0x80000 +LastFound -Caption " This.Options
This.Hwnd := WinExist()
This.hbm := CreateDIBSection( This.W , This.H )
This.hdc := CreateCompatibleDC()
This.obm := SelectObject( This.hdc , This.hbm )
This.G := Gdip_GraphicsFromHDC( This.hdc )
Gdip_SetSmoothingMode( This.G , This.Smoothing )
}_SetUpdateLayeredWindow(){
UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H )
}UpdateWindow(){
UpdateLayeredWindow( This.hwnd , This.hdc )
}ShowWindow( update := 1 , Position := "" ){
if( !Position )
Gui , % This.Window ": Show" , % "w" This.W " h" This.H , % ( This.Title ) ? ( This.Title ) : ( "" )
else
Gui , % This.Window ": Show" , % "x" Position.X " y" Position.Y "w" Position.W " h" Position.H , % ( This.Title ) ? ( This.Title ) : ( "" )
( update ) ? ( This.UpdateWindow() )
}_AddMoveTrigger( positons ){
local hwnd , bd
Gui , % This.Window " : Add" , Text , % "x" positons.x " y" positons.y " w" positons.w " h" positons.h " hwndhwnd BackgroundTrans"
This.MoveHwnd := hwnd
bd := This._WindowMover.Bind( This )
GuiControl , % This.Window ": +G" , % This.MoveHwnd , % bd
}_WindowMover(){
PostMessage, 0xA1 , 2
}PaintBackground( BackgroundColor := "0xFF000000" , update := 0){
local Brush
This.BackgroundColor := BackgroundColor
Brush := Gdip_BrushCreateSolid( BackgroundColor )
Gdip_FillRectangle( This.G , Brush , 0 , 0 , This.W , This.H )
Gdip_DeleteBrush( Brush )
( update ) ? ( This.UpdateWindow() )
}Draw( pBitmap , Positions := "" , update := 1 , disposeBitmap := 0 , PaintBackground := 0){
(PaintBackground) ? ( This.PaintBackground( This.BackgroundColor ) )
Gdip_DrawImage( This.G , pBitmap , ( Positions.X1 ) ? ( Positions.X1 ) : ( Positions.X ) ? ( Positions.X ) : ( "" ) , ( Positions.Y1 ) ? ( Positions.Y1 ) : ( Positions.Y ) ? ( Positions.Y ) : ( "" ) , ( Positions.W1 ) ? ( Positions.W1 ) : ( Positions.W ) ? ( Positions.W ) : ( "" ) , ( Positions.H1 ) ? ( Positions.H1 ) : ( Positions.H ) ? ( Positions.H ) : ( "" ) , ( Positions.X2 ) ? ( Positions.X2 ) : ( Positions.SX ) ? ( Positions.SX ) : ( "" ) , ( Positions.Y2 ) ? ( Positions.Y2 ) : ( Positions.SY ) ? ( Positions.SY ) : ( "" ) , ( Positions.W2 ) ? ( Positions.W2 ) : ( Positions.SW ) ? ( Positions.SW ) : ( "" ) , ( Positions.H2 ) ? ( Positions.H2 ) : ( Positions.SH ) ? ( Positions.SH ) : ( "" ) )
( update ) ? ( This.UpdateWindow() )
( disposeBitmap ) ? ( Gdip_DisposeImage( pBitmap ) )
}ClearWindow( update := "" ){
Gdip_GraphicsClear( This.G )
( update ) ? ( This.UpdateWindow() )
}DeleteWindow( TurnOffGdip := 0 ){
SelectObject( This.hdc , This.obm ) , DeleteObject( This.hbm ) , DeleteDC( This.hdc ) , Gdip_DeleteGraphics( This.G )
( TurnOffGdip && This.Token ) ? ( Gdip_Shutdown( This.Token ) )
Gui, % This.Window " : Destroy"
}
}
BannerTag(txt := "Wash Your Hands" ){
;Bitmap Created Using: HB Bitmap Maker
pBitmap:=Gdip_CreateBitmap( 160 , 30 ),G := Gdip_GraphicsFromImage( pBitmap ),Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF888888" )
Gdip_FillRoundedRectangle( G , Brush , 1 , 2 , 157 , 26 , 4 )
Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_BrushCreateSolid( "0xFF333333" )
Brush := Gdip_BrushCreateSolid( "0xFF171719" )
Gdip_FillRoundedRectangle( G , Brush , 2 , 3 , 155 , 24 , 3 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFaaaaaa" )
Gdip_TextToGraphics( G , txt , "s16 Center vCenter Bold c" Brush " x-1 y0" , "Segoe ui" , 160 , 30 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF770000" )
Gdip_TextToGraphics( G , txt , "s16 Center vCenter Bold c" Brush " x0 y1" , "Segoe ui" , 160 , 30 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
TogClButtSet1(value:=0){
;Bitmap Created Using: HB Bitmap Maker
pBitmap:=Gdip_CreateBitmap( 280 , 150 )
G := Gdip_GraphicsFromImage( pBitmap )
Gdip_SetSmoothingMode( G , 2 )
;Hotkeys
Brush := Gdip_CreateLineBrushFromRect( 29 , 36 , 221 , 28 , (Value=1)?("0xFFaa0000"):("0xFF880000") , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 30 , 35 , 220 , 30 , 5 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( (Value=1)?("0x44000000"):("0x44222222") )
Gdip_FillRoundedRectangle( G , Brush , 31 , 36 , 218 , 28 , 4 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF777777" )
Gdip_TextToGraphics( G , "Hotkeys" , "s16 Center vCenter Bold c" Brush " x30 y35" , "Segoe ui" , 218 , 28 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 109 , 38 , 72 , 14 , (Value=1)?("0xFF000000"):("0xFF880000") , (Value=1)?("0xFF880000"):("0xFF000000") , 1 , 1 )
Gdip_TextToGraphics( G , "Hotkeys" , "s16 Center vCenter Bold c" Brush " x31 y36" , "Segoe ui" , 218 , 28 )
Gdip_DeleteBrush( Brush )
;Click Speed
Brush := Gdip_CreateLineBrushFromRect( 30 , 74 , 219 , 29 ,(Value=2)?("0xFFaa0000"):("0xFF880000") , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 30 , 75 , 220 , 30 , 4 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( (Value=2)?("0x44000000"):("0x44222222") )
Gdip_FillRoundedRectangle( G , Brush , 31 , 76 , 218 , 28 , 4 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF777777" )
Gdip_TextToGraphics( G , "Click Speed" , "s16 Center vCenter Bold c" Brush " x30 y75" , "Segoe ui" , 218 , 28 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 92 , 77 , 94 , 17 ,(Value=2)?("0xFF000000"):("0xFF880000") ,(Value=2)?("0xFF880000"):("0xFF000000") , 1 , 1 )
Gdip_TextToGraphics( G , "Click Speed" , "s16 Center vCenter Bold c" Brush " x31 y76" , "Segoe ui" , 218 , 28 )
Gdip_DeleteBrush( Brush )
;More Options
Brush := Gdip_CreateLineBrushFromRect( 31 , 115 , 216 , 27 ,(Value=3)?("0xFFaa0000"):("0xFF880000") , "0xFF000000" , 1 , 1 )
Gdip_FillRoundedRectangle( G , Brush , 30 , 115 , 220 , 30 , 4 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( (Value=3)?("0x44000000"):("0x44222222") )
Gdip_FillRoundedRectangle( G , Brush , 31 , 116 , 218 , 28 , 4 )
Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF777777" )
Gdip_TextToGraphics( G , "More Options" , "s16 Center vCenter Bold c" Brush " x30 y115" , "Segoe ui" , 218 , 28 )
Gdip_DeleteBrush( Brush )
if(Value=3)
Brush := Gdip_CreateLineBrushFromRect( 87 , 116 , 105 , 18 , "0xFF000000" , "0xFF880000" , 1 , 1 )
else
Brush := Gdip_CreateLineBrushFromRect( 87 , 116 , 105 , 18 , "0xFF880000" , "0xFF000000" , 1 , 1 )
Gdip_TextToGraphics( G , "More Options" , "s16 Center vCenter Bold c" Brush " x31 y116" , "Segoe ui" , 218 , 28 )
Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}