Away Message - Help or Suggestions Please |
Author: |
Message: |
XM4ST3RX
Full Member
DJ Scoop!
Posts: 172 Reputation: 12
38 / / –
Joined: May 2003
|
O.P. Away Message - Help or Suggestions Please
Hi,
I'm currently developing a plug-in and its almost complete, yet im at the part which hurts most , the plus! part... i have least knowledge in plus api etc at the moment.
My plugin allows users to add process files and an away message for each of them.
Example:
Process: hl.exe
AwayMsg: Sorry i may not reply, im currently playing Counter-Strike!!
Im currently having problems being able to send the "/away [AwayMsg]" command... any ideas?
Kind Regards,
XM4ST3RX
|
|
06-09-2005 11:05 AM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: Away Message - Help or Suggestions Please
This idea may work. If you need actual codes, just post
This involves using Messenger API. Consult Messenger API help for related functions and how to add reference to Messenger API in C++ or Visual Basic. (Messenger API is included in Patchou's plug-in development zipfile)
This following applies for C++.
- Retrieve IMessenger3 interface from iMessengerObj in Plus!'s plug-in Initialize() function.
- When the event is fired, use IMessenger3's InstantMessage method and open a conversation window to a random contact (note: if the contact is not on your allow list, this will fail.).
- Use the ppMWindow in InstantMessage: Get ppMWindow's hWnd (ppMWindow's a IDispatch which you can use to retrieve IMessengerWindow, and then use get_HWND method), and use SetForegroundWindow to make it the foreground window.
- Now, use SendInput or keybd_event or even SendMessage to emulate keyboard input of "/away [message]". Don't forget to send Enter input.
- Close ppMWindow using its Close method.
And this is for VB.
- Get a MessengerAPI.Messenger from oMessenger in Plus!'s plug-in Initialize() function.
- When the event is fired, use MessengerAPI.Messenger's InstantMessage method and open a conversation window to a random contact (note: if the contact is not on your allow list, this will fail.).
- Use the the return value (a MessengerAPI.MessengerWindow) of InstantMessage: Get its HWnd property, and use SetForegroundWindow API to make it the foreground window.
- Now, use SendKeys or even SendMessage API to emulate keyboard input of "/away [message]". Don't forget to send Enter input.
- Close the conversation window using its Close method.
A little bit complicated, but that's what I can think of for now. Just give it a try if you want
This post was edited on 06-09-2005 at 11:32 AM by Mnjul.
|
|
06-09-2005 11:20 AM |
|
|
XM4ST3RX
Full Member
DJ Scoop!
Posts: 172 Reputation: 12
38 / / –
Joined: May 2003
|
O.P. RE: Away Message - Help or Suggestions Please
Hi,
im using Visual Basic, and yeah if you could post code to help me out that would be great
Kind Regards,
XM4ST3RX
|
|
06-09-2005 11:21 AM |
|
|
Millenium_edition
Veteran Member
Posts: 1787 Reputation: 57
Joined: Apr 2003
|
RE: Away Message - Help or Suggestions Please
you could use tags, like (!XPROCESS), (!XWINDOW), but i'm not sure wether plus parses the tags when the away-message is set or when it is sent.
|
|
06-09-2005 11:22 AM |
|
|
XM4ST3RX
Full Member
DJ Scoop!
Posts: 172 Reputation: 12
38 / / –
Joined: May 2003
|
O.P. RE: Away Message - Help or Suggestions Please
Hi,
quote: Originally posted by Millenium_edition
you could use tags, like (!XPROCESS), (!XWINDOW), but i'm not sure wether plus parses the tags when the away-message is set or when it is sent.
I need to be able to just send this info direct, i.e. from a command button on a form etc
Kind Regards,
XM4ST3RX
|
|
06-09-2005 11:25 AM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: Away Message - Help or Suggestions Please
XM4ST3RX, I've updated my post.
My idea is very rough and just post if you need more help
|
|
06-09-2005 11:33 AM |
|
|
XM4ST3RX
Full Member
DJ Scoop!
Posts: 172 Reputation: 12
38 / / –
Joined: May 2003
|
O.P. RE: Away Message - Help or Suggestions Please
Hi,
im very new with the plugin side of things... could you collaborate more on the step 1 please, "Get a MessengerAPI.Messenger from oMessenger in Plus!'s plug-in Initialize() function." , Thanks .
Kind Regards,
XM4ST3RX
|
|
06-09-2005 11:35 AM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: Away Message - Help or Suggestions Please
First of all, you need to do this:
quote: Originally from MessengerAPI Helpfile
To add the Messenger type libraries to a Visual Basic project:
In Visual Basic, create a new project or open an existing one. (This is required to display all menus.)
On the Project menu, click References.
In the References dialog box, check Messenger API Type Library in the list, and then click OK.
After this is done, you can declare a global variable like
code: Public MessengerInstance As MessengerAPI.Messenger
Then, in Plus! plug-in Initiailize function, use:
code: Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
Set MessengerInstance = oMessenger 'This retrieves the Messenger object from Plus!
'If any, add your custom Initiailize() codes
Initiailize = True
End Function
If you want, you can add Set MessengerInstance = Nothing before setting it to oMessenger. But this is not obligatory.
That's what I mean in step 1
This post was edited on 06-09-2005 at 11:54 AM by Mnjul.
|
|
06-09-2005 11:48 AM |
|
|
XM4ST3RX
Full Member
DJ Scoop!
Posts: 172 Reputation: 12
38 / / –
Joined: May 2003
|
O.P. RE: Away Message - Help or Suggestions Please
Hi,
I love you! LoL, everything is going swell so far... just need to know how i can randomly choose a contact when using the InstantMessage method
Kind Regards,
XM4ST3RX
|
|
06-09-2005 11:56 AM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: Away Message - Help or Suggestions Please
(Please be sure you have MessengerAPI help or you may not be going to understand what I'm talking about )
Well, since you've got the Messenger object, you can use its MyContacts property, which is a MessengerContacts object and is a collection of contacts in the user's contact list. It has a method called Item(Index) which returns a MessengerContact. This object can be used in Messenger object's InstantMessage method.
So it may go like...
code: Dim Counter As Long
Dim Contacts As MessengerAPI.IMessengerContacts
Dim Contact As MessengerAPI.IMessengerContact
Set Contacts = MessengerInstance.MyContacts
For Counter = 1 To Contacts.Count '
Set Contact = Contacts.Item(Counter)
If Contact.Blocked = False Then
'From here use MessengerInstance's InstantMessage method in step 2, and go on
Exit For 'We can exit the loop because a "valid" contact has been found
End If
Next 'It's up to you if you prefer "Next Counter" :p
Note I forgot Item method's "Index" is 0-based or 1-based...Please try on your own. If it's 0-based, the For statmenet should change to For Counter = 0 To Contacts.Count - 1
You may want to do some check (to see if any window has been created in the loop) after the For loop.
This post was edited on 06-09-2005 at 04:45 PM by Mnjul.
|
|
06-09-2005 12:13 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|