
sending cc:mail through VB app.
Quote:
> > I have searched the LOTUS site and Microsoft site for help but have
> > found very little about interfacing with cc:mail. Can anyone suggest
> > other sites, books, or personal experience?
Due to the number of requests, here's the code. Copy and save to the
file names shown.
Here the 3 files just copy and paste into the file name shown. You'll
need to enter the info in mailbutton_click that sets your path and other
info. Email back if questions.
Mailer.mak
MAILFRM.FRM
GLOBALS.BAS
ProjWinSize=184,628,248,191
ProjWinShow=2
IconForm="Mailfrm"
Title="MAILER"
ExeName="MAILER.EXE"
Globals.bas
Option Explicit
DefInt A-Z
Global Const Automatic = 1
Global Const Manual = 2
Global Const None = 0
'Constants for top most
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Global Const HWND_TOPMOST
= -1
Global Const GW_CHILD = 5
Global Const GW_HWNDFIRST = 0
Global Const GW_HWNDLAST = 1
Global Const GW_HWNDNEXT = 2
Global Const GW_HWNDPREV = 3
Global Const GW_OWNER = 4
Declare Function GetWindow Lib "user" (ByVal hWnd, ByVal wCmd) As
Integer Declare Function GetWindowText Lib "user" (ByVal hWnd, ByVal
lpSting As String, ByVal nMaxCount) As Integer
Declare Function GetWindowTextLength Lib "user" (ByVal hWnd) As Integer
Declare Function GetPrivateProfileInt Lib "Kernel" (ByVal LpAppName As
String, ByVal LpKeyName As String, ByVal nDefault As Integer, ByVal
lpFilename As String) As Integer
Declare Function GetPrivateProfileString Lib "Kernel" (ByVal LpAppName
As String, ByVal LpKeyName As String, ByVal LpDefault As String, ByVal
lpReturnedString As String, ByVal nSize As Integer, ByVal lpFilename As
String) As Integer
Declare Function WritePrivateProfileString Lib "Kernel" (ByVal
lpApplicationName As String, ByVal LpKeyName As Any, ByVal lpString As
Any, ByVal lplFileName As String) As Integer
Mailfrm.frm
VERSION 2.00
Begin Form Mailfrm
BorderStyle = 1 'Fixed Single Caption = "CC Mailer"
ClientHeight = 585
ClientLeft = 2505
ClientTop = 4065
ClientWidth = 1560
ControlBox = 0 'False
Height = 990
Left = 2445
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 585
ScaleWidth = 1560
Top = 3720
Width = 1680
Begin ComboBox Combo_ListItem
Height = 300
Left = 90
TabIndex = 2
Top = 540
Visible = 0 'False
Width = 2535
End
Begin TextBox Text1
Height = 375
Left = 1485
TabIndex = 1
Top = 90
Visible = 0 'False
Width = 1365
End
Begin CommandButton MailButton
Caption = "Send Mail"
Height = 465
Left = 45
TabIndex = 0
Top = 45
Width = 1365
End
End
Option Explicit
Sub LoadTaskList ()
Dim CurrWnd As Variant, Length As Variant, ListItem As String
Combo_ListItem.Clear
'Get the hWnd of the first item in the master list
'so we can process the task list entries (top-level only). CurrWnd =
GetWindow(Mailfrm.hWnd, GW_HWNDFIRST)
' Loop while the hWnd returned by GetWindow is valid. While CurrWnd <> 0
'Get the length of the task name identified by 'CurrWnd in the list.
Length = GetWindowTextLength(CurrWnd)
'Get the task name of the task in the master list. ListItem =
Space$(Length + 1)
Length = GetWindowText(CurrWnd, ListItem, Length + 1) 'If there is an
actual task name in the list, add the 'item to the list.
If Length > 0 Then
Combo_ListItem.AddItem ListItem
End If
'Get the next task list item in the master list. CurrWnd =
GetWindow(CurrWnd, GW_HWNDNEXT) 'Process Windows events.
DoEvents
Wend
End Sub
Sub MailButton_Click ()
Dim MailNote As String, WProblem As String
Dim i As Integer, Run As Variant
Dim AppPresent As Integer
Dim ProgramTitle As String
ProgramTitle = "Lotus cc:Mail"
Call LoadTaskList
Do While AppPresent = False
DoEvents
'Check to see if any items are in the task list, if 'not end the
program.
For i = 0 To Combo_ListItem.ListCount - 1
If Left$(Combo_ListItem.List(i), 13) = ProgramTitle Then
AppPresent = True
Exit For
End If
If i = Combo_ListItem.ListCount - 1 And AppPresent = False Then
Run = Shell("Path to CC:Mail goes here" & "Post Office Path goes
here " & " " & """Your CC:Mail Name goes here""" & " " & "Your CC:Mail
Password goes here", 7)
Exit Do
End If
Next
DoEvents
Loop
DoEvents
'Set up the link topics
Text1.LinkMode = 0
Text1.LinkTopic = "CC:Mail Path goes here" & "|SendMail" Text1.LinkMode
= 2
Text1.LinkTimeout = 60
Text1.LinkItem = "SendMail"
Text1.LinkExecute "NewMessage"
Text1.LinkExecute "To " & "Your CC:Mail Name Goes Here" MailNote = "This
is a test send to myself." Text1.LinkExecute "Text " & MailNote
WProblem = "Test Send"
Text1.LinkExecute "Subject " & WProblem Text1.LinkExecute "Send"
DoEvents
SendKeys "Y"
DoEvents
Unload Me
End Sub