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

Pages: (2): « First [ 1 ] 2 » Last »
Tutorial: making an installer for your plugin in a few easy steps
Author: Message:
Xerxis
Full Member
***


Posts: 234
Reputation: 1
40 / 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 596 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
Jhrono
Veteran Member
*****


Posts: 1791
Reputation: 25
32 / Male / Flag
Joined: Jun 2004
RE: install script
i really don't get what you mean sorry..:S...Do you want somebody to make you a setup file for your plugin?
04-07-2005 09:01 PM
Profile E-Mail PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
RE: install script
quote:
Originally posted by johny
i really don't get what you mean sorry..:S...Do you want somebody to make you a setup file for your plugin?
He made a setup script for Inno Setup and he is sharing the source of the installer he made with us :)

Anyway, I didn't know that you could use api calls in inno setup...
YouTube closed-captions ripper (also allows you to download videos!)
04-07-2005 09:47 PM
Profile E-Mail PM Web Find Quote Report
Xerxis
Full Member
***


Posts: 234
Reputation: 1
40 / Male / –
Joined: Jul 2003
Status: Away
O.P. RE: install script
Sorry if it wasn't very clear, maybe i'll make an example of how to make an inno setup project for Plus! Plugins, as i noticed a lot of developers use a bat file and require the user to restart messenger. And since inno setup 4 you can do a lot with it, i like the delphi scripting engine that is included :) (makes me think those years of turbo pascal in high school weren't a waste of time after all :p)

This post was edited on 04-08-2005 at 06:59 AM by Xerxis.
04-08-2005 06:51 AM
Profile E-Mail PM Web Find Quote Report
(CyBeRDuDe)
Senior Member
****


Posts: 512
Reputation: 21
37 / Male / –
Joined: Jul 2003
RE: Tutorial: making an installer for your plugin in a few easy steps
That is really nice done Xerxis!!! Nice information!!! :D I would use this.. And I don't mind you using my counter plugin as example!!! :D
Could you do one thing more?...
Maybe make a function that checks if the file/plugin already exists... If it does then Messenger Should be closed/exited/task killed before installing the plugin, since I can not overwrite the plugin if messenger is running, and using the reloadplugins api doesn't work when the plugins are made in VB6... :(... If you add a function/support for this then this turtorial would be perfect!!! :D.. Nice done mate!!!
04-08-2005 11:36 AM
Profile E-Mail PM Find Quote Report
Xerxis
Full Member
***


Posts: 234
Reputation: 1
40 / Male / –
Joined: Jul 2003
Status: Away
O.P. RE: Tutorial: making an installer for your plugin in a few easy steps
I can install a plugin several times without deleting the file? Reloadplugins works fine I thought, I tested it with you plugin and it showed up in the plugin menu without problems :). If it doesn't work with you i'll make a function that terminates the Messenger Plus! process
04-08-2005 12:35 PM
Profile E-Mail PM Web Find Quote Report
(CyBeRDuDe)
Senior Member
****


Posts: 512
Reputation: 21
37 / Male / –
Joined: Jul 2003
RE: Tutorial: making an installer for your plugin in a few easy steps
It works?... Also with my plugin???... Whenever I try using the same reload api code you use, and try to overwrite the existing plugin dll file it won't let me... since it's in use.. and in matter of fact it was a known fact that the reload funtion doesn't unload vb6 dll files... :S..  Unless this have been fixed in 3.50 I don't know?.... I'll just check out the installer soon.. :D...

This post was edited on 04-08-2005 at 02:39 PM by (CyBeRDuDe).
04-08-2005 02:39 PM
Profile E-Mail PM Find Quote Report
Xerxis
Full Member
***


Posts: 234
Reputation: 1
40 / Male / –
Joined: Jul 2003
Status: Away
O.P. RE: Tutorial: making an installer for your plugin in a few easy steps
works on my win2k machine without problems :)
04-08-2005 03:14 PM
Profile E-Mail PM Web Find Quote Report
eSouL
Junior Member
**


Posts: 36
Joined: Oct 2005
RE: Tutorial: making an installer for your plugin in a few easy steps
Hi Xerxis,

Thanks for the great tutorial! I have a question though..

How do I specify the subdirectory to install at? For instance, I have a plugin called ABC.dll, and in the plugin folder i have a subfolder 'ABC', which contains another two subfolders 'graphics' and 'lib', lib being the place I keep all the dll and activex ocx.

How do I go about making the installer create the folder structure correctly and install those files in their respecive folders?

EDIT: Never mind I figured out how (Y)

This post was edited on 10-27-2005 at 05:34 PM by eSouL.
10-27-2005 05:07 PM
Profile E-Mail PM Find Quote Report
Tobiaz
Full Member
***

Avatar

Posts: 103
Reputation: 5
67 / Male / –
Joined: Aug 2005
Status: Away
RE: Tutorial: making an installer for your plugin in a few easy steps
Fuckin' great Tutorial!

Thank you very, very much! It's exactly that, I was searching for!

(h5)(h5)(h5)(h5)(h5)(h5)(h5)(h5)(h5)(h5)

Greeeeeeez
10-29-2005 01:31 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


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