|  Help to a newbie? | 
| Author: | 
Message: | 
Fröt 
Junior Member 
  
  
  
No
  
Posts: 16 
38 /   / – 
Joined: Feb 2005
 
Status: Away
 
 | 
O.P.  Help to a newbie?
Hi! 
I am a experienced Visual Basic 6 programmer.Yesterday,my friends asked me to do a Messenger Plus Plug-In that automaticly changes display name of user...
 
They asked for calculation of dates between two dates and change display name to this :
 
OrginalNick - (78 days left)
 
(so a countdown)
 
I  did the necessary function but i am very very confused about plug-in part   
Please somebody tell me what must i do for make plug in.  
 |   
 | 
| 02-11-2005 07:51 PM | 
 | 
  | 
Plik 
Veteran Member 
     
  
  
 
Posts: 1487 Reputation: 46 
36 /   / – 
Joined: Jun 2004 
 | 
 | 
| 02-11-2005 07:54 PM | 
 | 
  | 
Fröt 
Junior Member 
  
  
  
No
  
Posts: 16 
38 /   / – 
Joined: Feb 2005
 
Status: Away
 
 | 
| 
O.P.  RE: Help to a newbie?
 hmm 
 
i downloaded and examined it but even now i cant say i understand. 
 
i will use setnewname func but where? 
 
mu func must at least one time in a day.how can i do this? 
 
 
sorry for endless questions. 
 |   
 | 
| 02-11-2005 07:58 PM | 
 | 
  | 
Plik 
Veteran Member 
     
  
  
 
Posts: 1487 Reputation: 46 
36 /   / – 
Joined: Jun 2004 
 | 
| 
 RE: Help to a newbie?
 You could either have a loop to check if the time has changed and update it from there. And you could start that loop from the initialise function. 
 
Or you could check to see if the day has changed in the intialise function then exit the plugin. 
 
Or you could have a command to update it. 
 |   
 | 
| 02-11-2005 08:02 PM | 
 | 
  | 
Fröt 
Junior Member 
  
  
  
No
  
Posts: 16 
38 /   / – 
Joined: Feb 2005
 
Status: Away
 
 | 
| 
O.P.  RE: Help to a newbie?
 i think i am starting to understand madman66 thank you : ) 
 
so the plug in have a func "initialise".. 
 
so lets say i want to make a command for user.. 
 
how can do this? 
 
ie: /changenik 
 
 
 |   
 | 
| 02-11-2005 08:07 PM | 
 | 
  | 
Plik 
Veteran Member 
     
  
  
 
Posts: 1487 Reputation: 46 
36 /   / – 
Joined: Jun 2004 
 | 
| 
 RE: Help to a newbie?
 In the parsecommand funtion of the documentation there should be an example of handling commands. 
 |   
 | 
| 02-11-2005 08:12 PM | 
 | 
  | 
Fröt 
Junior Member 
  
  
  
No
  
Posts: 16 
38 /   / – 
Joined: Feb 2005
 
Status: Away
 
 | 
O.P.  RE: Help to a newbie?
code:
  
Function DiferenciaEnFechas(pdFechaBase As Date, pdFecha As Date) As String 
    Dim dFechaAux As Date 
    Dim iYear As Integer, iMes As Integer, iDia As Integer 
    Dim iYearFinal As Integer 
    Dim iMesFinal As Integer 
    Dim iDiaFinal As Integer 
    Dim sTiempo As String, sAux As String 
    iDia = DatePart("d", pdFecha) 
    iMes = Month(pdFechaBase) 
    iYear = Year(pdFechaBase) 
    dFechaAux = DateSerial(iYear, iMes, iDia) 
    iDiaFinal = DateDiff("d", dFechaAux, pdFechaBase) 
    iMes = DateDiff("m", pdFecha, pdFechaBase) 
    Select Case iMes 
        Case Is > 0 
        iYearFinal = iMes \ 12 
        iMesFinal = iMes Mod 12 
        If iDiaFinal < 0 Then 
            If Month(dFechaAux) <> Month(pdFechaBase) Then 
                iDiaFinal = 31 - (DatePart("d", DateAdd("d", -1, DateSerial(iYear, Month(dFechaAux), 1)))) 
                dFechaAux = DateAdd("m", -1, dFechaAux) 
                dFechaAux = DateAdd("d", -iDiaFinal, dFechaAux) 
            Else 
                dFechaAux = DateAdd("m", -1, dFechaAux) 
            End If 
 
            iDiaFinal = DateDiff("d", dFechaAux, pdFechaBase) 
 
 
            If iMesFinal > 0 Then 
                iMesFinal = iMesFinal - 1 
            Else 
 
 
                If iYearFinal > 0 Then 
                    iYearFinal = iYearFinal - 1 
                    iMesFinal = 11 
                End If 
 
            End If 
 
        End If 
 
        sTiempo = "Pasado: " 
        Case Is = 0 
        iYearFinal = 0 
        iMesFinal = 0 
 
 
        If iDiaFinal < 0 Then 'Futuro 
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux) 
            sTiempo = "Futuro: " 
        ElseIf iDiaFinal = 0 Then 'HOY 
            sTiempo = "HOY: " 
        Else 'Pasado 
            sTiempo = "Pasado: " 
        End If 
 
        Case Else 'Futuro 
        iMes = DateDiff("m", pdFechaBase, pdFecha) 
        iYearFinal = iMes \ 12 
        iMesFinal = iMes Mod 12 
         
 
 
        If iDiaFinal > 0 Then 
            dFechaAux = DateAdd("m", 1, dFechaAux) 
             
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux) 
 
 
            If iMesFinal > 0 Then 
                iMesFinal = iMesFinal - 1 
            Else 
 
 
                If iYearFinal > 0 Then 
                    iYearFinal = iYearFinal - 1 
                    iMesFinal = 11 
                End If 
 
            End If 
 
        Else 
            iDiaFinal = DateDiff("d", pdFechaBase, dFechaAux) 
        End If 
 
        sTiempo = "Futuro: " 
    End Select 
 
