English
Source / code snippets

inquire lay out Balloon Trayicon

 

TrayIcon with Balloon lay out and inquire of Andreas Miethe:[CODE]ex Profan 7.0
#######################
Topic : Tray-Icon
Balloon-hints
#######################
Andreas Miethe
august 2003
#######################
Balloon-hints are only available if in the Registry under
HKEY_CURENT_USER SoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced
the worth EnableBalloonTips on 1 standing.
Möglicherweise must the Key first laid out be.
#######################
DEF HiWord(1) And(&(1)>>16,$FFFF)
DEF LoWord(1) And(&(1),$FFFF)
DEF GetFileVersionInfoSize(2) ! Version,GetFileVersionInfoSizeA
DEF GetFileVersionInfo(4) ! Version,GetFileVersionInfoA
DEF VerQueryValue(4) ! Version,VerQueryValueA
DEF GetSysColor(1) ! user32,GetSysColor
DEF SetWindowPos(7) ! User32,SetWindowPos
DEF LoadIcon(2) ! User32,LoadIconA
DEF Shell_NotifyIcon(2) ! shell32,Shell_NotifyIconA
DEF RegisterWindowMessage(1) ! user32,RegisterWindowMessageA
DEF SetForegroundWindow(1) ! user32,SetForegroundWindow
DEF GetCursorPos(1) ! user32,GetCursorPos
DEF MapWindowPoints(4) ! user32,MapWindowPoints
DEF XSetTimer(4) ! user32,SetTimer
DEF &WM_USER $0400
DEF &COLOR_BTNFACE 15
DEF &SWP_NOACTIVATE $10
DEF &SWP_NOREDRAW $8
DEF &NIF_ICON $2
DEF &NIF_TIP $4
DEF &NIF_MESSAGE $1
DEF &NIF_INFO $10
DEF &NIM_ADD $0
DEF &NIM_DELETE $2
DEF &NIM_MODIFY $1
DEF &NIM_SETVERSION $4
DEF &NIM_SETFOCUS $3
Icons
DEF &NIIF_ERROR $3
DEF &NIIF_INFO $1
DEF &NIIF_NONE $0
DEF &NIIF_WARNING $2
DEF &NIF_STATE $8
DEF &NIS_HIDDEN $1
DEF &NIS_SHAREDICON $2
DEF &NIN_BALLOONSHOW  $0402
DEF &NIN_BALLOONHIDE  $0403
DEF &NIN_BALLOONTIMEOUT  $0404
DEF &NIN_BALLOONUSERCLICK $0405
DEF &WM_CLOSE $10
DEF &WM_LBUTTONDOWN $0201
DEF &WM_RBUTTONDOWN $0204
DEF &WM_SYSCOMMAND $0112
DEF &SC_RESTORE $F120
DEF &WM_SHELLNOTIFY $0405 &WM_USER + 5 shell notify message
DEF &uID 7777
DEF &NOTIFYICONDATA_V1_SIZE   88  pre-5.0 structure size
DEF &NOTIFYICONDATA_V2_SIZE  488 pre-6.0 structure size
DEF &NOTIFYICONDATA_V3_SIZE  504 6.0+ structure size
Declare NOTIFYICONDATASIZE&

