Shoutbox

VB help - Identifing Which Contact Is In The Window - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: VB help - Identifing Which Contact Is In The Window (/showthread.php?tid=43020)

VB help - Identifing Which Contact Is In The Window by Stigmata on 04-17-2005 at 12:05 PM

well the idea is, set the open window's contact email + friendly name to clipboard

at the moment ive only made it to work with im windows with view by email
here is what i currently have:

code:
Public Sub getcontactinfo(id As String)
Dim imHwnd As Long
Dim lLength  As Long
Dim strCaption As String
Dim MsgrContact  As IMessengerContact
Dim Memail As String
imHwnd = FindWindow("IMWindowClass", vbNullString)
lLength = GetWindowTextLength(imHwnd)
strCaption = String$(lLength, vbNullChar)
GetWindowText imHwnd, strCaption, lLength + 1
If strCaption Like "*" + "@" + "*" Then
'using view contact by email
Memail = Split(strCaption, " - Conver")(0)
Set MsgrContact = MessengerAPI.Messenger.GetContact(Memail, MessengerAPI.Messenger.MyServiceId)
If id = "fn" Then
'set friendly name
VB.Clipboard.SetText MsgrContact.FriendlyName
ElseIf id = "em" Then
'set email
VB.Clipboard.SetText MsgrContact.SigninName
End If
Else
'window isnt email so
'set friendlyname
Mfn = Split(strCaption, " - Conver")(0)
If id = "fn" Then
'set friendly name
VB.Clipboard.SetText Mfn
ElseIf id = "em" Then
' Need to do
End If
End If
End Sub


this isnt working :(
just beeps, and nothing is added...

if anyone has any ideas, please help :)
RE: VB help - Identifing Which Contact Is In The Window by Mike on 04-17-2005 at 07:22 PM

Make sure to use Clipboard.Clear before using Clipboard.SetText !

By the way, I would use something else than the Messenger API...

By "else" i mean a global windows hook that would notify me when a window is created.
Then I would get the class name, and if it is "IMWindowClass" get the caption title, and split to the last " - ".

But with that way, you won't be able to get the email/friendly name without using the messenger api... :(

But, I think I have some code that changes to email view...
But, you need to have the contact list window open...

Good luck...

By the way, WDZ really needs to add the code coloring feature :P


RE: VB help - Identifing Which Contact Is In The Window by Dempsey on 04-17-2005 at 07:26 PM

if you're using the Messenger API, it seems a bit stupid to then just read the window caption to get the email and friendly name.

You can just use the API to get the emails and friendly names of all the people in a convo, i can do the code for you if you want?


RE: VB help - Identifing Which Contact Is In The Window by Stigmata on 04-18-2005 at 06:38 AM

would be perfect :)

i just need a way of knowing who is in the contact window :)


RE: VB help - Identifing Which Contact Is In The Window by Dempsey on 04-18-2005 at 08:15 AM

I'm at college atm, but when i get home i'll do the code


RE: VB help - Identifing Which Contact Is In The Window by Stigmata on 04-18-2005 at 05:21 PM

thnks :)