Jump to content

Add a drop shadow to native AutoIt GUI Forms and Dialogs


rover
 Share

Recommended Posts

Add a drop shadow to native AutoIt GUI Forms and Dialogs

A demonstration of modifying style parameter of 'AutoIt v3 GUI' form class and '#32770' dialog class

to support using the XP drop shadow you all know and love with your scripts.

Minimum OS Windows XP

not very useful, but there you go.

and wherever you go, there you are. :P

see also: _WinAPI_RegisterClassEx()

using a PNG GUI with alpha transparency is preferable (see lod3n PNG code in examples forum)

as this drop shadow effect is user enabled/disabled by control panel Display Properties/Appearance/Effects/'Show shadows under menus'

MSDN - About Window Classes

http://msdn.microsoft.com/en-us/library/ms633574(VS.85).aspx

Windows XP: Enables the drop shadow effect on a window.

The effect is turned on and off through SPI_SETDROPSHADOW.

Typically, this is enabled for small, short-lived windows such as menus to emphasize their Z order relationship to other windows.

adds window class SysShadow to menus, tooltips, forms, and dialogs

not recommended for resizeable windows.

a noticeable lag in resizing and undesirable maximize effects. - see example script

best used with message boxes, FileOpen/Save dialogs and custom dialogs.

(MsgBox and File dialogs require hook procedure)

Links

Kips UDF creates custom class windows with drop shadow

_WinAPI_RegisterClassEx() - Kip

http://www.autoitscript.com/forum/index.php?showtopic=79575

add drop shadows to message boxes and file dialogs using SetWindowsHookEx

ProgAndy's xMsgBox and Siao's OpenDialog window hooking examples can be modified for drop shadow

xMsgBox - ProgAndy

http://www.autoitscript.com/forum/index.php?showtopic=81976

File Open/Save Dialogs customization - Siao

http://www.autoitscript.com/forum/index.php?showtopic=64057

Edit - added screenshot

Note: If a child dialog is created with SetParent or hWnd parameter of MsgBox or File dialogs etc.

then drop shadow will disappear if parent form is clicked on unless child dialog is created with topmost z-order (262144 and 4096 flags for message box)

Edit2 - updated and renamed UDF

_GuiSetDropShadow UDF - Updated, added current process check

