We have an app which uses C3PO to trap Send events. In the app we check
for attachement size. If the size is greater than a predermined amount
we pop up a VB window warning the user.

There are two problems we cannot resolve:

- if the user has "autospell" truned on, we get the send event three
times (user click, the C3PO send, the spell checker send). If they have
autospell turned off we get the send event twice (user click, C3PO send).

- if the user has multiple signature blocks, they get the chance to
choose the signature AFTER the C3PO sends the message. At this point
they can cancel the send. If they then delete the attachment and click
on Send again, the C3PO still gets the same attachment count and sizes.
It seems that the token processing still has the attachments in its
cache. Code below....

** If I had a wish it would be to change the order of C3PO handling
within GW. Ideally it would be that the C3PO event is sent AFTER ALL
other GW processing is done. Autospell, signature block, etc. The Send
event should be the last thing done to an outgoing message.

Select Case m_sPersistentID
Set objCmd = CreateObject("GroupWiseCommander")

theCommand = "ItemAttachmentGetCount(" & msgId & ")"
errCode = objCmd.Execute(theCommand, tokenResult)

If errCode = "1" Then
attachCount = Int(tokenResult)
ReDim Attachments(0)
Attachments(0).Size = 0

For Count = 0 To attachCount - 1
theCommand = "ItemAttachmentGetClass(" & msgId & ";" & Count & ")"
errCode = objCmd.Execute(theCommand, tokenResult)

If tokenResult = "1" Then ' this is a file!
theCommand = "ItemAttachmentGetName(" & msgId & ";" & Count & ")"
errCode = objCmd.Execute(theCommand, tokenResult)

If errCode = "1" Then
Idx = UBound(Attachments) + 1
ReDim Preserve Attachments(Idx)

Attachments(Idx).Name = tokenResult
Attachments(Idx).Size = FileLen(tokenResult)
Attachments(0).Size = 0 + Attachments(Idx).Size + _
End If
End If

If Attachments(0).Size > MAX_ATT_SIZE Then
Set frmWarning = New frmAttSizeWarn

frmWarning.SetSize MAX_ATT_SIZE
frmWarning.Show vbModal

SendMsg = frmWarning.IsSend
SendMsg = True
End If

If SendMsg Then
isSending = True

theCommand = "ItemSend(0)" ' 0 defeats spellcheck
errCode = objCmd.Execute(theCommand, tokenResult)

isSending = False
theCommand = "FocusSet(9)"
errCode = objCmd.Execute(theCommand, tokenResult)
End If
MsgBox "Cannot get attachment count:" & Chr(13) & tokenResult
End If