iczelion tut23[1]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 jimgreen 的 blog

tutorial 23: tray icon


in this tutorial, we will learn how to put icons into system tray and how to create/use a popup menu.
download the example here.

theory:

system tray is the rectangular region in the taskbar where several icons reside. normally, you'll see at least a digital clock in it. you can also put icons in the system tray too. below are the steps you have to perform to put an icon into the system tray:
  1. fill a notifyicondata structure which has the following members:
    • cbsize   the size of this structure.
    • hwnd      handle of the window that will receive notification when a mouse event occurs over the tray icon.
    • uid         a constant that is used as the icon's identifier. you are the one who decides on this value. in case you have more than one tray icons, you will be able to check from what tray icon the mouse notification is from.
    • uflags    specify which members of this structure are valid
      • nif_icon the hicon member is valid.
      • nif_message the ucallbackmessage member is valid.
      • nif_tip the sztip member is valid.
    • ucallbackmessage  the custom message that windows will send to the window specified by the hwnd member when mouse events occur over the tray icon. you create this message yourself.
    • hicon      the handle of the icon you want to put into the system tray
    • sztip       a 64-byte array that contains the string that will be used as the tooltip text when the mouse hovers over the tray icon.
  2. call shell_notifyicon which is defined in shell32.inc. this function has the following prototype:


                shell_notifyicon proto dwmessage:dword ,pnid:dword

        dwmessage  is the type of message to send to the shell.
               nim_add adds an icon to the status area.
              nim_delete deletes an icon from the status area.
              nim_modify modifies an icon in the status area.
        pnid  is the pointer to a notifyicondata structure filled with proper values

本文关键:iczelion asm
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top