;#FUNCTION#========================================================================================
; Name...........: _GuiSetDropShadow
; Description ...: Sets the drop shadow effect on forms and dialogs for current process
; Syntax.........: _GuiSetDropShadow($hwnd, $fDisrespectUser = True)
; Parameters ....: $hWnd                   - Handle to parent form or child dialog (GuiCreate(), MsgBox(), FileOpenDialog(), etc.)
;                        $fDisrespectUser   - True: (Default) - set system option for drop shadow if disabled by user
;                                                     - False:           - do not set system option for drop shadow if disabled by user
; Return values .: Success    - 1
;                        Failure         - 0       - @error set and @extended set to point of failure
; Author(s) ........: rover, (lod3n, Rasim for Get/SetClassLong, Kip - RegisterclassEx() for drop shadow idea, ProgAndy - xMsgBox hook)
; Remarks .......: Note: drop shadow is lost if parent form clicked on (If MsgBox created with parent handle)
;                                hiding, then restoring MsgBox to foreground or moving MsgBox off of form restores drop shadow.
;                                use 262144 or 4096 flags with MsgBox if using with hParent handle to prevent loss of drop shadow if parent clicked on.
;                                this behaviour is apparently by design.
;+
;                 Minimum Operating Systems: Windows XP
; Related .......:
; Link ..........; @@MsdnLink@@ SetClassLong Function
; Example .......; Yes
; ===================================================================================================
Func _GuiSetDropShadow($hwnd, $fDisrespectUser = True)
    If Not IsHWnd($hwnd) Then Return SetError(1, 1, 0)
    
  ;check if hWnd is from current process
    Local $aResult = DllCall("User32.dll", "int", "GetWindowThreadProcessId", "hwnd", $hwnd, "int*", 0)
    If @error Or $aResult[2] <> @AutoItPID Then Return SetError(@error, 2, 0)
    
    If Not IsDeclared("SPI_GETDROPSHADOW") Then Local Const $SPI_GETDROPSHADOW = 0x1024
    If Not IsDeclared("SPI_SETDROPSHADOW") Then Local Const $SPI_SETDROPSHADOW = 0x1025
    If Not IsDeclared("CS_DROPSHADOW") Then Local Const $CS_DROPSHADOW = 0x00020000
    If Not IsDeclared("GCL_STYLE") Then Local Const $GCL_STYLE = -26
    
    $aResult = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETDROPSHADOW, "int", 0, "int*", 0, "int", 0)
    Local $iErr = @error
    If $iErr Or Not IsArray($aResult) Then Return SetError($iErr, 3, 0)
    
   ;if 'Show shadows under menus' option not set, try activating it.
    If Not $aResult[3] And $fDisrespectUser Then
       ;turn on drop shadows
        $aResult = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_SETDROPSHADOW, "int", 0, "int", True, "int", 0)
        $iErr = @error
        If $iErr Or Not IsArray($aResult) Or $aResult[0] <> 1 Then Return SetError($iErr, 4, 0)
    EndIf
    
  ;get styles from WndClassEx struct
    $aResult = DllCall("user32.dll", "dword", "GetClassLong", "hwnd", $hwnd, "int", $GCL_STYLE)
    $iErr = @error
    If $iErr Or Not IsArray($aResult) Or Not $aResult[0] Then Return SetError($iErr, 5, 0)
    Local $OldStyle = $aResult[0]

  ;add drop shadow style to styles
    Local $Style = BitOR($OldStyle, $CS_DROPSHADOW)
    
    If StringRight(@OSArch, 2) == "64" Then
      ;if 64 bit windows (NOT TESTED)
      ;see MSDN SetClassLong remarks
      ;$aResult = DllCall("user32.dll", "ulong_ptr", "SetClassLongPtr", "hwnd", $hWnd, "int", $GCL_STYLE, "long_ptr", $Style)
      ;$iErr = @error
      ;If $iErr Or Not IsArray($aResult) Or Not $aResult[0] Then Return SetError($iErr, 6, 0)
    Else
        $aResult = DllCall("user32.dll", "dword", "SetClassLong", "hwnd", $hwnd, "int", $GCL_STYLE, "long", $Style)
        $iErr = @error
        If $iErr Or Not IsArray($aResult) Or Not $aResult[0] Then Return SetError($iErr, 7, 0)
        If $aResult[0] = $OldStyle Then Return SetError($iErr, 0, 1)
        Return SetError($iErr, 8, 0)
    EndIf
EndFunc;==>_GuiSetDropShadow

Example script

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
;;a dog and pony show drop shadow example script incorporating a modified version of ProgAndy's xMsgBox UDF
;Author: rover
;Mar 8 2009
#include-once
#include <WinApi.au3>
#include <GUIConstantsEX.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

;//xMsgBox struct
Global $tMSGBOXEX_MSGHOOK

Global $hGUI, $msg, $cButton1, $cButton2, $hIcon1, $hIcon2
Global $iStyles = Default
;Global $iStyles = BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX); uncomment to test resizing issues with drop shadow
$hGUI = GUICreate("Drop shadow on forms and dialogs demo", 400, 300, 100, 100, $iStyles)
_GuiSetDropShadow($hGUI) ;set drop shadow on main form
If @error Or @extended Then xMsgBox(16 + 262144, "_GuiSetDropShadow()", "Failed to set system for drop shadow" & _
        @CRLF & "Error: " & @error & @CRLF & "Extended: " & @extended, Default, Default, Default, 0, $hGUI)

