Welcome Guest ( Log In | Register )


 
Reply to this topicStart new topic
> Vb 6.0: Beginner: Changing Msn Name
Refeniz
post 20 Oct 2005, 03:24 AM
Post #1


yourforum addicted
Group Icon

Group: Members
Posts: 283
Joined: 14-October 05
From: Oxford, Michigan
Member No.: 491
Zodiac Sign: I'm a gemini!
Gender: I'm a m!



this program will show you how to change your name in visual basic, although in older versions yo used to be able to do this without the ugly options screen flashing, it does not work any more unless the program is proxied into your account, now, to the tutorial



Step 1
for one thing when the 'New Project' dialog opens select "Standard EXE"



Step 2
now, we need to add the messenger API, so go Project -> Refrences, look for Messenger API, chek the box and select OK



Step 3
Now we need to add some code! double click on the grey box thing on your screen
now it should look like this
CODE
Private Sub Form_Load()

End Sub

now, above that create a space by clicking before the p and pressing enter, now we will add a declaration, so th program knows when we are using the API, now it should look like this
CODE
Public WithEvents msn As MessengerAPI.Messenger
Private Sub Form_Load()

End Sub

now we also need to add the declaration in the form load, so inbetween the form load and the end sub put "Set msn = New Messengerapi.Messenger", now it will look like this
CODE
Public WithEvents msn As MessengerAPI.Messenger
Private Sub Form_Load()
Set msn = New MessengerAPI.Messenger
End Sub


Step 4
now we will add a command button

there is what you click, now you just drag your pointer on the grey box and let go, now you have a command button!!


Step 5
ok, now to change the 'Caption' of the command button

on the right side of your screen you will see a properties box, look for the box called captions and change it from 'Command1" to "Click Me"

Step 6
now double click on the command button, and the code dialog will appear, now inside you will notice some things have changed, now it should look something like this
CODE
Public WithEvents msn As MessengerAPI.Messenger

Private Sub Command1_Click()

End Sub

Private Sub Form_Load()
Set msn = New MessengerAPI.Messenger
End Sub

now, in-between "Private Sub Command1_Click()" and "End Sub" add this code
CODE
msn.OptionsPages 0, MOPT_GENERAL_PAGE
Pause 0.5
SendKeys "New nickname here"
Pause 0.5
SendKeys "{ENTER}"
SendKeys "{ENTER}"
Me.Show
end sub

now it should look like this
CODE
Public WithEvents msn As MessengerAPI.Messenger

Private Sub Command1_Click()
msn.OptionsPages 0, MOPT_GENERAL_PAGE
Pause 0.5
SendKeys "New nickname here"
Pause 0.5
SendKeys "{ENTER}"
SendKeys "{ENTER}"
Me.Show
End Sub

Private Sub Form_Load()
Set msn = New MessengerAPI.Messenger
End Sub

now for a little explanation, "msn.OptionsPages 0, MOPT_GENERAL_PAGE", loads the API, and opens the MSN options window, "Pause 0.5" we'll get to that in the next step plus.smilie3.gif, "SendKeys "New nickname here"" that means it is going to send those letters, to the options dialog, so that just changes the name part "SendKeys "{ENTER}"" sends enter and resets your name, the next one is just a double check "Me.Show" means it brings this form to the top of your screen

Step 6
now were going to add our own sub this time so we will have to type it, now, below the last end sub were going to type "Sub Pause(interval)" and hit enter, now it should look like this
CODE
Public WithEvents msn As MessengerAPI.Messenger

Private Sub Command1_Click()
msn.OptionsPages 0, MOPT_GENERAL_PAGE
Pause 0.5
SendKeys "New nickname here"
Pause 0.5
SendKeys "{ENTER}"
SendKeys "{ENTER}"
Me.Show
End Sub

Private Sub Form_Load()
Set msn = New MessengerAPI.Messenger
End Sub

Sub Pause(interval)

End Sub

now were going to add some code default.biggrin.gif ok, now inbetween "Sub Pause(interval)" and "End Sub" were going to add
CODE
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop

now it all should look like this
CODE
Public WithEvents msn As MessengerAPI.Messenger

Private Sub Command1_Click()
msn.OptionsPages 0, MOPT_GENERAL_PAGE
Pause 0.5
SendKeys "New nickname here"
Pause 0.5
SendKeys "{ENTER}"
SendKeys "{ENTER}"
Me.Show
End Sub

Private Sub Form_Load()
Set msn = New MessengerAPI.Messenger
End Sub

Sub Pause(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop

now for more explaining, all that did was make it so the program waits so long before going on to the next thing, in other words it slows it down becuse the computer will do the sendkeys before the options dialog is open

Step 7
not really a step but who cares, click the blue arrow button at the top and press the button plus.smilie3.gif

Attached File(s)
Attached File  Project1.zip ( 1.16K ) Number of downloads: 65
 


--------------------
Go to the top of the page
 
Bookmark this: Post to Del.icio.usPost to DiggPost to FacebookPost to GooglePost to SlashdotPost to StumbleUponPost to TechnoratiPost to YahooMyWeb
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 9th December 2019 - 11:38 AM
Skin and Graphics by Dan Ellis and Anubis. Hosting by Forums & More 2005-2011.
InvisionGames - Your #1 Arcade Games Repository | AllSigs - Signatures for all | Rock Band + Guitar Hero = RockHero ! | The Remoters - Remote Assistance | FileMiners - You ask, We find