Jump to content

System Tray Message Box UDF


Valuater
 Share

Recommended Posts

i modified this to

; Simple Example
_TrayMessageBox("Title_A1", "Title_B2", "This is a tray message box text" & @CRLF & @CRLF & "    ...Thanks, Valuater")


Func _TrayMessageBox($TBTitle, $TBText1, $TBText2, $TBwidth = 220, $TBheight = 100, $display_Time = 5000)
    If Not WinExists($TBTitle, "") Then
        $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth + 10), @DesktopHeight - ($TBheight + 53), -1, $WS_EX_TOOLWINDOW)
        GUISetBkColor(0xFFFFFF)
        $Label1 = GUICtrlCreateLabel($TBText1, 8, 8, 211, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label2 = GUICtrlCreateLabel($TBText2, 8, 32, 208, 57)
        GUICtrlSetColor(-1, 0x0000FF)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
        GUISetState()
        WinSetOnTop($TBTitle, "", 1)
        Sleep($display_Time)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
        GUIDelete($TBgui)
    EndIf   
EndFunc   ;==>_TrayMessageBox

now, last problem... how to make it not moveable?

Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.
Link to comment
Share on other sites

i modified this to

; Simple Example
_TrayMessageBox("Title_A1", "Title_B2", "This is a tray message box text" & @CRLF & @CRLF & "    ...Thanks, Valuater")


Func _TrayMessageBox($TBTitle, $TBText1, $TBText2, $TBwidth = 220, $TBheight = 100, $display_Time = 5000)
    If Not WinExists($TBTitle, "") Then
        $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth + 10), @DesktopHeight - ($TBheight + 53), -1, $WS_EX_TOOLWINDOW)
        GUISetBkColor(0xFFFFFF)
        $Label1 = GUICtrlCreateLabel($TBText1, 8, 8, 211, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label2 = GUICtrlCreateLabel($TBText2, 8, 32, 208, 57)
        GUICtrlSetColor(-1, 0x0000FF)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
        GUISetState()
        WinSetOnTop($TBTitle, "", 1)
        Sleep($display_Time)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
        GUIDelete($TBgui)
    EndIf   
EndFunc   ;==>_TrayMessageBox

now, last problem... how to make it not moveable?

What youve made is simply to regroup all functions...

For make unmoveable gui you have to use _TraySetStyle and put style without sys menu...

Func _TrayBoxSetStyle($Style = 0x16C80000, $ExStyle = 0x00000189, $TBGui = "TrayBox")
     GUISetStyle($WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST, $TBGui)
 EndFunc ;==>_TrayBoxSetStyle
Edited by FireFox
Link to comment
Share on other sites

What youve made is simply to regroup all functions...

For make unmoveable gui you have to use _TraySetStyle and put style without sys menu...

Func _TrayBoxSetStyle($Style = 0x16C80000, $ExStyle = 0x00000189, $TBGui = "TrayBox")
     GUISetStyle($WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST, $TBGui)
 EndFunc;==>_TrayBoxSetStyle
i don't want to hide the 'X' Button for closing the gui.

this is what i have done.

; Simple Example
_TrayMessageBox("Title_A1", "Title_B2", "This is a tray message box text" & @CRLF & @CRLF & "    ...Thanks, Valuater")


Func _TrayMessageBox($TBTitle, $TBText1, $TBText2, $TBwidth = 220, $TBheight = 100, $display_Time = 5000)
    If Not WinExists($TBTitle, "") Then
        $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth + 10), @DesktopHeight - ($TBheight + 53), -1, $WS_EX_TOOLWINDOW)
        GUISetBkColor(0xFFFFFF)
        _TrayBoxSetStyle()
        $Label1 = GUICtrlCreateLabel($TBText1, 8, 8, 211, 17)
        GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
        GUICtrlSetColor(-1, 0xFF0000)
        $Label2 = GUICtrlCreateLabel($TBText2, 8, 32, 208, 57)
        GUICtrlSetColor(-1, 0x0000FF)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
        GUISetState()
        WinSetOnTop($TBTitle, "", 1)
        $begin = TimerInit ()
        While 1
            $dif = TimerDiff ($begin)
            if $dif > 5000 then exitloop
        WEnd        
        ;Sleep($display_Time)
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
        GUIDelete($TBgui)
    EndIf   
EndFunc   ;==>_TrayMessageBox
Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.
Link to comment
Share on other sites

@SoftVoile

This is not udf its just function where you have regroup certain functions :)

You can do it functions and with _TrayBoxSetStyle you can set $WS_EX_TOOLWINDOW

Perhaps would i add delete traybox function when valuater will answer to my 18th reply :)

Link to comment
Share on other sites

Your answer is right at the top of the page... click on it

...... Compatability Beta ver 3.2.11.1+ fix is here

http://www.autoitscript.com/forum/index.ph...st&p=233842

8)

oh i have run it! sr 4 my bad english! when i used this code!

#Include <XSkin.au3> 

; folder of skin
$Skin_Folder = @ScriptDir & "\Skins\Black-Yellow"
$XSkinGui = XSkinGUICreate( "My GUI", 400, 450, $Skin_Folder)
$button_1 = XSkinButton( "Input Dialog", 145, 100, 100, 35, "Input")

GUISetState()

While 1
    MouseOver()
    Sleep(10)
WEnd

Func OkCancel()
    XSkinTray Box( "XSkin", "Text Here")
EndFunc

it didn't work but when i used

#include <XSkin.au3>

; folder of skin
$Skin_Folder = @ScriptDir & "\Skins\Universal"

$XSkinGui = XSkinGUICreate( "My GUI", 400, 450, $Skin_Folder)

