Struggling to display MFC dialog (license entry) DURING OnLoadPlugIn

This works if I defer until later, but I want to be able to return FALSE from the load plugin if the user fails to activate license key. I’m not really an MFC expert, so I’m assuming it has to do with the dialog resource not yet being ready. Any way around this?

Alternatively, If I have to wait until later to do this, 1 - what is the best place, 2 - how do I force unload the plugin on license failure.

Hi @gccdragoonkain,

If your plug-in does not load on startup, then you should be able to display an MFC dialog in your plug-in’s OnLoadPlugIn override.

However, because Rhino can load your plug-in in other way (if you have user data or display a docking panel, for example), it’s best to defer licensing checking until you really need to.

I’ve attached one method you might consider. (27.0 KB)

– Dale

Here’s the followup question. If I defer license checking until later, how do I purposely unload the plugin upon failure?

Once a plug-in is loaded, it cannot be unloaded.

– Dale