What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Script for webcam?

Pages: (2): « First « 1 [ 2 ] Last »
Script for webcam?
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Script for webcam?
It doesn't work because you need to create the ActiveXObject in JScript rather than setting a reference in VB. Also, the messenger API you are refering to is actually Windows Messenger that ships with Windows XP, not Windows Live Messenger, so it will probably try to start the wrong programs webcam anyway.

Use the SendMessage API as I stated above.

EDIT:

js code:
Interop.Call('user32', 'SendMessageW', ChatWnd.Handle, 0x0111, 40279, 0);
// This code is untested.  Replace 40279 with 40049 for Video Call

Source:
quote:
Originally posted by djdannyp

MENUITEM "Start a Video &Call", 40049, MFT_STRING, MFS_ENABLED
MENUITEM "&Show your webcam", 40279, MFT_STRING, MFS_ENABLED

40049 is for video call
40279 is for webcam

This post was edited on 05-01-2009 at 10:54 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
05-01-2009 10:50 AM
Profile PM Find Quote Report
Hen
Junior Member
**


Posts: 37
Joined: Aug 2007
O.P. RE: Script for webcam?
Hi,
Ok cool, that works.
Now you have to teach me you how you found it....
I searched the forum after you published it and found some similiar posts, however in none I found any explanations as for the parameters and the reference for it.
I opened the msdn:
http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx
and found only SendMessage. Is there a difference with SendMessageW ?
In the MSDN I didnt find the reference to the numbers you wrote.
Could you explain a bit about it?
What is the logic of this function? - it sends a hanle (?) to where? and then what exactly do these numbers represent.

ahh.. and do you know why the Debug.trace didnt work for me?

Sorry for my ignorance.
Cheers,
Hen.

This post was edited on 05-01-2009 at 02:49 PM by Hen.
05-01-2009 02:47 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Script for webcam?
1) Download ResHack.
2) Open the msglang.dll (I think it is) in C:\Program Files\Windows Live\Messenger
3) View the menus and find the code.

05-01-2009 02:52 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Script for webcam?
0x0111 means send a command to the window specified by ChatWnd.Handle.

SendMessageW is because JScript is unicode (SendMessageA would be for ANSI)

It's Debug.Trace(); not Debug.trace();

As matty said, the codes to webcams and other menu functions can be found by using ResHack
<Eljay> "Problems encountered: shit blew up" :zippy:
05-01-2009 05:50 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Script for webcam?
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.

This post was edited on 05-04-2009 at 04:00 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-04-2009 03:51 AM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On