$button_1 = XSkinButton("Button 1", 145, 100, 100, 35, "Set_Tray")

GUISetState()

While 1
    MouseOver()
   
    Sleep(10)
WEnd

Func Set_Tray()
    XSkinTrayBox( "XSkin", "Test Button 1")
EndFunc

it ran very nice, thank you so much valuater and also firefox + andreik for function!

but somebody can tell me how to use Blue Vista Skin? i don't know how to skin my gui with it?

and Valuater when i changed $skin_folder to $Skin_Folder = @ScriptDir & "\ezSkin" and it appeared this box

how can i do to hide this title Xskin. and the first time i'd run it it did not appear full tray box! how can i fix it?

post-36657-1229579111_thumb.jpg

Edited by LeHuynhNam

4m848p10.gif 

Link to comment
Share on other sites

Hi

Very very very nice ..

I believe there should be some like a traybar size detection or a real desktop size .. then it would be perfect

Best regards,

Emiel

Maybe...

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>


_TrayMessageBox("Tray Message Box", "This is a tray message box text" & @CRLF & @CRLF & "                 ...Thanks, Valuater... 8)    ")


Func _TrayMessageBox($TBTitle, $TBText, $TBwidth = 220, $TBheight = 100, $display_Time = 5000)
    $hwnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
    $tPos = WinGetPos($hwnd)
    $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth), $tPos[1] - $TBheight, -1, BitOR($WS_EX_TOPMOST ,$WS_EX_TOOLWINDOW))
    $Status = GUICtrlCreateLabel($TBText, 20, 20)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
    GUISetState()
    Sleep($display_Time)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
    GUIDelete($TBgui)
EndFunc   ;==>_TrayMessageBox

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Hi Valuator,

Much better but not exactly what i mean..

take a look a the attached picture

it the about box from GoogleTalk

always displayed above the systemtray, even when it's three time the height of the startbutton

Thanks

Emiel

That should have worked, however when dealing with pop-ups the header is not included sometimes

This script works perfect on my XP

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>


_TrayMessageBox("Tray Message Box", "This is a tray message box text" & @CRLF & @CRLF & "                 ...Thanks, Valuater... 8)    ")


Func _TrayMessageBox($TBTitle, $TBText, $TBwidth = 220, $TBheight = 100, $display_Time = 5000)
    $hwnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
    $tPos = WinGetPos($hwnd)
    $header = 32
    $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth), @DesktopHeight - ($tPos[3] + $TBheight + $header));, -1, BitOR($WS_EX_TOPMOST ,$WS_EX_TOOLWINDOW))
    $Status = GUICtrlCreateLabel($TBText, 20, 20)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
    GUISetState()
    Sleep($display_Time)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
    GUIDelete($TBgui)
EndFunc   ;==>_TrayMessageBox

.... No matter what size the GUI is!!!!

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

@Valuator

You rock .. :)

Thanks

Emiel

EDIT

I'm using an adlib to close the TrayPopUp this will allow the X to work

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Dim $x = 0
Dim $Display_Time = 5000
Dim $TBgui

_TrayMessageBox("Tray Message Box", "This is a tray message box text" & @CRLF & @CRLF & "                ...Thanks, Valuater... 8)  ")

Func _TrayMessageBox($TBTitle, $TBText, $TBwidth = 220, $TBheight = 100, $display_Time = 5000)
    $hwnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
    $tPos = WinGetPos($hwnd)
    $header = 32
    $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth), @DesktopHeight - ($tPos[3] + $TBheight + $header));, -1, BitOR($WS_EX_TOPMOST ,$WS_EX_TOOLWINDOW))
    $Status = GUICtrlCreateLabel($TBText, 20, 20)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
    GUISetState()
        
    AdlibEnable ("_KillTrayMessageBox", 1000)
    
    While 1 
        $msg = GUIGetMsg ()
        If $msg = $GUI_EVENT_CLOSE Then exitloop
    Wend
EndFunc;==>_TrayMessageBox

Func _KillTrayMessageBox ()
        $x = $x + 1000
        If $x = $Display_Time Then 
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
            GUIDelete($TBgui)
            AdlibDisable ()
            exit; used in this example to exit the script
        EndIf
EndFunc
Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Link to comment
Share on other sites

maybe this is nicer then the previous example

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>


Dim $x = 0
Dim $Display_Time
Dim $TBgui

_TrayMessageBox("Tray Message Box", "This is a tray message box text" & @CRLF & @CRLF & "                 ...Thanks, Valuater... 8)    ")

Func _TrayMessageBox($TBTitle, $TBText, $TBwidth = 220, $TBheight = 100, $display_Time = 10000)
    $starttime = _Timer_Init()
    $hwnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
    $tPos = WinGetPos($hwnd)
    $header = 32

    $TBgui = GUICreate($TBTitle, $TBwidth, $TBheight, @DesktopWidth - ($TBwidth+10), @DesktopHeight - ($tPos[3] + $TBheight + $header), -1, $WS_EX_TOOLWINDOW);, -1, BitOR($WS_EX_TOPMOST ,$WS_EX_TOOLWINDOW))
    $Status = GUICtrlCreateLabel($TBText, 20, 20)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00040008);slide-in
    GUISetState()
    
    While 1 
        $msg = GUIGetMsg ()
        If $msg = $GUI_EVENT_CLOSE Then exitloop
        If _Timer_Diff($starttime) >= $Display_Time Then 
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBgui, "int", 1000, "long", 0x00050004);slide-out
            GUIDelete($TBgui)
            exitloop
        EndIf
    Wend
EndFunc
Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

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