working with messenger

frenchie_nic

Member
Joined
May 3, 2006
Messages
7
Programming Experience
Beginner
Hi again all, :)
I am trying to teach myself Vb.net so I give myself little tasks and see if I can do them. So far I have done little games but nothing to complicated. :p
I use messenger a lots and I have a few ID and I always forget my ID’s an d PW :eek: , so I decided to see if I could create a program that will sign me in automatically under any of my ID’s.
I know my limitation at the moment so I decided not to go into database to hold my data but to create a form with about 10 buttons with each having a different ID and PW assigned to them.
After a bit of reading I found how to open the messenger with SHELL, but now I am stuck cause not sure how to look at it. So far when I wanted a text box to be fill, I just assigned the value of a variable to it, but that’s only because I knew the name of the text box as I created it myself. However if I use yahoo messenger for example, I just have 2 text box. One is where my ID goes and the other is where my PW goes. So how can I populate those 2 box if I don’t know their Id?
I then would also need to give the focus on the button to "sign in" and then make it click.
So as I said, am I looking at it the wrong way? :confused:
Thanks,
Nic
 
i know to do this properly you'll need to use API's, but i'm not good with API's so even I would need to do some reading on how to accomplish this

but right off hand you could open yahoo, then use SendKeys.Send(Keys to be sent) which is where you could put the user name, a tab, and your password all at once, but yahoo would have to have focus and have the username box have focus

also to open an application in .Net is more flexible if you use System.IO.Process.Start() to start other applications, by doing it this way you can store a reference to yahoo in your process variable and have your program be able to exit (completely close) yahoo as well as open and log you in
 
Ok, thanks for the tips JuggaloBrotha :) .
I am now using the sendKey: System.Windows.Forms.SendKeys.Send() with the Id and the Pw as well as a few tab and I manage to do it, however I am not getting anything constant, some time it work well and I sign on no problem, sometime it give me only a part of the id and sometime it give me the id from the previous button (I have 3 Id’s on different buttons.) and even sometime I don’t get anything as Id or Pw. :confused:
Does the sendkeys use some sort of memory or something that I should clear before I can use the next Id?
I am still using the shell by the way to open my messenger if that make any difference.
Thanks
 
i think SendKeys.SendWait("keys to be sent") might be what you should be using and be sure to send the tab key on it's own such as

Button's click event
Process.Start("msn")
sendkeys.Sendwait("username")
sendkeys.Sendwait("{Tab}")
sendkeys.Sendwait("password")

i'll play with some of this stuff sometime this next weekend and see if i can get it working

although i should look into using API's to do this as it'll work more correctly
 
I have now done it JuggaloBrotha and it work, I am still using sendkey.send() but I have now added a timer between opening my messenger and sending the key and it work perfectly (only few 100’s of a second). I assume I wasn’t letting enough time for the messenger to open.
I am now looking at also closing the application from the same form (probably from a central button if possible), so I will look at your suggestion about System.IO.Process.Start().
Thanks again. :)
 
it's good to hear that you got this working, as for closing a messenger instance that you open here's a good start:
VB.NET:
'Open Yahoo
Dim procYahoo As System.Diagnostics.Process = System.Diagnostics.Process.Start("Yahoo.exe")

'close Yahoo
procYahoo.Exit() 'might be .Close()  I dont have the IDE with me right now
 
Back
Top