Jump to content

Clickable GUI


SkellySoul
 Share

Recommended Posts

Well unless you are holding out facts on us they wouldn't be able to see what they are clicking on so what would be the point?

well it's for personal use really, question have you ever woke up in the morning roughly 3-5 AM because you couldn't sleep and happen to go to turn on your computer and it is bright enough to blind you?

So what I plan to do is create a shadow effect that will overlap my desktop to dim the brightness or even if I can get some dll calls for monitor brightness that would be super.

Link to comment
Share on other sites

Hi,

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
Opt('MustDeclareVars', 1)

Example1()


; example 1
Func Example1()
    Local $hGui, $iW = 400, $iH = 300, $iPic, $msg

    $hGui = GUICreate("My GUI", $iW, $iH, -1, -1, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TRANSPARENT))
    $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
    _CreateColorPic($iPic, $iW, $iH, 0xFF00FFAA)
    WinSetTrans($hGui, "", 120)
    GUISetState(@SW_SHOWNA, $hGui)

    Do
    Until _IsPressed("1B") ;Esc to exit

EndFunc   ;==>Example1

Func _CreateColorPic($iCID, $iW, $iH, $iARGB = 0xFFFFFFFF)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local $hBmp, $hBitmap, $hGraphic, $hOldBmp
    _GDIPlus_Startup()
    $hBmp = _WinAPI_CreateBitmap($iW, $iW, 1, 32)
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
    _WinAPI_DeleteObject($hBmp)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsClear($hGraphic, $iARGB)
    _GDIPlus_GraphicsDispose($hGraphic)
    $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
    _GDIPlus_Shutdown()
EndFunc

Cheers

Link to comment
Share on other sites

Hi,

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
Opt('MustDeclareVars', 1)

Example1()


; example 1
Func Example1()
    Local $hGui, $iW = 400, $iH = 300, $iPic, $msg

    $hGui = GUICreate("My GUI", $iW, $iH, -1, -1, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TRANSPARENT))
    $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
    _CreateColorPic($iPic, $iW, $iH, 0xFF00FFAA)
    WinSetTrans($hGui, "", 120)
    GUISetState(@SW_SHOWNA, $hGui)

    Do
    Until _IsPressed("1B") ;Esc to exit

EndFunc   ;==>Example1

Func _CreateColorPic($iCID, $iW, $iH, $iARGB = 0xFFFFFFFF)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $IMAGE_BITMAP = 0
    Local $hBmp, $hBitmap, $hGraphic, $hOldBmp
    _GDIPlus_Startup()
    $hBmp = _WinAPI_CreateBitmap($iW, $iW, 1, 32)
    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
    _WinAPI_DeleteObject($hBmp)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsClear($hGraphic, $iARGB)
    _GDIPlus_GraphicsDispose($hGraphic)
    $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    $hOldBmp = GUICtrlSendMsg($iCID, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp)
    If $hOldBmp Then _WinAPI_DeleteObject($hOldBmp)
    _GDIPlus_Shutdown()
EndFunc

Cheers

Excellent I would of never thought about GDI because I know nothing about it :D

Thanks Very Much :D

Edited by SkellySoul
Link to comment
Share on other sites

I got one more question please I went and stripped a lot of code to try and find out what allows me to click through the GUI but I don't see what is allowing me to do so.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$GUI = GUICreate("My GUI", @DesktopWidth, @DesktopHeight, Default, Default, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_LAYERED + $WS_EX_TRANSPARENT)
$iPic = GUICtrlCreatePic("c:\test.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
WinSetTrans($GUI, "", 120)
GUISetState(@SW_SHOWNA, $GUI)

While 1
$Msg = GUIGetMsg()
Switch $Msg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

I am guessing it is $WS_EX_LAYERED?

Link to comment
Share on other sites

Excellent I would of never thought about GDI because I know nothing about it :D

Thanks Very Much :D

Hi,

You don't need to use GDI+, I only used it because I didn't feel like guessing if you had a picture on your pc I could load..

Without a picture the gui is not visible..

You can use any picture and get rid of the GDI+ function alltogether.

eg; $iPic = GUICtrlCreatePic("C:\PathToMy\pic.jpg", 0, 0, $iW, $iH)

Then just remove the _CreateColorPic($iPic, $iW, $iH, 0xFF00FFAA) and _CreateColorPic() function completely.

Cheers

Edit: $WS_EX_TRANSPARENT is what allows you to click through the gui...

Edited by smashly
Link to comment
Share on other sites

#include <GUICONSTANTS.AU3>
#include <WINDOWSCONSTANTS.AU3>
Opt ('GUIoneventmode', 1)
$GUIStyle = BitOR($WS_DLGFRAME,$WS_POPUP, $WS_VISIBLE)
$GUIStyleEx = BitOR ($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE,$WS_EX_TRANSPARENT )
$W = 0xFFFFFF
$B = 0x0
$Titleb = 0x7F7F7F
$GUI = GUICreate (@ScriptName, 300, 300, -1, -1,$GUIStyle ,$GUIStyleEx)
GUISetBkColor ($B, $GUI)
GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit', $GUI)
GUISetState (@SW_MAXIMIZE, $GUI)
WinSetTrans ($GUI,'',100)

While 1
    Sleep (100)
WEnd
Func _Exit ()
    Exit
EndFunc

this works for me...

$WS_VISIBLE and Winsettrans () shows the GUI... having a Pic doesn't really matter

Link to comment
Share on other sites

Hi, $WS_VISIBLE isn't needed either..

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Opt("MustDeclareVars", 1) 

Example1()

; example 1
Func Example1()
    Local $hGui
    $hGui = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_TRANSPARENT))
    GUISetBkColor(0x010101, $hGui)
    WinSetTrans($hGui, "", 120)
    GUISetState(@SW_SHOWNA, $hGui)

    Do
        Sleep(10)
    Until _IsPressed("1B") ;Esc to exit

EndFunc   ;==>Example1

Cheers

Edited by smashly
Link to comment
Share on other sites

i guess it isn't :\ .... well i always couple Popup with Visible... but you ARE right :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...