Jump to content

GUIWindow.au3


PartyPooper
 Share

Recommended Posts

Thought Scripts and Scraps was a better place for this. Original thread. All credit should go to Larry, I just converted his code into a UDF and added some bits along with Gary Frost.

Here's a simple example of how it is called and used:

#include <GUIConstants.au3>
#include <GUIwindow.au3>

MainGUI()
While 1
    Sleep(500)
WEnd

Func MainGUI()
    _TransparentTextWindow("MyTextGUI", "Larry Rocks!", 200, 30)
    If @error Then
        MsgBox(262160, "ERROR", "Unable to create window - check parameters")
        Exit
    EndIf
    GUISetState(@SW_SHOW)
EndFunc

Format for the UDF is as follows:

#include <GUIConstants.au3>
#include <GUIwindow.au3>
_TransparentTextWindow ( "Title", "Text", Width, Height [, Left [, Top [, Font [, Font Weight [, Font Color [, Italics [, Underlined [, Striked Out [, Taskbar]]]]]]]]] )

Parameters

"Title" - The title of the transparent window created

"Text" - The text to display in the window

Width - [optional] The width of the window

Height - [optional] The height of the window

Left - [optional] The left side of the window. Default (-1) - the window is horizontally centered.

Top - [optional] The top of the window. Default (-1) - the window is vertically centered

Font - [optional] The font name. Default (-1) - "Microsoft Sans Serif"

Font Weight - [optional] The thickness of the font. Default (-1) - 450

Font Color - [optional] Hex RGB color representation. Default (-1) - "0xFF0000"

Italics - [optional] Italisized Font 0=normal, 1=italics. Default (0) - not italisized

Underlined - [optional] Underlined Font 0=normal, 1=underlined. Default (0) - not underlined

Striked Out - [optional] Stiked Out Font 0=normal, 1=striked out. Default (0) - not striked out

Taskbar - [optional] Taskbar display 0=Tray icon and Taskbar window, 1=Tray icon only. Default (0) - Tray icon and Taskbar window

Return Value

Success: Displays a transparent window with a visible text overlay

Failure: Sets @error to 1.

Remarks

Fonts are system dependant, however, most systems have "Microsoft Sans Serif", "Time New Roman", "Terminal", "Courier New", "Arial", "Verdana".

Generally speaking, a bold typeface can be achieved with font weights over 650, however, 1000 works well. GUIwindow.au3 should be placed in your AutoIt3 Includes folder. Requires Beta to run.

Edit: Updated UDF (55 downloads)

Edited by PartyPooper
Link to comment
Share on other sites

Here's a quick and dirty bit of code I used to test the UDF with. Uses middle mouse button to grab the various screen/window parameters and display them at the bottom of the screen. Press <END> to exit the program. Don't forget to put the UDF in your AutoIt INCLUDE folder/s for it to work.

#region  --  Code Header
;******************************************************************************
; PROGRAM:  WinInfo
; C/RIGHT:  @2005 MickK
; AUTHOR:   MickK (aka PartyPooper)
; EMAIL:    partypooper@optusnet.com.au
; WEBSITE:  http://members.optusnet.com.au/partypooper
; INFO:     This program uses the middle mouse button to grab the various
;          parameters of the active screen and displays them as text in a
;          transparent background window on the top line of the active screen.
;******************************************************************************
 #endregion
 #region  --  Declarations
;******************************************************************************
; Standard Decs
 Global $Title = "WinInfo"
 Global $Version = "v1.0.0.1"
 Global $Programmer = "MickK"
 Global $g_szVersion = $Title & " by " & $Programmer
; Variables
 Global $MouseCoords [2]
 Global $PixelColor
 Global $WinPosn
 Global $WinTitle
 Global $Text
; Windows
 Global $MainGUI
;******************************************************************************
 #endregion
 #region  --  Includes
;******************************************************************************
 #include <GUIConstants.au3>
 #include <GUIwindow.au3>
 #Include <Misc.au3>
;******************************************************************************
 #endregion
 #region  --  Processor Instructions
;******************************************************************************
 #NoTrayIcon
 opt("MustDeclareVars", 1)
 opt("TrayAutoPause", 0)
 opt("MouseCoordMode", 0)
 Opt("PixelCoordMode", 0)
;******************************************************************************
 #endregion
 #region  --  Pre-Run Program Checks
;******************************************************************************
 If WinExists($g_szVersion) Then Exit
 AutoItWinSetTitle($g_szVersion)
;******************************************************************************
 #endregion
 #region  --  Script Loop
;******************************************************************************
 HotKeySet("{END}", "Quit")
 Do
     If _IsPressed (04) Then GetParameters()
     Sleep(100)
 Until 0
;******************************************************************************
 #endregion
 #region  --  GetParameters()
;******************************************************************************
 Func GetParameters()
     GUIDelete($MainGUI)
     $MouseCoords = MouseGetPos()
     $PixelColor = PixelGetColor($MouseCoords[0], $MouseCoords[1])
     $WinPosn = WinGetPos("")
     $WinTitle = WinGetTitle ("")
     $Text = "Window: " & $WinPosn[0] & ", " & $WinPosn[1] & ", " & $WinPosn[2] & ", " _
         & $WinPosn[3] & "  Width: " & @DesktopWidth & "  Height: " & @DesktopHeight _
         & "  Mouse: " & $MouseCoords[0] & ", " & $MouseCoords[1] & "  Colour: " _
         & $PixelColor & "  Title: " & $WinTitle
     $MainGUI = _TransparentTextWindow ($Title, $Text, (@DesktopWidth - 1), 22, 1, (@DesktopHeight - 50), -1, -1, "0xFFFF00", 0, 0, 0, 1)
     If @error Then
         MsgBox(262160, "ERROR", "Unable to create window - check parameters")
         Exit
     EndIf
     GUISetState(@SW_SHOW)      
 EndFunc
;******************************************************************************
 #endregion
 #region  --  Quit()
;******************************************************************************
 Func Quit()
     Exit
 EndFunc
;******************************************************************************
 #endregion
Edited by PartyPooper
Link to comment
Share on other sites

From WikiPedia...

The slang exclamation duh is used to express one's disapproval of the obviousness of something. For example, if you read a headline saying "Scientific study proves rain may make you wet", the response may well be "Well, duh!".

Duh! got its start as a derogatory imitation of the sounds made by severely mentally handicapped people.

Eventually, it worked its way into sarcastic usage. If somebody said "Rain is wet!", a response might be, "No, duh! I never would have guessed that!" In this sense, the responder is mocking the sounds of a mentally-handicapped person to imply that he himself would have to be mentally handicapped not to already know that rain is wet.

In other words, PartyPooper was saying, "I'm such a dumbass!"

Personally, I like the Futurama variation, "FLUH!"

Edited by c0deWorm

My UDFs: ExitCodes

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...