Page 1 of 1

Start PCAN-Explorer from another application

Posted: Wed 19. Mar 2014, 23:46
by hntranbae
I would like to start PCAN-Explorer 5 from another application (i.e. Visual Basic, Visual C#...). What are the dll modules should be included in my application ? The following sample code in the help file does not work

Dim app As Application
Set app = CreateObject("PCANExplorer5.Application")
app.MainWindow.IsVisible = True

Thanks.

Re: Start PCAN-Explorer from another application

Posted: Thu 20. Mar 2014, 12:20
by K.Wolf
To start PCAN-Explorer 5 from Visual Basic, you must add the reference to the PCAN-Explorer type library to your project. E.g. in VBA choose Extras->References and set a check mark on "PCAN-Explorer 5 Shared Objects". Then you can use this code to run PCAN-Explorer:

Code: Select all

Dim app As PCANExplorer5.Application
Set app = CreateObject("PCANExplorer5.Application")
app.MainWindow.IsVisible = True
In C# it is similar: Project->Add Reference, and choose "PCAN-Explorer 5 Shared Objects" on the "COM" tab. To run PCAN-Explorer, use this code:

Code: Select all

PCANExplorer5.Application app = new PCANExplorer5.Application();
app.MainWindow.IsVisible = true;

Start PCAN-Explorer from another application

Posted: Sat 13. Sep 2014, 16:59
by HardyK
Thanks for the solution.

Even after adding the references, which doesn't seem to be mentioned in the Help File, it still doesn't work in VBA at least. Maybe the reason is because there is a subtle difference between the code snippets in the Help File and the posted solution, but I'm not 100% sure.

Help File Code:

Dim app As Application

Forum Post Code:

Dim app As PCANExplorer5.Application


In summary, I am requesting that Help File article "Automating Tasks from other Applications" is updated as follows:

- Please mention which references to add.
- Please check and/or correct the code for app declaration.

Thanks.

Re: Start PCAN-Explorer from another application

Posted: Mon 29. Sep 2014, 13:41
by K.Wolf
OK, we have corrected the example code and mentioned which reference to add.
The updated help file is available with the next release v5.3.5.