Proc IsShellVersion

    Declare Retval&,k$
    Declare nBufferSize&,nUnUsed&
    Declare sDLLFile$
    Declare lpBuffer#,lplpBuffer&,lpBufferLenght&
    sDLLFile$ = Shell32
    nBufferSize& = GetFileVersionInfoSize(addr(sDLLFile$), addr(nUnused&))
    Dim lpBuffer#,nBufferSize&
    GetFileVersionInfo(addr(sDLLFile$),0,nBufferSize&,lpBuffer#)
    k$ = \
    VerQueryValue(lpBuffer#,addr(k$),addr(lplpBuffer&),Addr(lpBufferLenght&))
    RetVal& = Word(lplpBuffer&,10)
    Dispose lpBuffer#
    Return RetVal&

ENDPROC

The Size the NotifyIcon- structure is tributary of the Version the
Shell32.dll, therefore must first The Version examined be.
IsShellVersion

If @&(0) = 5 Version = 5

    NOTIFYICONDATASIZE& = &NOTIFYICONDATA_V2_SIZE

ElseIf @&(0) = 6 Version = 6

    NOTIFYICONDATASIZE& = &NOTIFYICONDATA_V3_SIZE
    Else Version = to 5
    NOTIFYICONDATASIZE& = &NOTIFYICONDATA_V1_SIZE

Endif

Declare Point#,TB_CREATED&
Declare InfoText$,InfoTitle$,hint$,Icon$,RegMessage$
Tip$ = Balloon-hints © Andreas Miethe * august 2003
InfoText$ = this Tray-Icon reacted on The rights How too on The left Mouse button
InfoText$ = InfoText$ +
+hint$+chr $(0)
InfoTitle$ = INFO MAX 255 characters
Icon$ =A
RegMessage$ = IconCreated
Struct Point = x&, y&
Struct note  = cbSize&,hWnd&,uID&,uFlags&,uCallbackMessage&,hIcon&,szTip#(128),
dwState&,dwStateMask&,szInfo#(256),uTimeoutAndVersion&,szInfoTitle#(64),
dwInfoFlags&,guidItem#(16)
Declare Ende&,note#
SetTrueColor 1
SetErrorlevel 0
Window -1000,0 - 0,0Window next to whom screen
CLS GetSysColor(&COLOR_BTNFACE)
ShowWindow(%hwnd,0)Window hide
SetWindowPos(%hwnd,0,0,0,640,480,OR(&SWP_NOREDRAW,&SWP_NOACTIVATE))new position
Dim note#,note
Clear note#
Note#.cbSize&           = NOTIFYICONDATASIZE&
Note#.hWnd&             = %hwnd
Note#.uID&              = &uID
Note#.hIcon&            = LoadIcon(%hInstance,ADDR(Icon$))
Note#.uFlags&           = Or(Or(Or(&NIF_ICON,&NIF_TIP),&NIF_MESSAGE),&NIF_STATE)
Note#.uCallbackMessage& = &WM_SHELLNOTIFY
Note#.szTip#            = hint$
Note#.dwState&          = &NIS_SHAREDICON
Note#.dwStateMask&      = Or(&NIS_HIDDEN,&NIS_SHAREDICON)
Note#.uTimeoutAndVersion& = 50$3
normales Icon insert
Shell_NotifyIcon(&NIM_ADD, note#)
Shell_NotifyIcon(&NIM_SETVERSION, note#)
modify for Balloon-hints
Note#.uFlags& = &NIF_INFO
Note#.szInfo# = InfoText$
Note#.szInfoTitle# = InfoTitle$
Note#.dwInfoFlags& = &NIIF_INFO
Note#.uTimeoutAndVersion& = 16000TimeOut
Shell_NotifyIcon(&NIM_MODIFY,note#)
TB_CREATED& = RegisterWindowMessage(ADDR(RegMessage$))
User Messages &WM_SHELLNOTIFY,TB_CREATED&,&WM_CLOSE
ShowWindow(%hwnd,0)
settimer 15000

Whilenot Ende&

    Waitinput

    If %wmtimer

        detour if MinTimeOut larger as 15 sec is
        Killtimer
        note#.szInfo# = chr $(0)
        note#.szInfoTitle# = chr $(0)
        Shell_NotifyIcon(&NIM_MODIFY,note#)
        MessageBox(Time run down,,0)
        Print Time run down

    Endif

    If %UMessage = &WM_CLOSE

        Shell_NotifyIcon(&NIM_DELETE,note#)
        Ende& = 1

    Endif

    If %UMessage = TB_CREATED&Explorer-Crash. Icon new lay out

        Shell_NotifyIcon(&NIM_ADD,note#)

    Endif

    If %UMessage = &WM_SHELLNOTIFY

        If &ULParam = &NIN_BALLOONTIMEOUT

            Killtimer
            MessageBox(Time run down,,0)
            Print Time run down

        Endif

        If &ULParam = &NIN_BALLOONUSERCLICK

            MessageBox(Click,,0)
            Print Click

        Endif

        If &ULParam = &NIN_BALLOONHIDE

            MessageBox(lane,,0)
            Print lane

        Endif

        If &ULParam = &WM_RBUTTONDOWNrechter Mausbutton

            SetForegroundWindow(%hWnd)
            Dim Point#,Point
            CreateMenu
            AppendMenu 100,Window hide
            AppendMenu 101,Window show
            Separator
            AppendMenu 102,end
            GetCursorPos(Point#)
            MapWindowPoints(%Desktop,%hwnd,Point#,1)
            Trackmenu Point#.x&,Point#.y&
            Dispose Point#

        Endif

        If &ULParam = &WM_LBUTTONDOWNlinker Mausbutton

            SetForegroundWindow(%hWnd)
            Dim Point#,Point
            CreateMenu
            AppendMenu 200,Linker Button 1
            AppendMenu 201,Linker Button 2
            Separator
            AppendMenu 202,Linker Button 3
            GetCursorPos(Point#)
            MapWindowPoints(%Desktop,%hwnd,Point#,1)
            Trackmenu Point#.x&,Point#.y&
            Dispose Point#

        Endif

    Endif

    If MenuItem(100)

        ShowWindow(%hwnd,0)

    ElseIf Menuitem(101)

        SendMessage(%hwnd,&WM_SYSCOMMAND,&SC_RESTORE,0)

    ElseIf Menuitem(102)

        Shell_NotifyIcon(&NIM_DELETE,note#)
        Ende& = 1

    ElseIf Menuitem(200)

        settimer 15000
        Shell_NotifyIcon(&NIM_MODIFY,note#)Balloontip Show

    Endif

Wend

salvo, iF.
 
07/01/05  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.068 Views

Untitledvor 0 min.
Paul Glatz07/13/16
GDL08/24/14
Ernst06/03/14
Torsten Boo08/10/13
More...

Themeninformationen

this Topic has 1 subscriber:

iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie