29. maj 2004 - 10:19
Der er
3 kommentarer
E-mail via Groupware
Jeg skal fra en et VB6 program automatisk sende en mail.
Jeg har lavet et lille program, der fungerer fint med Outlook express; men hvad gør jeg, når outlook ikke må startes; men mailen skal afsendes via Groupware. I Groupware skal mailen i øvrigt helst også findes i "sent mail".
Er der en der har et godt forslag?
/Finn
hvis (mailen i øvrigt helst også findes i "sent mail") så bliver du nok nød til at bruge Outlook..
Men du kan jo tjekke om outlook er startet..
'-------------------------------- Form1 --------------------------------
Option Explicit
Private Const GW_CHILD As Long = 5
Private Const GW_HWNDFIRST As Long = 0
Private Const GW_HWNDNEXT As Long = 2
Private Const MAX_PATH As Long = 255
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long
Private Declare Function GetWindow Lib "user32" ( _
ByVal hwnd As Long, _
ByVal wCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Function GetTitle(ByVal lhWnd As Long) As String
Dim strSpace As String * MAX_PATH
GetTitle = Left$(strSpace, GetWindowText(lhWnd, strSpace, MAX_PATH))
End Function
Public Function IsApp(ByVal strName As String) As Boolean
Dim hWndNext As Long
hWndNext = GetWindow(GetDesktopWindow(), GW_CHILD)
Do While hWndNext
If InStr(1, LCase$(GetTitle(hWndNext)), LCase$(strName)) Then
IsApp = True
Exit Do
End If
hWndNext = GetWindow(hWndNext, GW_HWNDNEXT)
Loop
End Function
Private Sub Form_Load()
If Not IsApp("Outlook Express") Then
Call ShellExecute(Me.hwnd, vbNullString, "msimn.exe", _
vbNullString, vbNullString, vbNormalFocus)
End If
End Sub
'-------------------------------- Form1 --------------------------------