Global $sPic = @WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp"
If FileExists($sPic) Then
    Global $cPic = GUICtrlCreatePic(@WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp", 50, 0, 300, 300)
    GUICtrlSetState(-1, $GUI_DISABLE)
EndIf

$cButton1 = GUICtrlCreateButton('Dialog child of parent - centred on form', 75, 50, 250, 25)
$cButton2 = GUICtrlCreateButton('Dialog not child of parent - centred on desktop', 75, 150, 250, 25)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit 0
        Case $cButton1
            If @OSVersion <> "WIN_XP" Then
                $hIcon1 = _WinAPI_LoadShell32Icon(168)
            Else
                $hIcon1 = _WinAPI_LoadShell32Icon(170)
            EndIf
            ;see UDF Note
            ;drop shadow can disappear if MsgBox is created with handle to parent and not set to topmost z-order with 262144 or 4096 flags
            xMsgBox(64, "Message box with drop shadow", "Dialog child of parent - always centred on form", _
                    Default, Default, True, $hIcon1, $hGUI)
        Case $cButton2
            If @OSVersion <> "WIN_XP" Then
                $hIcon2 = _WinAPI_LoadShell32Icon(218)
            Else
                $hIcon2 = _WinAPI_LoadShell32Icon(154)
            EndIf
            xMsgBox(64 + 262144, "Message box with drop shadow", "Dialog not child of parent - default centred on desktop", _
                    Default, Default, Default, $hIcon2)
    EndSwitch
WEnd

;#FUNCTION#========================================================================================
; Name...........: _GuiSetDropShadow
; Description ...: Sets the drop shadow effect on forms and dialogs for current process
; Syntax.........: _GuiSetDropShadow($hwnd, $fDisrespectUser = True)
; Parameters ....: $hWnd                   - Handle to parent form or child dialog (GuiCreate(), MsgBox(), FileOpenDialog(), etc.)
;                         $fDisrespectUser    - True: (Default) - set system option for drop shadow if disabled by user
;                                                      - False:             - do not set system option for drop shadow if disabled by user
; Return values .: Success      - 1
;                         Failure         - 0       - @error set and @extended set to point of failure
; Author(s) ........: rover, (lod3n, Rasim for Get/SetClassLong, Kip - RegisterclassEx() for drop shadow idea, ProgAndy - xMsgBox hook)
; Remarks .......: Note: drop shadow is lost if parent form clicked on (If MsgBox created with parent handle)
;                                 hiding, then restoring MsgBox to foreground or moving MsgBox off of form restores drop shadow.
;                                 use 262144 or 4096 flags with MsgBox if using with hParent handle to prevent loss of drop shadow if parent clicked on.
;                                 this behaviour is apparently by design.
;+
;                  Minimum Operating Systems: Windows XP
; Related .......:
; Link ..........; @@MsdnLink@@ SetClassLong Function
; Example .......; Yes
; ===================================================================================================
Func _GuiSetDropShadow($hwnd, $fDisrespectUser = True)
    If Not IsHWnd($hwnd) Then Return SetError(1, 1, 0)
    
    ;check if hWnd is from current process
    Local $aResult = DllCall("User32.dll", "int", "GetWindowThreadProcessId", "hwnd", $hwnd, "int*", 0)
    If @error Or $aResult[2] <> @AutoItPID Then Return SetError(@error, 2, 0)
    
    If Not IsDeclared("SPI_GETDROPSHADOW") Then Local Const $SPI_GETDROPSHADOW = 0x1024
    If Not IsDeclared("SPI_SETDROPSHADOW") Then Local Const $SPI_SETDROPSHADOW = 0x1025
    If Not IsDeclared("CS_DROPSHADOW") Then Local Const $CS_DROPSHADOW = 0x00020000
    If Not IsDeclared("GCL_STYLE") Then Local Const $GCL_STYLE = -26
    
    $aResult = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETDROPSHADOW, "int", 0, "int*", 0, "int", 0)
    Local $iErr = @error
    If $iErr Or Not IsArray($aResult) Then Return SetError($iErr, 3, 0)
    
    ;if 'Show shadows under menus' option not set, try activating it.
    If Not $aResult[3] And $fDisrespectUser Then
    ;turn on drop shadows
        $aResult = DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_SETDROPSHADOW, "int", 0, "int", True, "int", 0)
        $iErr = @error
        If $iErr Or Not IsArray($aResult) Or $aResult[0] <> 1 Then Return SetError($iErr, 4, 0)
    EndIf
    
    ;get styles from WndClassEx struct
    $aResult = DllCall("user32.dll", "dword", "GetClassLong", "hwnd", $hwnd, "int", $GCL_STYLE)
    $iErr = @error
    If $iErr Or Not IsArray($aResult) Or Not $aResult[0] Then Return SetError($iErr, 5, 0)
    Local $OldStyle = $aResult[0]

    ;add drop shadow style to styles
    Local $Style = BitOR($OldStyle, $CS_DROPSHADOW)
    
    If StringRight(@OSArch, 2) == "64" Then
        ;if 64 bit windows (NOT TESTED)
        ;see MSDN SetClassLong remarks
        ;$aResult = DllCall("user32.dll", "ulong_ptr", "SetClassLongPtr", "hwnd", $hWnd, "int", $GCL_STYLE, "long_ptr", $Style)
        ;$iErr = @error
        ;If $iErr Or Not IsArray($aResult) Or Not $aResult[0] Then Return SetError($iErr, 6, 0)
    Else
        $aResult = DllCall("user32.dll", "dword", "SetClassLong", "hwnd", $hwnd, "int", $GCL_STYLE, "long", $Style)
        $iErr = @error
        If $iErr Or Not IsArray($aResult) Or Not $aResult[0] Then Return SetError($iErr, 7, 0)
        If $aResult[0] = $OldStyle Then Return SetError($iErr, 0, 1)
        Return SetError($iErr, 8, 0)
    EndIf
