quote:
Originally posted by Hen
Hi,
When I opened the windows visual basic => Tools => reference, I added the Messenger API.
Browsing the "object browser" and then looking under IMessenger2 there is this function:
Messenger.StartVideo (vContact)
Why doesn't it work? :
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
var Contacts = ChatWnd.Contacts; // Deafult will be current chat window, or do I need to specify this?
var e = new Enumerator(Contacts);
var Contact = e.item(); // Assume a chat window with only one contact, no need to iterate
Debug.Trace(Contact.Email)
if (Message.match("Camera")!=null){
Messenger.StartVideo(Contact)
}
}
Do I need to use "Interop::Call " ? - if so, how?
Also the "Debug.trace" doesnt show the contact email in the debug window.
Cheers,
Hen.
To add to what has been explained already:
If you would program in VB, then yes that is what you need todo; referencing that object. However you are now programming in JScript in Messenger Plus! which is another language and thus works differently. To get the object from Messenger in order to use it functions in JScript in Plus! you need to do what Spunky said in his first reply: first make and call the ActiveXObject.
But, there is a much easier way to do what you want, also shown by Spunky: use the SendMessage API again...
You can do this because the functions to start a webcam exist in Windows Live Messenger as a menu option. You can use the specific command for that menu item (which essentially is a sent number) to "simulate" a mouse click on that specific menu item and thus start the webcam.
This
command number is also often known as the
cmdid (command ID) and is of course program specific and even window specific (hence you also need to specify the window handle to where that cmdid needs to be send).
So, that parameter you ask for, that
magic number can be found out by looking at the menu resources from the Windows Live Messenger program. This can be done with a program like ResHacker, as explained by Matty.
If you read the help on MSDN you see that the second parameter for the SendMessage API needs to be the
"Message" (this name has got nothing todo with Instant Messaging!). This
Message in this case is WM_COMMAND which has the numerical value 0x0111. As the third parameter you provide the cmdid of the menu item you whish to invoke.
I suggest to read the next page for detailed info:
http://www.msgpluslive.net/skins/resources/tut-How-to-find-CmdIds/
PS: don't try to use just any number. You're dealing with internal window stuff here and you can really screw things up if you don't provide the correct values.