Page 2 of 2

Re: Building c# sample plugin

Posted: Mon 16. Sep 2013, 12:47
by K.Wolf
Hi,

I think I worked it out.

The assembly version is stored in the file Resources\Main.res. We had to add a non-.NET resource file to the project that contains some bitmaps and strings - PCAN-Explorer looks for these resources when it loads the Add-in. It appears that if such a .res file is added, .NET ignores the version numbers in the Assembly Information and expects a version resource instead. Therefore we had to include the version information in the .res file as well. Just open the Main.res file in the IDE and change the version numbers there.

The other problem concerning the blank tab is caused by a failed assembly registration. The assembly must be COM-visible so that PCAN-Explorer can load the controls contained in the assembly. COM visibility requires that some registry keys must be written under HKEY_LOCAL_MACHINE during registration, which is only possible with administrator privileges. To correct the registration, do the following:
1. Open the Add-in Manager dialog box and unload the .NET sample DLL
2. Restart PCAN-Explorer with administrator privileges
3. Open the Add-in Manager dialog box and set the check mark for your Add-in, press OK.
Now the assembly registration should succeed and when you use the Add-in the tab should no longer be blank.

Regards

Re: Building c# sample plugin

Posted: Fri 20. Sep 2013, 16:17
by PCANUser
Thanks once again for the useful information. I had spotted the issue with the resource file but I wasn't aware that PCAN Explorer had to be run as administrator to update the plugin.

Just to clarify, can you confirm that it doesn't matter whether the user has administrator rights on the machine, you always have to run PCAN Explorer as administrator to update the plugin?

Thanks,
Richard

Re: Building c# sample plugin

Posted: Mon 23. Sep 2013, 08:43
by K.Wolf
Hi,

beginning with Windows Vista, you have to start an application explicitly with "Run as Administrator" to gain write access to the HKEY_LOCAL_MACHINE part of the registry. To be logged in with an administrator account alone is not sufficient.
Therefore, the answer is yes.

Re: Building c# sample plugin

Posted: Fri 15. Nov 2013, 10:56
by PCANUser
Hello,
One final update. The plugin is now working well and our users are finding it very useful.

It would be nice in future if .NET 4 support was added to PCAN Explorer as you suggested in an earlier post. Also
having to log in as administrator to install / update the plugin is a bit of a pain.

Thanks for all your help in getting my issues sorted.

Regards,
Richard

Re: Building c# sample plugin

Posted: Mon 18. Nov 2013, 09:38
by K.Wolf
Hi,

thanks for the feedback.
Support for .NET 4 is already implemented and will be released in upcoming PCAN-Explorer 5.3.3, hopefully until the end of this week.
Concerning the administrator log-in: The process of registering an Add-in will always require Administrator privileges, since the required registry entries must be added to the HKEY_CLASSES_ROOT branch. But the process of adding an Add-in will be made a little bit easier in one of the next releases: it won't be necessary to restart PCAN-Explorer itself as administrator. But when adding an Add-in, a separate process will be spawned that will trigger the Administrator login (or the UAC prompt if you already are logged in as administrator).

Regards
K.Wolf

Re: Building c# sample plugin

Posted: Fri 13. Jun 2014, 12:07
by naitsoco
Hi,

I'm trying to do the same thing which is creating an Add-in for Pcan explorer that will allow me to receive and send messages on PCan explorer, and i would really appreciate your help.