sAux = Str(iYearFinal) 
 
 
If iYearFinal = 1 Then 
    sAux = sAux & " Ańo, " 
Else 
    sAux = sAux & " Ańos, " 
End If 
 
sAux = sAux & Str(iMesFinal) 
 
 
If iMesFinal = 1 Then 
    sAux = sAux & " Mes, " 
Else 
    sAux = sAux & " Meses, " 
End If 
 
sAux = sAux & Str(iDiaFinal) 
 
 
If iDiaFinal = 1 Then 
    sAux = sAux & " Día" 
Else 
    sAux = sAux & " Dia" 
End If 
 
 
 
DiferenciaEnFechas = sTiempo & sAux 
 
Dim a, b, c As Integer 
a = Left(Right(DiferenciaEnFechas, 6), 2) 
b = Left(Right(DiferenciaEnFechas, 16), 1) 
If Left(a, 1) = " " Then 
a = Right(a, 1) 
End If 
If b = " " Then 
b = 0 
End If 
 
c = a + (b * 30) 
 
 
DiferenciaEnFechas = c 
End Function 
 
  
my function is above!
 
can anybody send the plugin code for me to understand at last?
 
i think i wanted very much things.   
 This post was edited on 02-11-2005 at 09:41 PM by Fröt.
 |   
 | 
| 02-11-2005 08:26 PM | 
 | 
  | 
Jip 
Junior Member 
  
  
 
Posts: 28 
Joined: Jun 2004 
 | 
 RE: Help to a newbie?
U will have to include the 2 files as part as the API, then u need to make ur own 
u need the initalize function and uninitalize ones
 
configures functions 
and GetPublishCommandInfo
 
which needs the name of the command ur going to use in msn e.g(/xchangename) U MUST USE X BEFORE YOUR COMMAND
 
then u will need  ParseCommand
 
there u need to put 
 
If (StrComp(LCase(sCommand), "/xsamplevb", vbTextCompare) = 0) Then
 
sResult = DiferenciaEnFechas(blahhfgh)
 
/xsamplevb, to be replaced with the name of ur plugin command
 
then its just time for testing   ))
  
 |   
 | 
| 02-11-2005 11:53 PM | 
 | 
  | 
Fröt 
Junior Member 
  
  
  
No
  
Posts: 16 
38 /   / – 
Joined: Feb 2005
 
Status: Away
 
 | 
O.P.  RE: RE: Help to a newbie?
quote: Originally posted by Jip 
U will have to include the 2 files as part as the API, then u need to make ur own 
 
u need the initalize function and uninitalize ones 
 
configures functions 
and GetPublishCommandInfo 
 
which needs the name of the command ur going to use in msn e.g(/xchangename) U MUST USE X BEFORE YOUR COMMAND 
 
then u will need  ParseCommand 
 
there u need to put  
 
If (StrComp(LCase(sCommand), "/xsamplevb", vbTextCompare) = 0) Then 
 
sResult = DiferenciaEnFechas(blahhfgh) 
 
/xsamplevb, to be replaced with the name of ur plugin command 
 
then its just time for testing  )) 
 
 
  
thank you very much!
 
you let me see it   
alright,do you know a command to get the current nickname of user.  
 |   
 | 
| 02-12-2005 12:37 AM | 
 | 
  | 
Plik 
Veteran Member 
     
  
  
 
Posts: 1487 Reputation: 46 
36 /   / – 
Joined: Jun 2004 
 | 
 RE: Help to a newbie?
That cant be done with the Plus API but you can use the messenger API. Which is passed in initialise. 
code: oMessenger.Myfriendlyname()
  gets the current users nickname  
 |   
 | 
| 02-12-2005 12:43 AM | 
 | 
  | 
| 
Pages: (2): 
« First
  
 [ 1 ]
 2
 
»
 
Last »
 | 
| 
 |