EndFunc  ;==>_GuiSetDropShadow



; AutoIt Coding by Prog@ndy

;Note: modified by rover - stripped down version of xMsgBox
;http://www.autoitscript.com/forum/index.php?showtopic=81976


;~Author of adapted VB-Code:    © Copyright 2002 Pacific Database Pty Limited
;~           Graham R Seach gseach@pacificdb.com.au
;~           Phone: +61 2 9872 9594  Fax: +61 2 9872 9593
;~
;~           Adapted from Randy Birch;~s code for creating and
;~           displaying a custom MsgBox with user-defined button
;~           text: "Modifying a Message Box with SetWindowsHookEx"
;~
;~           You may freely use and distribute this code
;~           with any applications you may develop, on the
;~           condition that the copyright notice remains
;~           unchanged, and intact as part of the code. You
;~           may not publish this code in any form without
;~           the express written permission of the copyright
;~           holder.
;~
;~ http://www.pacificdb.com.au/MVP/Code/XMsgBox.htm
;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~;~
;===============================================================================
;
; Function Name:   xMsgBox
; Description::    Shows a Message Box with Custom Buttons and Optional custom Icon
; Parameter(s):    $lFlagType    -> MSgBox Flags
;                  $sPrompt      -> Text
;                  $sTitle       -> Title
;                  $lLeft        -> Left Position of MsgBox
;                  $lTop         -> Top Position of MsgBox
;                   $lCentre    -> Centre MsgBox to parent form ($hwndThreadOwner required)
;                  $hDialogIcon    -> Optional: Handle of Icon for MsgBox, Default: Empty
;                  $hwndThreadOwner -> Optional: Handle of owner window
;
; Requirement(s):  v3.2.12.0 or higher
; Return Value(s): default MsgBox
; Author(s):   Prog@ndy - modified by rover - stripped down version
;
; xMsgBox
; http://www.autoitscript.com/forum/index.php?showtopic=81976
;
;===============================================================================
;
Func xMsgBox($lFlagType, $sTitle, $sPrompt, $lLeft = 0, $lTop = 0, $lCentre = 0, $hIcon = 0, $hwndThreadOwner = 0, $fShadow = True)

    Local $hInstance; As Long
    Local $hThreadId; As Long
    Local $hWndOwner; As Long
    Local $xMsgBox

;~Setup the MsgBox parameters
    If $lLeft = -1 Or $lLeft = Default Or IsString($lLeft) = 1 Then
        $lLeft = -1
    Else
        $lLeft = Int($lLeft)
    EndIf
    
    If $lTop = -1 Or $lTop = Default Or IsString($lTop) = 1 Then
        $lTop = -1
    Else
        $lTop = Int($lTop)
    EndIf
    
    If $lCentre == -1 Or $lCentre = Default Or $lCentre = False Then $lCentre = 0
    If $lCentre == True Or Int($lCentre) >= 1 Or IsString($lCentre) = 1 Then $lCentre = 1
    
;~Check for an icon
    If $hIcon = -1 Or $hIcon = Default Or IsString($hIcon) = 1 Then $hIcon = 0
    $hIcon = Int($hIcon)
    
    If IsBool($fShadow) Then
        If $fShadow = True Then
            $fShadow = 1
        Else
            $fShadow = 0
        EndIf
    Else
        $fShadow = 0
    EndIf
    
;~Setup the hook.
    If Not IsHWnd($hwndThreadOwner) Then
        $hInstance = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
        $hInstance = $hInstance[0]
        $hwndThreadOwner = 0
    Else
        $hInstance = _WinAPI_GetWindowLong($hwndThreadOwner, $GWL_HINSTANCE)
    EndIf

    $hThreadId = _WinAPI_GetCurrentThreadId()
    $hWndOwner = _WinAPI_GetDesktopWindow()

;~Setup the MSGBOX_HOOK_PARAMS values.
;~By specifying a Windows hook as one of the params, we can intercept messages
;~sent by Windows and thereby manipulate the dialog.
;~     With MSGHOOK
    Local $tagMSGBOXEX_MSGHOOK = "long hWndOwner;long hHook;long Left;long Top;long Centre;long hIcon;hwnd hThreadOwner;long Shadow"
    $tMSGBOXEX_MSGHOOK = DllStructCreate($tagMSGBOXEX_MSGHOOK)

    DllStructSetData($tMSGBOXEX_MSGHOOK, "hWndOwner", $hWndOwner)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "Left", $lLeft)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "Top", $lTop)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "Centre", $lCentre)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "hIcon", $hIcon)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "hThreadOwner", $hwndThreadOwner)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "Shadow", $fShadow)
    
    Local $iMSGBOXHOOKPROC = DllCallbackRegister("MsgBoxHookProc", "long", "long;long;long")
    Local $aTemp = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_CBT, _
            "ptr", DllCallbackGetPtr($iMSGBOXHOOKPROC), "hwnd", $hInstance, "dword", $hThreadId)
    DllStructSetData($tMSGBOXEX_MSGHOOK, "hHook", $aTemp[0])
;~     End With

;~Call the MessageBox API and return the value as the result of the function. The
;~length of the Prompt & Title strings assures the messagebox is wide enough for
;~the message that will be set in the hook.

    $xMsgBox = MsgBox($lFlagType, $sTitle, $sPrompt, 0, $hwndThreadOwner)
    Local $iErr = @error
    DllCallbackFree($iMSGBOXHOOKPROC)
    Return SetError($iErr, 0, $xMsgBox)
EndFunc   ;==>xMsgBox

Func MsgBoxHookProc($uMsg, $wParam, $LParam); As Long
    #forceref $LParam
    ;Author: ProgAndy - modified by rover
    ; xMsgBox
    ; http://www.autoitscript.com/forum/index.php?showtopic=81976
    
;~When the message box is about to display, change the titlebar icon,
;~move and/or centre message box and add drop shadow.
    ;If Not IsDeclared("HCBT_ACTIVATE") Then Local  Const $HCBT_ACTIVATE = 5
    Local Const $HCBT_ACTIVATE = 5
    If $uMsg = $HCBT_ACTIVATE Then
;~UnhookWindowsHookEx MSGHOOK.hHook
        DllCall("user32.dll", "long", "UnhookWindowsHookEx", "long", DllStructGetData($tMSGBOXEX_MSGHOOK, "hHook"))
