topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 4:47 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: For Coders: How to signal FARR to release and reload plugins programatically  (Read 7040 times)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
If you want to build an installer for your plugin, the following info may be useful.
Though i think it would be even more useful if we wrote a generic installer for plugins and added a way for FARR itself to guide user through installing a plugin in a less error-prone manner than is currently required.

But anyway:

  • If you want to signal FARR to *UNLOAD* all plugins, in preparation for updating a dll that might currently be in use, send the FARR process the windows message WMUSER with WPARAM=98 and LPARAM=97.  You would normally do that BEFORE you try to install or replace any dll.
  • Then to signal FARR that the installation is completed and that FARR should *reload* its plugins, send the windows message WMUSER with WPARAM=98 and LPARAM=98.  You would normally do this after your installer has finished.

This is the exactly the procedure that DcUpdater uses when updating plugins.

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
Thanks mouser.

A couple of questions (because I can't get it to work ;)):

- WMUSER is 0x400 or 1024, right?
- What do you mean with: "send the FARR process"? Do you send the message to FARR's main window? How do you get that from DCUpdater?

Thanks.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Do you send the message to FARR's main window? How do you get that from DCUpdater?

yes.
i use some c++ classes that look up a Process ID given an application exe name, and then find the window corresponding to that Process ID.
there may be an inno setup addon that will do this, but it's not in default inno setup.

however, i can provide a smallish (50k or so) dll that you can call from inno setup that will find the process by name and send it the signal, and show how that can be used from inno setup if you like.  i actually use this in all my installers to send a signal and actually CLOSE a running application during installation/uninstallation.

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
however, i can provide a smallish (50k or so) dll that you can call from inno setup that will find the process by name and send it the signal, and show how that can be used from inno setup if you like.  i actually use this in all my installers to send a signal and actually CLOSE a running application during installation/uninstallation.

If you could provide that DLL, that would be perfect! :Thmbsup:

By the way, I was able to install plugins by completely closing FARR (by calling FARR.exe -exit) and then restarting it. But that just doesn't seem  as elegant (seeing that you don't do it with DCUpdater).

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
By the way, I was able to install plugins by completely closing FARR (by calling FARR.exe -exit) and then restarting it. But that just doesn't seem  as elegant (seeing that you don't do it with DCUpdater).


ah.. you made me realize.. i can just add commandline args to let you tell farr to unload and reload plugins.. in fact knowing me i probably already did and just forgot..

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
By the way, I was able to install plugins by completely closing FARR (by calling FARR.exe -exit) and then restarting it. But that just doesn't seem  as elegant (seeing that you don't do it with DCUpdater).


ah.. you made me realize.. i can just add commandline args to let you tell farr to unload and reload plugins.. in fact knowing me i probably already did and just forgot..

Indeed, that would make it even simpler.

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
This is something I needed for fscript2, it's great that it already exists. I'm creating proxy plugins on the fly, so this is perfect ;) . However, it seems that it automatically run the 'aplugins' command, is there a way to reload plugins without showing them immediatly ?
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
However, it seems that it automatically run the 'aplugins' command, is there a way to reload plugins without showing them immediatly ?
i could add this.

ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 410
    • View Profile
    • Blog & Projects
    • Read more about this member.
    • Donate to Member
Don't rush mouser, I said something stupid, it's nice that farr can unload plugins but I need to unload plugins from my plugin... and it unload my plugin as well. I'm not sure this is the correct approach...
Blog & Projects : Blog | Qatapult | SwiffOut | FScript

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
it would be easy for me to make a function that a plugin can call to unload a specific other plugin and reload it, if that would help.