home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1996 August / pcpro0796.iso / Code / WinInt < prev   
Encoding:
Text File  |  1996-06-07  |  1.1 KB  |  48 lines

  1.  
  2. Windows Integration
  3. Code 1
  4. Global objSession As Object
  5. Global objMessages As Object
  6. Global objMessage As Object
  7. Global AppVersion$
  8. Code 2
  9. Private Sub ExchangeStart_Click()
  10. Set objSession = CreateObject("MAPI.Session")
  11. objSession.Logon
  12. Screen.ActiveForm.WindowState = 1
  13. Call CountMessages
  14. Timer1.Enabled = True
  15. ExchangeStop.Enabled = True
  16. ExchangeStart.Enabled = False
  17. End Sub
  18. Code 3
  19. Sub CountMessages()
  20.  Dim cUnread As Integer         
  21.  Dim cMessageCount as Integer
  22. Set objMessages = objSession.Inbox.Messages
  23. On Error GoTo error_olemsg
  24. If objMessages Is Nothing Then
  25.     MsgBox "must select a messages collection"
  26.     Exit Sub
  27. End If
  28. Set objMessage = objMessages.GetFirst
  29. cUnread = 0
  30. MessageCount = 0
  31. While Not objMessage Is Nothing 
  32.     If True = objMessage.Unread Then
  33.         cUnread = cUnread + 1
  34.     End If
  35.     cMessageCount = cMessageCount + 1
  36.     Set objMessage = objMessages.GetNext
  37. Wend
  38. Form1.Caption = cUnread & " / " & cMessageCount & " unread 
  39. (Inbox)"
  40. Set objMessages = Nothing
  41. Exit Sub
  42. error_olemsg:
  43.     MsgBox "Error " & Str(Err) & ": " & Error$(Err)
  44.     Resume Next
  45. End Sub
  46.  
  47.  
  48.