Shoutbox

How to start off a plugin and how to make it simply change your name - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: How to start off a plugin and how to make it simply change your name (/showthread.php?tid=42872)

How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 04:36 PM

How do I simply create a plugin that changes your name? Using VB6. I have the API files.


RE: How to start off a plugin and how to make it simply change your name by TheGeek on 04-15-2005 at 04:39 PM

With the SetNewName function.


RE: How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 04:40 PM

I don't understand all the initialise stuff


RE: How to start off a plugin and how to make it simply change your name by TheGeek on 04-15-2005 at 04:42 PM

Well, I can't really tell you how to do that because I'm not a plugin programmer. I just knew the SetNewName function because its included with the Scripting host plugin.

Offtopic: i wish there was a way to get the text said by a contact with the scripting host. :( :P


RE: How to start off a plugin and how to make it simply change your name by Stigmata on 04-15-2005 at 04:42 PM

code:
Public Function ChangeNick(nick As String)
'functions changenick
'originally code by effekt
'altered to work better and with msn7 by stormsys

Dim msnmsblclass As Long 'Main MSN Window Variable
Dim edit As Long 'Edit Text Box Variable
Dim x As Long 'Options Window Variable

msnmsblclass& = FindWindow("MSBLWindowClass", vbNullString) 'Get Messenger Window HWND
DoEvents 'w8 for api to compleate what its dooing
PostMessage msnmsblclass&, WM_COMMAND, 40268, 0 'Show Options Box
DoEvents 'w8 for api to compleate what its dooing
x& = FindWindow("#32770", "Options") 'Get Options Box HWND
DoEvents 'w8 for api to compleate what its dooing
x& = FindWindowEx(x&, 0&, "#32770", vbNullString) 'Get Options Box HWND
DoEvents 'w8 for api to compleate what its dooing
edit& = FindWindowEx(x&, 0&, "edit", vbNullString) 'Get Edit Box HWND
DoEvents 'w8 for api to compleate what its dooing
SendMessageByString edit&, WM_SETTEXT, 0, nick 'Set Edit Box Text
DoEvents 'w8 for api to compleate what its dooing
PostMessage edit&, WM_KEYDOWN, VK_RETURN, 0 'Push Enter
'no there is absolutly no need for this 2nd enter
End Function


http://forums.msnfanatic.com/index.php?showtopic=11504
RE: How to start off a plugin and how to make it simply change your name by matty on 04-15-2005 at 05:07 PM

'This is just an example of using the Visual Basic Input Box on the Initialize Function to set the new name.

Public strNewUserName As String
Public blnNameChange As Boolean

Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
    Initialize = True
    strNewUserName = InputBox("Enter New Name","Enter New Name", "Enter New Name")

    If strNewUserName = "" Or strNewUserName = "Enter New Name" Then
        MsgBox "Please Select A Different Name"
    Else
        blnNameChange = SetNewName(strNewUserName)
    End If
End Function



'If you are confused abuot what each of the variables passed through initialize are then please read the following.

'//////////////////////////////////////////////////////////////////////
'//
'// Purpose: Initialization function
'//
'// Definition:
'//   This function is called when Messenger starts and each time a
'//   different user signs-in in Messenger.                         
'//                                                                 
'// Parameters:                                                     
'//   * nVersion: plugin support version. This will be used in the   
'//     future to identify different levels of support. Messenger   
'//     Plus! 3.20 sets this value to 5.                             
'//   * sUserEmail: email of the current user in Messenger. If       
'//     Messenger is not signed-in, this parameter is the email of   
'//     the last user who signed in. Messenger Plus! uses this value
'//     to load its own settings.                                   
'//   * oMessenger: Messenger COM interface. The type of this object
'//     is "Messenger". For more information, consult the public     
'//     Messenger API documentation on Microsoft's web site.         
'//   * return value: if your initialization is successfull, return 
'//     True to notify Messenger Plus! that the plugin is ready to   
'//     use.                                                         
'//                                                                 
'// Plugin Version Index:                                           
'//     Messenger Plus! 2.20: 1                                     
'//     Messenger Plus! 2.21: 2                                     
'//     Messenger Plus! 2.50: 3                                     
'//     Messenger Plus! 3.00: 4                                     
'//     Messenger Plus! 3.20: 5                                     
'//                                                                 
'//////////////////////////////////////////////////////////////////////




'The above documentation is located in MPPluginDef.cls


RE: How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 05:12 PM

What wd be an example to put in for version and omessenger?


RE: RE: How to start off a plugin and how to make it simply change your name by matty on 04-15-2005 at 05:17 PM

quote:
Originally posted by j.g.allen
What wd be an example to put in for version and omessenger?

'This is just an example for calling the oMessenger object passed through the Initialize Function into a Variable.
'Make sure to set a reference to the MessengerAPI Type Library


Public WithEvents MessengerAPI As MessengerAPI.Messenger

Public Function Initialize(ByVal nVersion As Long, ByVal sUserEmail As String, ByVal oMessenger As Object) As Boolean
    Initialize = True
    Set MessengerAPI = oMessenger
End Function

'Setting a new nickname through the oMessenger Object passed through the Initalize Function is impossible as the MyFriendlyName Property is Read-Only (Cannot be changed). This is why I had Patchou add the SetNewName function into the API.

'The code that Stigmata posted is using Windows API calls but the Contact List Window has to be opened for it to work.

RE: How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 05:27 PM

What does it mean for when i says:
"No creatable public componented detected"?


RE: How to start off a plugin and how to make it simply change your name by matty on 04-15-2005 at 05:29 PM

quote:
Originally posted by j.g.allen
What does it mean for when i says:
"No creatable public componented detected"?
Ok you need to make sure that in the Properties of your Class Module is set to MultiUse.
RE: How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 05:46 PM

Ok, how to i get it to appear in the msgplus plugins window? (I feel like I'm being a real pain in the arse)


RE: How to start off a plugin and how to make it simply change your name by matty on 04-15-2005 at 05:55 PM

quote:
Originally posted by j.g.allen
Ok, how to i get it to appear in the msgplus plugins window?
You have to register the DLL.

code:
start > run > regsvr32 "C:\Program Files\Messenger Plus! 3\Plugins\NameOfPlugin.dll"
If you installed Messenger Plus! 3 to a different location then change the above.

You also need to Run the Install.Reg. (If you changed the Name of the Class from Sample to something else then change it accordingly in the reg file. ie. open in notepad.)

Completly Exit MSN Messenger and restart it.
RE: How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 05:58 PM

Sorry what do i need to put in the reg file?

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Patchou\MsgPlus2\RegisteredPlugins]
""=""

What needs to go on the right and left?


RE: How to start off a plugin and how to make it simply change your name by matty on 04-15-2005 at 06:04 PM

On the left is the name of the project by default its MPPlugin the right side is the name of the Class file by default it is Sample.


RE: How to start off a plugin and how to make it simply change your name by jasonallen on 04-15-2005 at 06:21 PM

What determines the class file, coz its not working. I have a project file called RSP, and 2 other files, MPPluginConst.bas and MPPluginDef.cls in that project. I set the reg file to "RSP"="Sample" and ran it. But it doesn't appear in Msgplus :S


RE: How to start off a plugin and how to make it simply change your name by matty on 04-15-2005 at 06:52 PM

quote:
Originally posted by j.g.allen
What determines the class file, coz its not working. I have a project file called RSP, and 2 other files, MPPluginConst.bas and MPPluginDef.cls in that project. I set the reg file to "RSP"="Sample" and ran it. But it doesn't appear in Msgplus :S
Oops My bad i made a mistake sorry. The left side is what your plugin is called so RSP then the right side is ProjectName.ClassName
so MPPlugin.Sample.

My Bad sorry about that.

Of you need more help take a look at this open source plugin I made.
http://shoutbox.menthix.net/~msgplus/showthread.p...d=281160#pid281160