Navigation:  Examples >

Taskbar Icon

Previous pageReturn to chapter overviewNext page

http://news.xbwin.com/ot4xb.examples/6/

 

#include "ot4xb.ch"

// ---------------------------------------------------------------------------

#define IDI_APPLICATION     32512

#define IDI_HAND            32513

#define IDI_QUESTION        32514

#define IDI_EXCLAMATION     32515

#define IDI_ASTERISK        32516

#define IDI_WINLOGO         32517

// ---------------------------------------------------------------------------

#define NIIF_NONE       0x00000000

#define NIIF_INFO       0x00000001

#define NIIF_WARNING    0x00000002

#define NIIF_ERROR      0x00000003

// ---------------------------------------------------------------------------

proc dbesys ; return

// ---------------------------------------------------------------------------

proc main()

local nKey := 0

local oTbi := TNotifyIcon():New(0,IDI_EXCLAMATION, "Using a system icon")

local oCrt := SetAppWindow()

 

oTbi:bOnContextMenu  := {|| QOut("OnContextMenu")}

oTbi:bOnLDblClick    := {|| QOut("OnLDblClick  ")}

oTbi:bOnLClick       := {|| QOut("OnLClick     ")}

oTbi:bOnMouseMove    := {|| QOut("OnMouseMove  ")}

 

 

? "Press a key to show icon from system in the taskbar ... " ; Inkey(0)

oTbi:Show()

oTbi:ShowInfo(,"From System",1)

 

? "Press a key to show icon from file in the taskbar ... " ; Inkey(0)

oTbi:Modify("0.ico",NIL,"Using a Icon From File")

oTbi:ShowInfo(,"From File",2)

 

? "Press a key to show icon from EXE resource in the taskbar ... " ; Inkey(0)

oTbi:Modify(NIL,2,"Using a Icon From Resource in EXE")

oTbi:ShowInfo(,"From resource in EXE",3)

 

? "Press a key to show icon from DLL resource in the taskbar ... " ; Inkey(0)

oTbi:Modify("test.dll",3,"Using a Icon From resource in DLL")

if oTbi:ShowInfo(,"From resource in DLL",1)

   ? "Press a key to hide the ballon ... " ; inkey(0)

   oTbi:HideInfo()

end

? "Press a key to start the icon animation" ; Inkey(0)

oTbi:StartAnimation({{,1,""},{,2},{,3},{,4},{,5},{,6},{,7},{,8},{,9},{,10}}, 200 )

 

? "Press a key to stop the icon animation" ; Inkey(0)

oTbi:StopAnimation()

 

? "Press ESC to close ... " ; while (nKey := Inkey(0)) != 27 ; end

oTbi:Destroy()

return