***************************************************************************** **** messenger code Local llRetVal As Boolean Local loExc As Exception llRetVal = .F. *DODEFAULT() *thisform.cboContacts.SetFocus() Try *------------------------------------------------------------------------------------------------------------------------ *-- See http://msdn.microsoft.com/downloads/default.asp?url=/downloads/topic.asp?url=/msdn-files/028/001/359/topic.xml *-- for information on Messenger APIs. *------------------------------------------------------------------------------------------------------------------------ *-- This form is not meant as an alternate UI to Messenger. It is meant to *-- demonstrate the Messenger APIs you have access to via COM. You can *-- use these methods to send automated Instant Messages, Email or Files *-- to any MSN user from your automated processes. Additionally, if that user *-- has set up mobile messaging ( http://mobile.msn.com ), the email *-- will be sent to their mobile device. *--------------------------------------------------------------------------- Thisform.oMessenger = Createobject("Messenger.UIAutomation.1") Declare Long SetForegroundWindow In WIN32API Long Declare Integer FindWindow In WIN32API String @ cClass, String @ cTitle Declare Long CloseWindow In WIN32API Long Declare Sleep In WIN32API Long *-- We will use the Windows Scripting host to send key strokes so we can *-- auto-compose messages and automate the messenger windows. Thisform.oWsh = Createobject("wscript.Shell") *-- Add registered messenger contacts to the dropdown. *-- However, you can send messages to any MSN user by *-- email address, they don't have to be in the contact list. * Thisform.GetContacts() llRetVal = .T. Catch To loExc llRetVal = .F. If Vartype(Thisform.oMessenger)!="O" Messagebox("There was a problem loading Windows Messenger. Make sure it is properly installed. This sample also requires that Windows Messenger 4.7 or higher be installed.", 48, Thisform.Caption) Else Messagebox(loExc.Message, 16, Thisform.Caption) Endif Endtry