What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Tutorial: making an installer for your plugin in a few easy steps

Tutorial: making an installer for your plugin in a few easy steps
Author: Message:
Xerxis
Full Member
***


Posts: 234
Reputation: 1
41 / Male / –
Joined: Jul 2003
Status: Away
O.P. Tutorial: making an installer for your plugin in a few easy steps
Ok, so I decided to make a tutorial for visual basic classic programmers (aka vb6) who make a plugin for Messenger Plus! This tutorial will deal with making

an install script using INNO setup 5. Inno setup is freeware and can be downloaded here: http://www.jrsoftware.org/isinfo.php (at the moment of writing this tutorial there seems to be a problem with the site)

As example for this tutorial i use the nicname counter plugin, i hope the author doesn't mind.

Once your plugin is finished, open Inno setup and create a new project using the Script Wizard. Make sure the create a new empty script box is unchecked and click next.

Fill in the details about your program as needed. Make sure you use the right version. If you are not a publisher leave the last two fields blank or use your name. Click next.

In the following window, click the other checkbox, the application doesn't need a directory and click next.

Add all the files your project needs (one of them ofcourse your plugin dll ;)), there can be some ocx files which are needed, not everybody has the visual

basic ide installed, keep this in mind. Click next

Provide the wizard with the pad to your licence file, keep in mind that for legal reasons this is certainly recommended (especially the liability part). click next

Finish the wizard, click no, the script shouldn't be compiled yet. Save the script.

In the files section remove the ignoreversion flag and replace it with a regserver flag for your plugin dll and every ocx or activeX dll your project

installs, a tlb file should be installed with a regtypelib flag

example pluginfile: Source: "C:\Documents and Settings\Administrator\Bureaublad\Count_Nickname\CountNick.dll"; DestDir: "{win}"; Flags: regserver
example ocx: Source: "c:\WINNT\system32\TABCTL32.OCX"; DestDir: "{sys}"; Flags: sharedfile regserver

notice the destination directory system and the sharedfile flag used for activex components, this is important!

also notice the destination directory of your plugin is defaulted to win, this is because you chose not to make an application directory, we will change

this. Replace DestDir: "{win}" with DestDir: "{reg:HKLM\SOFTWARE\Patchou\MsgPlus2,PluginDir|NotFound}", this should install the plugin to the default plugin

directory of Messenger Plus!

next make a code section in your script after your file section by putting [ Code ] without the spaces.

make a constant section with two vars:

code:

const
  ValueName = 'Nickname Counter';
  ValueClass = 'CountNick.clsCountNick';



Valuename can be whatever you like, keep it meaningful, valueclass should be the name of your class.

next add the following function to your code section

code:

function MsgPlusCheck(): Boolean;
var
  MyProgCheckResult : Boolean;
begin
  if RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Patchou\MsgPlus2', 'PluginDir') then begin
    MyProgCheckResult := True;
  end else
    MyProgCheckResult := False;
  if MyProgCheckResult = False then begin
    MsgBox('The installation wizard detected that you don''t have Messenger Plus! installed. The installation will be aborted.', mbInformation, MB_OK);
  end;
  Result := MyProgCheckResult;
end;



This function will check if the user has msgplus installed and will abort if not. Note: this function is not bulletproof, check if the msgplus file exists or

if the process is running if you want te be 100% sure.

This function should be called before the file is installed en should abort the installation of the file if msgplus is not installed, therefore add the

following part to your files section (the plugin file line)

Check: MsgPlusCheck();

This line should now look like this:

Source: "C:\Documents and Settings\Administrator\Bureaublad\Count_Nickname\CountNick.dll"; Check: MsgPlusCheck(); DestDir:

"{reg:HKLM\SOFTWARE\Patchou\MsgPlus2,PluginDir|NotFound}"; Flags: regserver

Add following procedure to your code section

code:

procedure InstallPlugin;
var
  nMsg : LongInt;
begin
  if RegWriteStringValue(HKLM, 'SOFTWARE\Patchou\MsgPlus2\RegisteredPlugins', ValueName, ValueClass) then begin
    nMsg := RegisterWindowMessage('MessengerPlus_PluginChange');
    PostBroadcastMessage(nMsg, 0, 0);
  end else
    MsgBox('The Messenger Plus! plugin couldn''t be installed due to an unknown error', MbInformation, MB_OK);
end;



This will cause Messenger Plus to reload it's plugins

To call this function add BeforeInstall: InstallPlugin; to your files section, you become this

Source: "C:\Documents and Settings\Administrator\Bureaublad\Count_Nickname\CountNick.dll"; Check: MsgPlusCheck(); BeforeInstall: InstallPlugin; DestDir:

"{reg:HKLM\SOFTWARE\Patchou\MsgPlus2,PluginDir|NotFound}"; Flags: regserver

Now you're almost done, the only thing left is the uninstallation of the plugin

Add this function to your code section

code:

function InitializeUninstall(): Boolean;
var
  nMsg : LongInt;
begin
  if MsgPlusCheck() then begin
    MsgBox('It is recommended that you close MSN Messenger before continuing.', MbInformation, MB_OK);
  end;
  Result := True;
  RegDeleteValue(HKLM, 'SOFTWARE\Patchou\MsgPlus2\RegisteredPlugins', ValueName);
  nMsg := RegisterWindowMessage('MessengerPlus_PluginChange');
  PostBroadcastMessage(nMsg, 0, 0);
end;



That's it, no more restarting messenger, no more bat files. I hope this helped some of you. Included is the complete source and it's compiled version. have

fun.

XerXis
co-founder of SodeX bvba (srr, always wanted to say that :p)

.zip File Attachment: complete.zip (854.24 KB)
This file has been downloaded 623 time(s).

This post was edited on 04-08-2005 at 10:27 AM by Xerxis.
04-07-2005 08:26 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Tutorial: making an installer for your plugin in a few easy steps - by Xerxis on 04-07-2005 at 08:26 PM
RE: install script - by Jhrono on 04-07-2005 at 09:01 PM
RE: install script - by Mike on 04-07-2005 at 09:47 PM
RE: install script - by Xerxis on 04-08-2005 at 06:51 AM
RE: Tutorial: making an installer for your plugin in a few easy steps - by (CyBeRDuDe) on 04-08-2005 at 11:36 AM
RE: Tutorial: making an installer for your plugin in a few easy steps - by Xerxis on 04-08-2005 at 12:35 PM
RE: Tutorial: making an installer for your plugin in a few easy steps - by (CyBeRDuDe) on 04-08-2005 at 02:39 PM
RE: Tutorial: making an installer for your plugin in a few easy steps - by Xerxis on 04-08-2005 at 03:14 PM
RE: Tutorial: making an installer for your plugin in a few easy steps - by eSouL on 10-27-2005 at 05:07 PM
RE: Tutorial: making an installer for your plugin in a few easy steps - by Tobiaz on 10-29-2005 at 01:31 PM
RE: Tutorial: making an installer for your plugin in a few easy steps - by parveenjain on 08-13-2008 at 11:52 AM
RE: Tutorial: making an installer for your plugin in a few easy steps - by CookieRevised on 08-16-2008 at 11:33 AM


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