全文預(yù)覽已結(jié)束
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
本源代碼是一款完整的VB托盤氣泡提示模塊的源代碼,氣泡提示在Winodws編程應(yīng)用中非常普遍,可使你的程序增加人性化體驗(yàn),同時(shí)美化你的程序窗體,這個(gè)氣泡提示控件,用起來很方便,希望廣大VB程序員喜歡。模塊Option ExplicitPublic Declare Function Shell_NotifyIcon Lib shell32.dll Alias Shell_NotifyIconA (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As LongPublic Type NOTIFYICONDATA cbSize As Long hWnd As Long uID As Long uFlags As Long uCallbackMessage As Long hIcon As Long szTip As String * 128 dwState As Long dwStateMask As Long szInfo As String * 256 uTimeout As Long szInfoTitle As String * 64 dwInfoFlags As LongEnd TypePublic Const NOTIFYICON_VERSION = 3Public Const NOTIFYICON_OLDVERSION = 0Public Const NIM_ADD = &H0Public Const NIM_MODIFY = &H1Public Const NIM_DELETE = &H2Public Const NIM_SETFOCUS = &H3Public Const NIM_SETVERSION = &H4Public Const NIF_MESSAGE = &H1Public Const NIF_ICON = &H2Public Const NIF_TIP = &H4Public Const NIF_STATE = &H8Public Const NIF_INFO = &H10Public Const NIS_HIDDEN = &H1Public Const NIS_SHAREDICON = &H2Public Const NIIF_NONE = &H0Public Const NIIF_WARNING = &H2Public Const NIIF_ERROR = &H3Public Const NIIF_INFO = &H1Public Const NIIF_GUID = &H4Public myData As NOTIFYICONDATAPublic Declare Function SetWindowLong Lib user32 Alias SetWindowLongA _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPublic Declare Function CallWindowProc Lib user32 Alias CallWindowProcA _ (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongPublic Declare Function GetWindowLong Lib user32 Alias GetWindowLongA (ByVal hWnd As Long, ByVal nIndex As Long) As LongPublic Const TRAY_CALLBACK = (&H400 + 1001&)Public Const GWL_WNDPROC = -4Public Const WM_MOUSEMOVE = &H200Public Const WM_LBUTTONDOWN = &H201Public Const WM_LBUTTONUP = &H202Public Const WM_LBUTTONDBLCLK = &H203Public Const WM_RBUTTONDOWN = &H204Public Const WM_RBUTTONUP = &H205Public Const WM_RBUTTONDBLCLK = &H206Public Enum WIN_STATUS STA_MIN STA_NORMALEnd EnumPublic glWinRet As LongPublic OrgWinRet As LongPublic Status As WIN_STATUSPublic MyForm As FormPublic Function CallbackMsgs(ByVal wHwnd As Long, ByVal wMsg As Long, ByVal wp_id As Long, ByVal lp_id As Long) As LongOn Error Resume Next If wMsg = TRAY_CALLBACK Then With MyForm Select Case CLng(lp_id) Case WM_RBUTTONUP .PopupMenu .mnuTray, , , , .mnuShow Case WM_LBUTTONUP If .WindowState = vbMinimized Then .Visible = True .WindowState = vbNormal Else .WindowState = vbMinimized .Visible = False End If End Select End With End If CallbackMsgs = CallWindowProc(glWinRet, wHwnd, wMsg, wp_id, lp_id)End FunctionPublic Function ShowTip(ByVal TipTitle As String, ByVal TipContent As String, TipIco As Integer)With myData .szInfoTitle = TipTitle & vbNullChar .szInfo = TipContent & vbNullChar .dwInfoFlags = TipIco End WithShell_NotifyIcon NIM_MODIFY, myDataEnd FunctionPublic Function CreatTray(ByRef TheForm As Form, TipMove As String, TipTitle As String, TipContent As String, TipIco As Long)Set MyForm = TheFormOrgWinRet = GetWindowLong(MyForm.hWnd, GWL_WNDPROC)With myData .cbSize = Len(myData) .hWnd = MyForm.hWnd .uID = vbNull .uFlags = NIF_ICON Or NIF_TIP Or NIF_INFO Or NIF_MESSAGE .uCallbackMessage = TRAY_CALLBACK .hIcon = MyForm.Icon .szTip = TipMove & vbNullChar .dwState = 0 .dwStateMask = 0 .szInfoTitle = TipTitle & vbNullChar .szInfo = TipContent & vbNullChar .dwInfoFlags = TipIco .uTimeout = 10000End WithShell_NotifyIcon NIM_ADD, myDataglWinRet = SetWindowLong(MyForm.hWnd, GWL_WNDPROC, AddressOf CallbackMsgs)End FunctionPublic Function UnloadTray()Shell_NotifyIcon NIM_DELETE, myDataCall SetWindowLong(MyForm.hWnd, GWL_WNDPROC, OrgWinRet)End Function引用Option ExplicitPrivate Sub Form_Resize()With Me If Status = STA_NORMAL And .WindowState = vbMinimized And .Visible = True Then .Visible = False Status = STA_MIN Else Status = STA_NORMAL End IfEnd WithEnd SubPrivate Sub Form_Unload(Cancel As Integer)Call UnloadTrayEnd Su
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 生態(tài)園戶外網(wǎng)球場施工合同
- 手術(shù)室護(hù)理工作守則
- 物業(yè)管理智能化施工合同
- 醫(yī)院投訴處理與信息系統(tǒng)
- 旅游住宿合同管理流程
- 項(xiàng)目部進(jìn)度跟蹤系統(tǒng)
- 游戲開發(fā)公司聘用合同范本
- 機(jī)場新建工程塔機(jī)租賃協(xié)議
- 校園網(wǎng)絡(luò)布線工程合同范本
- 化妝品銷售兼職協(xié)議
- 【8地RJ期末】安徽省蕪湖市無為市2023-2024學(xué)年八年級上學(xué)期期末地理試題(含解析)
- 五級(程控交換)職業(yè)技能鑒定理論考試題及答案
- 分布式光伏場站管理制度-運(yùn)行管理
- 2020年國家開放大學(xué)電大《數(shù)據(jù)結(jié)構(gòu)》實(shí)驗(yàn)報(bào)告
- 數(shù)據(jù)分析師歷年考試真題試題庫(含答案)
- 2024年全國教育大會精神全文課件
- DL-T5153-2014火力發(fā)電廠廠用電設(shè)計(jì)技術(shù)規(guī)程
- 天藍(lán)色商務(wù)發(fā)展歷程時(shí)間軸PPT模板課件
- 火災(zāi)報(bào)警系統(tǒng)技術(shù)規(guī)范書
- BAC 巴爾的摩CXV型蒸發(fā)式冷凝器
- 山東理工大學(xué)化學(xué)真題試卷
評論
0/150
提交評論