Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Want to have a phone conversation?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00958978
Message ID:
00959349
Views:
9
>>>>Just tell me how I can reach you (currently just in the weekends). I also installed MSN Messenger (no video yet).
>>
>>We have incorporated MS Messenger into some of our apps so our officers
can communicate with each other and other police agencies from the field.
It works great. There's even some sample code in the solutions app of VFP
8 on how to control MS Messenger from VFP. I used the code and modified to
fit my needs.

>
>Hey John
>
>Cool stuff.. I am not VFP8 user yet.. I am running on 6.. And, I am planning to go directly to release 9..
>
>Would you mind (if possible) to e-mail me this sample.. Just to take a look on how this one will be possible (to me) in a near future..
>
>Thanks

Well, it's in several locations on the sample form. You'd have to pull the
stuff and put it into your own. I send preformatted messages to HQ so the
officers don't have to type anything. This code is right out of the
sample. Here's the code to instantiate the object. It also uses windows
scripting host:
*****************************************************************************
**** 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
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform