What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » What am I doing wrong?

What am I doing wrong?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: What am I doing wrong?
in a form

code:
Dim PluginDir As String
Dim PluginFileName As String

Private Sub Form_Load()
    PluginDir = GetPluginDirectory()
    PluginFileName "MPPluginVB.dll"
    If CheckDirectory(PluginDir) = True Then
   
        CopyFile AppPath & PluginFileName, PluginDir & PluginFileName, False
        InstallPlugin "MPPluginVB", "MPPluginVB.Sample"
        RegisterPlugin PluginDir & PluginFileName
        ReloadPlus
       
    Else
        MsgBox "Plus! not installed, download from http://msgplus.net"
    End If

End Sub

in a module
code:
Public Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Public Declare Function IsNTAdmin Lib "advpack.dll" (ByVal dwReserved As Long, ByRef lpdwReserved As Long) As Long
Public Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const HWND_BROADCAST = &HFFFF&

Public Function GetPluginDirectory() As String

    If CBool(IsNTAdmin(0&, 0&)) = True Then
        GetPluginDirectory = GetKeyValue(HKEY_LOCAL_MACHINE, "SOFTWARE\Patchou\MsgPlus2", "PluginDir")
    Else
        GetPluginDirectory = GetKeyValue(HKEY_CURRENT_USER, "SOFTWARE\Patchou\MsgPlus2", "PluginDir")
    End If

    If Right(GetPluginDirectory, 1) <> "\" Then GetPluginDirectory = GetPluginDirectory & "\"
   
End Function

Public Function InstallPlugin(FileName As String, VBWord As String) As Boolean

    If CBool(IsNTAdmin(0&, 0&)) = True Then
        InstallPlugin = UpdateKey(HKEY_CURRENT_USER, "SOFTWARE\Patchou\MsgPlus2\RegisteredPlugins", FileName, VBWord)
    Else
        InstallPlugin = UpdateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Patchou\MsgPlus2\RegisteredPlugins", FileName, VBWord)
    End If

End Function

Public Function ReloadPlus()
    Dim nMsg As Long
    nMsg = RegisterWindowMessage("MessengerPlus_PluginChange")
    PostMessage HWND_BROADCAST, nMsg, 0, 0
End Function

Public Function FileExists(strFile As String) As Boolean
On Error GoTo e
    FileLen (strFile)
    FileExists = True
    Exit Function
e:
    FileExists = False
End Function

Public Function RegisterPlugin(strPath As String)
   
    Shell "regsvr32.exe " & Chr(34) & strPath & Chr(34)
   
End Function

Public Function CheckDirectory(strDir As String) As Boolean
On Error GoTo e
    Dim CurrentDir As String
    CurrentDir = CurDir
    ChDir strDir
    CheckDirectory = True
    ChDir CurrentDir
    Exit Function
e:
    ChDir CurrentDir
    CheckDirectory = False
End Function


This post was edited on 10-01-2005 at 04:12 PM by matty.
10-01-2005 03:17 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
What am I doing wrong? - by sena on 10-01-2005 at 11:21 AM
RE: What am I doing wrong? - by Plik on 10-01-2005 at 11:26 AM
RE: What am I doing wrong? - by sena on 10-01-2005 at 02:33 PM
RE: What am I doing wrong? - by matty on 10-01-2005 at 02:47 PM
RE: What am I doing wrong? - by sena on 10-01-2005 at 02:49 PM
RE: What am I doing wrong? - by J-Thread on 10-01-2005 at 03:10 PM
RE: What am I doing wrong? - by sena on 10-01-2005 at 03:12 PM
RE: What am I doing wrong? - by matty on 10-01-2005 at 03:17 PM
RE: What am I doing wrong? - by sena on 10-01-2005 at 03:21 PM
RE: What am I doing wrong? - by Stigmata on 10-01-2005 at 03:23 PM
RE: What am I doing wrong? - by sena on 10-01-2005 at 03:33 PM
RE: What am I doing wrong? - by Stigmata on 10-01-2005 at 04:09 PM
RE: What am I doing wrong? - by sena on 10-01-2005 at 04:54 PM
RE: What am I doing wrong? - by matty on 10-03-2005 at 05:49 PM
RE: What am I doing wrong? - by sena on 10-03-2005 at 06:54 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On