ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  runtime problems
Posted by Andrew on Apr-13-2013 00:48
I'm trying to get the VBA runtime working without the need to install ChartDirector. I'm working with 5.1.1 and have both a dev and runtime license....I've had no luck so far. I'm working with Windows 7 machines (both x64 and x86)....I'm looking to do this without the installer because I need to be able to install this on client machines without envoking a UAC prompt. The machines are all run using users in the "users" group, so they don't have write access to things like HKLM.

When I try just following the directions in the help file, I still can't get it working. I get a runtime error 429....The only way I've managed to get it working so far is to run that installer, which isn't going to be an option for me in the end.

Do you have any suggestions?

  Re: runtime problems
Posted by Peter Kwan on Apr-13-2013 01:48
Hi Andrew,

ChartDirector is a COM/ActiveX component, and can be installed like any other COM/ActiveX component. It can be installed and use in the same way as standard VB component or controls .

In Microsoft's original design, all COM/ActiveX components must be registered in the registry in order to be used. This applies even to Microsoft's own components or controls. In your case, you mentioned you are using "VBA" (as opposed to VBScript or VB6). So in your case, may be you can assume your clients have already installed a certain application first, before running your program, so you do not need to worry about installing the Microsoft components or controls.

Since Windows XP SP2, Microsoft has introduced a feature to allow an EXE to use COM/ActiveX components without registration. See:

http://msdn.microsoft.com/en-us/library/ms973913.aspx

http://stackoverflow.com/questions/3566355/registration-free-com-objects-on-windows-7-64bit

In brief, you can include a mainfest file with the same name as the EXE, and before the operating system runs the EXE, it will read the mainfest to learn about which components are in which DLLs.

Note that the above only works for EXE. If your application is not an EXE, then you may need to use the Windows API CreateActCtxW and ActivateActCtx to dynamically load the manifest. For example, if your VBA is an Excel file, you certainly cannot add a MANIFEST for the Microsoft Excel.EXE. In this case, in your VBA, before using ChartDirector, you may use CreateActCtxW and ActivateActCtx to load the mainfest.

If you use CreateActCtxW and ActivateActCtx to load the mainfest, it means you must load ChartDirector after you have loaded the manifest. Whereas this is fine for components (like ChartDirector.API), if you use ActiveX controls (like ChartViewer.ocx), many VBA systems will load the controls immediately when the document is opened, before running any VBA code. That means the control will be loaded before you have a chance to use CreateActCtxW and ActivateActCtx and so the control would not be loaded successfully. (I am not sure if it is possible to dynamically create the ActiveX control. May be some VBA systems allow that.)

I happened to have an example for VB6 (which is an EXE) and also an example for Excel (which uses ChartDirector to create charts and display using a standard PictureBox control, and so does not need to use the ChartViewer). If you need them as a reference, please let me know.

Regards
Peter Kwan

  Re: runtime problems
