Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21909

[RESOLVED] Simple clock (system tray popup)

$
0
0
Code:

Private Sub Form_Load()
      'the form must be fully visible before calling Shell_NotifyIcon
      Me.Show
      Me.Refresh
      With nid
        .cbSize = Len(nid)
        .hwnd = Me.hwnd
        .uId = vbNull
        .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
        .uCallBackMessage = WM_MOUSEMOVE
        .hIcon = Me.Icon
        .szTip = Label1.Caption & vbNullChar
      End With
      Shell_NotifyIcon NIM_ADD, nid
      End Sub

So I've got a code that when you minimise the application it appears as an icon in the system tray, and when you hover over it, it tells you the time.

As I've got my caption set to "00:00" that's what's displayed as a result of ".szTip = Label1.Caption & vbNullChar"

I was just wondering how to fix this problem, and how to get a popup to literally pop up in the corner as "the clock strikes"

Thanks

PS.

Code:

Private Sub Timer1_Timer()

Label1.Caption = Time

If Time >= "12:00" Then Label1.Caption = "Afternoon"

If Time <= "12:00" Then Label1.Caption = "Morning"

If Time >= "17:00" Then Label.Caption = "Evening"

If Time >= "20:00" Then Label.Caption = "Night"

End Sub

EDIT: (resolved)

Code:

Private Sub Form_Load()
 
 Label1.Caption = Time

If Time >= "12:00" Then Label1.Caption = "Afternoon"

If Time <= "12:00" Then Label1.Caption = "Morning"

If Time >= "17:00" Then Label.Caption = "Evening"

If Time >= "20:00" Then Label.Caption = "Night"
 
      'the form must be fully visible before calling Shell_NotifyIcon
      Me.Show
      Me.Refresh
      With nid
        .cbSize = Len(nid)
        .hwnd = Me.hwnd
        .uId = vbNull
        .uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
        .uCallBackMessage = WM_MOUSEMOVE
        .hIcon = Me.Icon
        .szTip = Label1.Caption & vbNullChar
      End With
      Shell_NotifyIcon NIM_ADD, nid
     
      mPopupRestore.Visible = False

mPopupExit.Visible = False

      End Sub


Viewing all articles
Browse latest Browse all 21909

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>