;~In an HCBT_ACTIVATE message, wParam holds the handle to the messagebox.
        Local $hwnd = HWnd($wParam)

        If IsHWnd($hwnd) Then
            ;retrieve custom message box struct parameters
            Local $iMSGBOXEX_mLeft = DllStructGetData($tMSGBOXEX_MSGHOOK, "Left")
            Local $iMSGBOXEX_mTop = DllStructGetData($tMSGBOXEX_MSGHOOK, "Top")
            Local $iCentre = DllStructGetData($tMSGBOXEX_MSGHOOK, "Centre")
            Local $hDialogIcon = DllStructGetData($tMSGBOXEX_MSGHOOK, "hIcon")
            Local $hThreadOwner = DllStructGetData($tMSGBOXEX_MSGHOOK, "hThreadOwner")
            Local $iShadow = DllStructGetData($tMSGBOXEX_MSGHOOK, "Shadow")
            
            ;centre message box on parent form
            If IsHWnd($hThreadOwner) And $iCentre = 1 Then
                Local $aSize1 = WinGetPos($hwnd)
                Local $aSize2 = WinGetPos($hThreadOwner)
                If IsArray($aSize1) And IsArray($aSize2) Then
                    $iMSGBOXEX_mLeft = $aSize2[0] + ($aSize2[2] / 2) - ($aSize1[2] / 2)
                    $iMSGBOXEX_mTop = $aSize2[1] + ($aSize2[3] / 2) - ($aSize1[3] / 2)
                EndIf
            EndIf
            
            ;add superfluous drop shadow to MsgBox()
            If $iShadow Then _GuiSetDropShadow($hwnd)

;~Only move the MsgBox if values have been supplied
            If $iMSGBOXEX_mLeft <> -1 Or $iMSGBOXEX_mTop <> -1 Then WinMove($hwnd, "", $iMSGBOXEX_mLeft, $iMSGBOXEX_mTop)
            
            ;set custom icon
            If $hDialogIcon > 0 Then
                Local $retVal = _SendMessage($hwnd, $WM_SETICON, 1, $hDialogIcon)
                If $retVal <> 0 Then _WinAPI_DestroyIcon($retVal)
                _WinAPI_DestroyIcon($hDialogIcon)
            EndIf
        EndIf
    EndIf

;~Return False to let normal processing continue.
    Return False
EndFunc   ;==>MsgBoxHookProc

Screenshot of drop shadow effect

post-22637-1236690268_thumb.jpg

Edited by rover

I see fascists...

Link to comment
Share on other sites

  • Moderators

rover,

Thanks for that - a very nice addition to my "Snippets" folder. Works nicely on Vista Basic colour scheme for those who were asking.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Nice script rover, thanks.

For the message box which is centred in the parent window it needs the 262144 adding to the flag as the other one has. Otherwise the shadow jumps behind the parent (apparently) if you click on the title bar of the message box or if you click on the parent window.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Nice script rover, thanks.

For the message box which is centred in the parent window it needs the 262144 adding to the flag as the other one has. Otherwise the shadow jumps behind the parent (apparently) if you click on the title bar of the message box or if you click on the parent window.

Hi Martin, Thanks

262144 adding to the flag

That was intentional.

I wanted to show the problem with using parent handle without topmost flag, but I removed the comment placed above the Msgbox line when cleaning up the example and forgot to add it back in. (was going to add note in UDF header but put off doing it until now).

I added the comment to the first edit note when I uploaded the screenshot.

have now added the comment to the example as well as a note in the UDF header.

GEOSoft is putting this in his Dialogs UDF on his website along with a UDF made from that no title icon code I posted in the help forum.

Cheers

Edited by rover

I see fascists...

Link to comment
Share on other sites

  • 5 years later...
  • 5 years later...

Hi

this is my first code Shadow Text effect

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

$Form1 = GUICreate("Form1", 306, 231, 215, 165)

$Label1 = GUICtrlCreateLabel("Label1", 65, 66, 164, 89)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1,$color_Gray)
GUICtrlSetFont(-1, 19, 700, 0, "Tahoma")
$Label1 = GUICtrlCreateLabel("Label1", 64, 64, 164, 89)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, $Color_Red)
GUICtrlSetFont(-1, 19, 700, 0, "Tahoma")
GUISetState(@SW_SHOW)

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

 

Untitled.png

Edited by techwizard
Update Reply
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...