[VB6 ] 關於程式執行後縮小到右下角

看板Visual_Basic作者 (尼爾教皇)時間4年前 (2020/03/05 20:25), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
徵求以前的VB6高手幫我看一下 以下是以前的人寫的,想動刀 1.為表單加上一個 Icon。 2.表單上放一個主功能表,把「顯示」屬性關掉。 3.在主功能表之下新增四個功能項目。(f01、f02、f03、exit) 4.把下面程式碼複製到表單。複製內容到剪貼板代碼: '初始化-SystemIcon Private Sub Form_Load() If App.PrevInstance Then Unload Me App.TaskVisible = False InitSystemIcon Me.hWnd, Me.icon End Sub '以左鍵開啟功能表 Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim msg As Long msg = X / Screen.TwipsPerPixelX If msg = WM_LBUTTONUP Then PopupMenu myMenu, 0 End Sub Private Sub f01_Click() MsgBox "你按下了 " & f01.Caption & " 功能。" End Sub Private Sub f02_Click() MsgBox "你按下了 " & f02.Caption & " 功能。" End Sub Private Sub f03_Click() MsgBox "你按下了 " & f03.Caption & " 功能。" End Sub Private Sub f_exit_Click() End End Sub '下面的code是放在模組 Public Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIcon A" (ByVal dwMessage As NotifyIconMsg, pnid As NotifyIconData) As Boolean Public Const WM_LBUTTONDOWN = &H201 Public Const WM_LBUTTONUP = &H202 Public Const WM_LBUTTONDBLCLK = &H203 Public Const WM_RBUTTONDOWN = &H204 Public Const WM_RBUTTONUP = &H205 Public Const WM_RBUTTONDBLCLK = &H206 Public Const WM_MOUSEMOVE = &H200 Public Enum NotifyIconMsg NIM_ADD = &H0 NIM_MODIFY = &H1 NIM_DELETE = &H2 NIF_MESSAGE = &H1 NIF_ICON = &H2 NIF_TIP = &H4 End Enum Public Type NotifyIconData cbSize As Long hWnd As Long uID As Long uFlags As Long uCallbackMessage As Long hIcon As Long szTip As String * 64 End Type Public SystemIcon As NotifyIconData 'SystemICON 初始化處理 Sub InitSystemIcon(hWnd As Long, icon As Object) With SystemIcon .cbSize = Len(SystemIcon) .hWnd = hWnd .hIcon = icon .uID = vbNull .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE .uCallbackMessage = WM_MOUSEMOVE .szTip = "我的測試程式 by ku3" & Chr(0) End With Shell_NotifyIcon NIM_ADD, SystemIcon End Sub '更新 SystemICON 處理 Sub UpdateSystemIcon(hWnd As Long, icon As Object) SystemIcon.szTip = _ SystemIcon.hIcon = icon Shell_NotifyIcon NIM_MODIFY, SystemIcon End Sub 問題1.這個code執行後 右下角的icon圖示 只能滑鼠左鍵PopupMenu 我想改成滑鼠右鍵然後就PopupMenu 問題2.當程式關閉後 右下角的icon圖示不會消失 只有滑鼠移過去它才會消失... 要如何在程式關閉後 右下角的icon圖示也跟著消失 補充:希望各位高手幫幫忙... 這裡難處是對windows來說 右下角的icon只是一個小圖示 所以我狂try也都失敗 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.82.195.185 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1583411148.A.8A7.html
文章代碼(AID): #1UOE_CYd (Visual_Basic)
文章代碼(AID): #1UOE_CYd (Visual_Basic)