Jump to content

notifier on systray


Recommended Posts

Hello.

I need some information. I want to notify something on system tray. For example when we receive a mail Massenger or Outlook showing notifiying or alerting from system tray. else when some be online messenger alerting us.

I need that kind of program. How can make that program.

Thanks.

Fatih

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

  • Moderators

FATIHTALI,

Is this the sort of thing you are looking for?

#include <WindowsConstants.au3>
#Include <WinAPI.au3>

; Create Toast window
Global $hGUI = GUICreate("", 200, 100, @DesktopWidth - 210, @DesktopHeight - 130, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
Global $hLabel = GUICtrlCreateLabel("Click to close", 1, 1, 198, 198)

; Slide in Toast - but keep focus on current window
_WinAnimate($hGUI, 0x00040008)
$hCurrWnd = _WinAPI_GetForegroundWindow()
GUISetState(@SW_SHOW, $hGUI)
WinActivate($hCurrWnd, "")

; Wait for click from Toast
While 1
    
    Local $aMsg = GUIGetMsg(1)

    If $aMsg[1] = $hGUI And $aMsg[0] = $hLabel Then ExitLoop
    
WEnd

; Slide out window
_WinAnimate($hGUI, 0x00050004)

Exit

; --------------

; Gary Frost's WinAnimate function

Func _WinAnimate($h_gui, $i_mode, $i_duration = 1000)
    
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Or @OSVersion = "WIN_VISTA" Then
        
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $h_gui, "int", $i_duration, "long", $i_mode)
        
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            Return SetError(1, 0, 0)
        EndIf
        Return 1
        
    Else
        
        Return SetError(2, 0, 0)
        
    EndIf
EndFunc;==> _WinAnimate()

If so, I can point you to a more complete version. :-)

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

Hello again.

I tried to add some code before to exit. In the sample when we click notify program closing.

I add _RunDos and IECreate command before the EXIT. Also I use Filewriteline. Filewriteline is working well. I never see problem. but _RunDos and _IECreate

I couldnt resolve this problem.

Coul you help me?

CODE
; Wait for click from Toast

While 1

Local $aMsg = GUIGetMsg(1)

If $aMsg[1] = $hGUI And $aMsg[0] = $hLabel Then ExitLoop

WEnd

; Slide out window

_WinAnimate($hGUI, 0x00050004)

;$rc = _RunDos("http://bit/NY/Sayfalar/NY1.aspx")

_IECreate("www.google.com",0,0,1,0)

$file = FileOpen(@ScriptDir&"\haberci.log", 1)

FileWriteLine($file, ""&@ComputerName&"test,"&@OSVersion&","&@OSServicePack&",program_worked")

FileClose($file)

Exit

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

  • Moderators

FATIHTALI,

Your code for _IECreate does not have the "$f_visible" parameter set. You need to change the line to read:

_IECreate("www.google.com",0,1,1,0)

That works for me.

I have no idea about the _RunDOS command - sorry!

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

FATIHTALI,

Your code for _IECreate does not have the "$f_visible" parameter set. You need to change the line to read:

_IECreate("www.google.com" ,0,1,1,0)

That works for me.

I have no idea about the _RunDOS command - sorry!

M23

thanks. When I deleted ,0,1,1,0 It worked well.
Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

  • 1 month later...

Can we add more complex Gui or button like Yes No ...

I add buttons but It couldnt show.

^_^

FATIHTALI,

Is this the sort of thing you are looking for?

#include <WindowsConstants.au3>
#Include <WinAPI.au3>