Posted by Andrew on Apr-13-2013 02:30
Thanks Peter - I don't know that this will apply in my case though, since I won't have an exe (I'm using VBA). The PictureBox idea might be of use though...except I assume that that would rule out using tooltips via imagemaps.

I guess my main question is/was, why can't I get the runtime going without the installer? I mean, shouldn't I be able to follow those instructions in the help file and get it working? That would at least be a first step....I have read about ways to register ActiveX components to HKCU, but they won't work for me right now because I can't even get it working using regsrv32 as per the instructions....

  Re: runtime problems
Posted by Andrew on Apr-13-2013 02:47
Oh wait - I see what you're saying about the manifest...I'm using Access, so I'd have to distribute the manifest with Access runtime, I guess. I'd still like to know why I can't get it working with just the steps in the help file....If I could get that going, then I might be able to get it working via HKCU, in which case I'd have everything solved!

  Re: runtime problems
Posted by Peter Kwan on Apr-16-2013 00:40
Hi Andrew,

It should be possible to install ChartDirector without an installer (or without using our installer). There is nothing that our installer can do while the user cannot do.

First, please verify if your system works if ChartDirector is installed with our installer "chartdir_com.exe". This is to confirm that ChatDirector does work with your VBA system in Windows 7 64-bit.

If the above works, then it should be possible to installl ChartDirector manually or without our installer.

To get started, may be you can perform the following test:

(a) Copy "all files" from "c:\\Program Files (x86)\\ChartDirector\\lib" to the "c:\\Program Files (x86)\\ChartDirector\\lib" directory in your target Window 7 64-bit machine.

(b) Copy "chartviewer.ocx" and "msvbvm60.dll" to "windows\\SysWoW64".

(c) Use "Run As Administrator" to open a command prompt. Go to "windows\\SysWoW64" and run "regsvr32 SysWoW64" and "regsvr32 chartviewer.ocx".

(d) Go to "c:\\Program Files (x86)\\ChartDirector\\lib", and run regdll.bat. It ChartDirector is working, it should pop up a window that shows the ChartDirector version.

(e) You may copy a command line sample code from "c:\\Program Files (x86)\\ChartDirector\\vbsdemo\\simplebar.vbs" to a non-system directory (eg. "c:\\abc"), then run it by using "cscript simplebar.vbs". If ChartDirector is working, it should produce a file "simplebar.png", which is a simple bar chart.

If you encounter any error, please kindly let me know what is the error message.

There are some things you may need to note in 64-bit Windows:

(i) The chartviewer.ocx is basically a VB6 control. Like all VB6 control, it can be used in VBA, but in 32-bit only (as VB6 is 32-bit only). So the VBA (MS Access) must be 32-bit. The OS itself can be 32-bit or 64-bit. If ChartDirector works using our own installer "chartdir_com.exe", then it can confirm it works with your VBA on Windows 7 64-bit.

(ii) If you are not using ChartViewer.ocx (eg. you are using PictureBox to display the chart), then the MS Access can be 32-bit or 64-bit. In this case, you would need to use the regdll.bat that comes with ChartDirector (in the same directory as the other ChartDirector DLLs) to register ChartDirector.API for both 32-bit and 64-bit operation. (The regsvr32 method mentions in our documentation only register ChartDirector for 32-bit operation.)

(iii) If you are using 32-bit MS Access and wants to use ChartViewer.ocx, note that in 64-bit Windows, the [system32] for ChartViewer.ocx and the Microsoft VB runtime msvbvm60.dll refers to the "%SystemRoot%\\SysWoW64" subdirectory (not the  "%SystemRoot%\\system32" subdirectory. See:

http://en.wikipedia.org/wiki/WoW64

If you are using an installer (either our installer, or an installer created by you), 64-bit Windows will automatically redirect "%SystemRoot%\\system32" to "%SystemRoot%\\SysWoW64", so there is nothing an installer needs to do to specifically handle 64-bit Windows. However, if you are simply copying files using a batch file or is installing manually, please ensure the correct directory is used.

I believe there is also registry redirection, which is automatically performed by 64-bit Windows. See:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384232(v=vs.85).aspx

As registry redirection is automatic, normally, there is no need to worry about it. However, if you are modifying the registry directly (instead of using regsvr32 or equivalent methods to register components), you may need to double check the correct registry location to use.


Please kindly let me know what is the result.

Regards
Peter Kwan

  Re: runtime problems
Posted by Andrew on Apr-20-2013 02:13
So I just tried your steps to manually install and it's not working. When I try either your "simplebar.vbs", or my own VBA project (n Access) it's not working...again, this works fine when I use the installer.

The error I get from the vbs is "unknown runtime error: 'CreateObject'. The error I get in VBA is a generic one - "error 59999, application-defined or object-defined error". In VBA, this is happening the moment my code tried to do anything with CD. So, it's the line:

set c = cd.XYChart(800,600)

If I watch the cd variable (which is set using "Dim cd as New ChartDirector.API") it's saying that the object variable isn't set. When I look at the references, I see ChartDirector and aspapi 1.0 Type Library - both of which look to be fine. Nothing says 'missing'....

Any thoughts?

I'm thinking that using the manifest method would be best for me in the end, since I need to get this going on computers without admin rights. That said, I think it would be nice to get my test system working as we'd normally expect it to.

On the manifest thing - how do I create a manifest for these? I'm ok with not using the ocx, if need be...if that's going to absolutely HAVE to be in system32, then it's not going to work for me due to the security thing.

  Re: runtime problems
Posted by Peter Kwan on Apr-20-2013 16:15
Hi Andrew,

If things work fine with the installer, then it should be possible to install manually. We just need to perform the same steps that the installer does. (There is nothing that the installer can do that we cannot do manually.)

I have just tried myself starting from a brand new Windows 7 x64, and install ChartDirector without using the installer. It works normally in my case if I use the administrator account to perform the registration. I can reproduce your error only if I left out the file "chartdir??.dll". Also, I cannot register the components by using a "Standard User" account (an account without Administrator rights).

So for your case, when you mentioned it works fine with the installer, are you executing the installer with administrative rights? For the manual steps, are they performed with adminsitrative rights or not?

The followings are what I have done:

(a) Copy all files in "ChartDirector\\lib" to the Windows 7 machine. The files include comchartdir.dll, aspapi.dll, chartdir51.dll, cdreg64.exe, cdinfo.hta and regdll.bat. In my case, the aspapi.dll and chartdir51.dll are both dated Oct 25, 2012. (The date may show Oct 25 or Oct 24 depending on your time zone.) Older versions of aspapi.dll (the ones included in ChartDirector 5.0) may use chartdir50.dll instead of chartdir51.dll.

Note that if you copied files from a place that is not fully trusted by your Windows 7, the Windows 7 may block the DLLs from working. In this case, please unblock it. This is by right clicking on the file, selecting Properties, and clicking the Unblock button. (This Windows 7 security feature is the same for all DLLs and is not specific to ChartDirector.)

(b) Open a command shell, go to the directory that contains the ChartDirector DLLs, and run:

regsvr32 comchartdir.dll
regsvr32 aspapi.dll

In both cases, it should pop up a message box that says "DllRegisterServer in [dll_name] succeeded".

After the above, ChartDirector should run normally in 32-bit mode. To test it, I enter "cdinfo.hta", and it successful pop up a screen that displays the ChartDirector version. Seeing that screen usually means that ChartDirector works correctly.

(c) For further testing, I copied the script "simplebar.vbs" to an empty directory "c:\\test", and run "c:\\windows\\SysWoW64\\cscript simplebar.vbs" and it works normally (no error message). The "SysWoW64" is to ensure the script is run in 32-bit mode.

(d) Then I go back to the directory that contains the ChartDirector DLLs, and run "cdreg64 /r".  This extends the ChartDirector registration to run in 64-bit mode. After that, I can use both "cscript simplebar.vbs" (which will invoke the 64-bit cscript interpreter) and  "c:\\windows\\SysWoW64\\cscript simplebar.vbs".


Note that I perform all of the above steps with the Administrator account, as the "Standard User" account does not work with the above steps. I am not sure if it is possible to install usng the "Standard User" account. (If if it is possible, it probably would not be using the above steps, but by directly adding entries into the registry.)


For the MANIFEST method, may be you can try the followings to confirm if it works first:

http://www.advsofteng.com/regfree_excel.zip

The above is an Excel VBA example I did quite a while ago based on ChartDirector 5.0 by following Microsoft documentation. It works normally in every machine that I have tested. If you confirm that it works in your case as well, we can always modify the configuration to ChartDirector 5.1 and porting the CreateActCtxW and ActivateActCtx code to MS Access.


Regards
Peter Kwan

  Re: runtime problems
Posted by Andrew on Apr-23-2013 22:25
The manifest method works - Rather than spending time on trying to figure out why it's not working to manually install, considering that I won't be able to use the ocx anyway in my case, this seems like the way to go for me.

Now the question is, how do I get the right manifest file for CD5.1? Or would it just be the same as the one in your example for 5.0? I tried just changing the "version" in cd.config to 5.1.0.0 and leaving everything else the same, but I get an error from CreateActCtx saying "invalid_handle_value" followed by an ActiveX runtime.

Obviously, I also changed the path in the code to reflect where my stuff is, and modified it to work with Access....It's working on my own machine without a runtime, but not my test machine (the one with only "user" access). I'm guessing that's because on my own machine, I actually have CD installed....

  Re: runtime problems
Posted by Andrew on Apr-24-2013 01:04
Scratch that - I got it working with the manifest! Stupid mistake...