AOL Upper
Application creates a systray icon which has a pop-up menu allowing you to minimize and restore the AOL3.0/4.0 Upload window. Good demo code for systray icon with popup menus no matter what you want to use it for. Also includes my Time Delay code.
AI
Tóm tắt bởi AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Mã nguồn
'First create a form with a menu item listing 3 sub menus. mnuExit, mnuMinUpload and mnuResUpload.
Option Explicit
Dim Tic As NOTIFYICONDATA
Private Sub Form_Activate()
Dim TimeDelay&
Label2.Caption = "v" & App.Major & "." & App.Minor & "." & App.Revision & " " & Label2.Caption
TimeDelay = Timer + 3
While Timer <= TimeDelay
DoEvents
Wend
Me.Hide
mnuSystemTray.Visible = True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Event occurs when the mouse pointer is within the rectangular
'boundaries of the icon in the taskbar status area.
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDBLCLK
mnuMinUpload_Click
Case WM_RBUTTONUP
PopupMenu mnuSystemTray, , , , mnuMinUpload
End Select
End Sub
Private Sub Form_Unload(Cancel As Integer)
Shell_NotifyIcon NIM_DELETE, Tic
End Sub
Private Sub Form_Load()
If App.PrevInstance Then End
Dim rc As Long
Tic.cbSize = Len(Tic)
Tic.hwnd = Me.hwnd
Tic.uID = vbNull
Tic.uFlags = NIF_DOALL
Tic.uCallbackMessage = WM_MOUSEMOVE
Tic.hIcon = Me.Icon
Tic.sTip = "AOL Upload Minimizer" & vbNullChar
rc = Shell_NotifyIcon(NIM_ADD, Tic)
End Sub
Private Sub mnuExit_Click()
End
End Sub
Private Sub mnuResUpload_Click()
Dim AOL As Long
Dim AOModal As Long
Dim AOGauge As Long
AOL = FindWindow("AOL Frame25", vbNullString)
AOModal = FindWindow("_AOL_Modal", vbNullString)
AOGauge = FindChildByClass(AOModal, "_AOL_Gauge")
If AOGauge <> 0 Then
EnableWindow AOL, 1
ShowWindow AOModal, SW_RESTORE
End If
End Sub
Private Sub mnuMinUpload_Click()
Dim AOL As Long
Dim AOModal As Long
Dim AOGauge As Long
AOL = FindWindow("AOL Frame25", vbNullString)
AOModal = FindWindow("_AOL_Modal", vbNullString)
AOGauge = FindChildByClass(AOModal, "_AOL_Gauge")
If AOGauge <> 0 Then
EnableWindow AOL, 1
ShowWindow AOModal, SW_MINIMIZE
End If
End Sub
Private Function FindChildByClass(Parent&, Child$) As Integer
Dim ChildFocus%, Buffer$, ClassBuffer%
ChildFocus% = GetWindow(Parent, 5)
While ChildFocus%
Buffer$ = String$(250, 0)
ClassBuffer% = GetClassName(ChildFocus%, Buffer$, 250)
If InStr(UCase(Buffer$), UCase(Child)) Then
FindChildByClass = ChildFocus%
Exit Function
End If
ChildFocus% = GetWindow(ChildFocus%, 2)
Wend
End Function
Bình luận gốc (3)
Được khôi phục từ Wayback Machine