pb托盘+菜单+热键呼出

若浮生 2009-04-04 11:04:25
谁给个完整的代码?200分
注意,是要托盘,和托盘上面显示的菜单,还有显示成托盘用热键可以呼出来的,最好是可以自定义热键的

邮箱tangfengsh@eyou.com
...全文
291 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ceqdong 2011-07-25
  • 打赏
  • 举报
回复
找好论坛了,看看这个有没有帮助吧.
txa 2009-08-20
  • 打赏
  • 举报
回复
寻找好论坛了,看看这个有没有帮助吧.
l_chlmh 2009-04-05
  • 打赏
  • 举报
回复
我也正需要,学习一下.
lao_bulls 2009-04-05
  • 打赏
  • 举报
回复
mark
LamarChen 2009-04-05
  • 打赏
  • 举报
回复
xue xi
WorldMobile 2009-04-04
  • 打赏
  • 举报
回复


http://mmm.onegreen.net/code/pccode_2006910134714507.rar

里面有源代码,pbhelp
-狙击手- 2009-04-04
  • 打赏
  • 举报
回复
api定义:
Public Function Integer Shell_NotifyIcon (Long dwMessage, Any lpData) Library "shell32" Alias For "Shell_NotifyIconA"

Public Function Long LoadImage (Long hInst, String lpsz, Long un1, Long n1, Long n2, Long un2) Library "user32" Alias For "LoadImageA"
Public Function Long DestroyIcon (Long hIcon) Library "user32" Alias For "DestroyIcon"

Public Function Long SetForegroundWindow (Long hwnd) Library "user32" Alias For "SetForegroundWindow"

Public Function Long OpenIcon (Long hwnd) Library "user32" Alias For "OpenIcon"

自定义函数 :
// Boolean AddToTray ()

Any nid

if hIcon = 0 then
// the icon has not been loaded yet
hIcon = LoadImage(0, "RED.ICO", IMAGE_ICON, 0, 0, LR_LOADFROMFILE)
end if

if hIcon = 0 then
// MessageBox ("Error", "Can't load icon!")
//
// Return False
else
nid = SetNotifyIconData (Handle (This), 0, NIF_MESSAGEorNIF_ICONorNIF_TIP, WM_MOUSEMOVE, hIcon, "南京**数据采集程序")
Shell_NotifyIcon (NIM_ADD, nid)
Return True
end if



// RemoveFromTray ()

Any nid

nid = SetNotifyIconData (Handle (This), 0, NIF_MESSAGEorNIF_ICONorNIF_TIP, 0, hIcon, "")
Shell_NotifyIcon (NIM_DELETE, nid)

if hIcon <> 0 then DestroyIcon (hIcon)
hIcon = 0


// NotifyIconData SetNotifyIconData (Long hWnd, Long ID, Long Flags, Long CallbackMessage, Long Icon, String Tip)

Char MyTip [64]

NotifyIconData NidTemp

NidTemp.cbSize = 88 // Len (NidTemp)
NidTemp.hWnd = hWnd
NidTemp.uID = ID
NidTemp.uFlags = Flags
NidTemp.uCallbackMessage = CallbackMessage
NidTemp.hIcon = Icon1
MyTip = Tip + Char (0)
NidTemp.szTip = MyTip

return NidTemp



事件 :

open:
if AddToTray () then Visible = False
MouseMove:

// Long MouseMove (UnsignedLong Flags, Int xPos, Int yPos)

if yPos <> 0 And Visible then
// This event has been triggered by really moving the
// mouse over the window. Note that we can't trace a
// first graphic line (yPos = 0) of mouse movements any
// more since tray events always set yPos to 0 but that
// won't be a problem in most of the cases anyway.
// TODO: place your own code here to handle then MouseMove event
// if you want.


else
// This is really a tray event. We can find out what
// triggered this event by examining xPos value.

choose case Mod (xPos, 256)
// case 84, 41 // Left MouseDown
// case 88, 46 // Left MouseUp

case 95, 55 // Right MouseDown
m_taskbar lm_Current
integer li_X, li_Y
lm_Current = CREATE m_Taskbar
li_X = This.X
li_Y = This.Y

This.X = - This.Width - 10
This.Y = - This.Height - 10

This.Visible=TRUE
lm_Current.m_main.Popmenu(PointerX(), PointerY())
This.Visible=FALSE

This.X = li_X
This.Y = li_Y


DESTROY lm_Current
// case 99, 59 // Right MouseUp
case 91, 50 // Left DoubleClick
OpenIcon (Handle (This))
Visible = True
SetForegroundWindow (Handle (This))
// case 102, 64 // Right DoubleClick
// case else // MouseMove
// Note that the only guarantee that the mouse
// is really moving over the tray icon is that
// the form is not being visible at this time.
// The mouse could also be moving over the
// first graphic line of a form (yPos = 0) otherwise.

// if Not Visible then
// end if
end choose
end if
【重要提示】本资源设置为0积分下载,若非0积分请勿轻易下载 亲爱的CSDN用户: 首先感谢你点进这个资源页面。我需要提前说明一个重要情况: 本资源原本已设置为“0积分下载”,即作者希望完全免费共享。但CSDN平台有时会根据文件的下载度、文件大小、用户权限等因素,自动将部分资源的积分调整为非0数值(如1积分、2积分、5积分等)。这是平台系统的自动行为,而非作者本人的设定。 因此,如果你当前看到该资源的下载所需积分不是0(例如显示为1、2、3……),请谨慎决定是否下载。 如果你按照非0积分支付并下载后发现资源内容不符合预期、链接失效,或者实际上该资源本应是免费的,作者无法为此承担积分损失或退还操作。强烈建议:仅在页面显示为0积分时进行下载。 另外,本资源描述中并未直接提供具体的下载地址或外部链接,因为它本身是一个通过CSDN官方上传通道提交的文件/内容包。如果你看到描述中没有外部网盘地址,这是正常的——资源文件应通过CSDN内置的“下载”按钮获取。若因平台积分显示异常导致你支付了积分,请优先联系CSDN客服咨询积分退还政策,作者没有权限修改平台自动设定的积分值。 感谢你的理解与支持。技术分享本应开放,但受限于平台规则,特此提醒如上。祝学习进步!

743

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