; Create Toast window
Global $hGUI = GUICreate("", 200, 100, @DesktopWidth - 210, @DesktopHeight - 130, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
Global $hLabel = GUICtrlCreateLabel("Click to close", 1, 1, 198, 198)

; Slide in Toast - but keep focus on current window
_WinAnimate($hGUI, 0x00040008)
$hCurrWnd = _WinAPI_GetForegroundWindow()
GUISetState(@SW_SHOW, $hGUI)
WinActivate($hCurrWnd, "")

; Wait for click from Toast
While 1
    
    Local $aMsg = GUIGetMsg(1)

    If $aMsg[1] = $hGUI And $aMsg[0] = $hLabel Then ExitLoop
    
WEnd

; Slide out window
_WinAnimate($hGUI, 0x00050004)

Exit

; --------------

; Gary Frost's WinAnimate function

Func _WinAnimate($h_gui, $i_mode, $i_duration = 1000)
    
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Or @OSVersion = "WIN_VISTA" Then
        
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $h_gui, "int", $i_duration, "long", $i_mode)
        
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            Return SetError(1, 0, 0)
        EndIf
        Return 1
        
    Else
        
        Return SetError(2, 0, 0)
        
    EndIf
EndFunc;==> _WinAnimate()

If so, I can point you to a more complete version. :-)

M23

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

  • Moderators

FATIHTALI,

It is a normal wondow, so there should be no reason for other controls to fail. This works for me:

#include <WindowsConstants.au3>
#Include <WinAPI.au3>

; Create Toast window
Global $hGUI = GUICreate("", 200, 100, @DesktopWidth - 210, @DesktopHeight - 130, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
Global $hButton_1 = GUICtrlCreateButton("Button 1", 10, 10, 80, 30)
Global $hButton_2 = GUICtrlCreateButton("Button 2", 10, 50, 80, 30)
Global $hButton_3 = GUICtrlCreateButton("Close", 100, 10, 80, 30)

; Slide in Toast - but keep focus on current window
_WinAnimate($hGUI, 0x00040008)
$hCurrWnd = _WinAPI_GetForegroundWindow()
GUISetState(@SW_SHOW, $hGUI)
WinActivate($hCurrWnd, "")

; Wait for click from Toast
While 1
    
    Local $aMsg = GUIGetMsg(1)

    If $aMsg[1] = $hGUI Then
        Switch $aMsg[0]
            Case $hButton_1
                MsgBox(0, "Test", "You pressed Button 1")
            Case $hButton_2
                MsgBox(0, "Test", "You pressed Button 2")
            Case $hButton_3
                ExitLoop
        EndSwitch
    EndIf
    
WEnd

; Slide out window
_WinAnimate($hGUI, 0x00050004)

Exit

; --------------

; Gary Frost's WinAnimate function

Func _WinAnimate($h_gui, $i_mode, $i_duration = 1000)
    
    If @OSVersion = "WIN_XP" OR @OSVersion = "WIN_2000" Or @OSVersion = "WIN_VISTA" Then
        
        DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $h_gui, "int", $i_duration, "long", $i_mode)
        
        Local $ai_gle = DllCall('kernel32.dll', 'int', 'GetLastError')
        If $ai_gle[0] <> 0 Then
            Return SetError(1, 0, 0)
        EndIf
        Return 1
        
    Else
        
        Return SetError(2, 0, 0)
        
    EndIf
EndFunc;==> _WinAnimate()

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

  • 3 weeks later...

I add background.

But When I start program only Button1 showing. So when I move mouse on Close and Button2 it is showing.

I couldnt understand why.

$Pic21 = GUICtrlCreatePic(@ScriptDir&"\bitweb.jpg", 0, 0, 401, 102) ;BitOR($S2S_NOTIFY,$W2S_GROUP,$W2S_CLIPSIBLINGS))

Startup Agent It is my small Startup Agent. You can install programs on startup Domain pc without Admin rights.
Link to comment
Share on other sites

  • Moderators

FATIHTALI,

You need to disable the Pic control. Try it like this:

; First the Pic
$Pic21 = GUICtrlCreatePic(@ScriptDir&"\bitweb.jpg", 0, 0, 401, 102) 
; Now disable it
GUICtrlSetState(-1, $GUI_DISABLE)
; Finally the buttons
Global $hButton_1 = GUICtrlCreateButton("Button 1", 10, 10, 80, 30)
Global $hButton_2 = GUICtrlCreateButton("Button 2", 10, 50, 80, 30)
Global $hButton_3 = GUICtrlCreateButton("Close", 100, 10, 80, 30)

Cretaing in this order gives me a background image and all the buttons show (and work!).

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

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