Re: Create report in class library
Posted: Mon Sep 08, 2014 1:09 pm
Ok, I spent some time searching for the problem and digged deeper into your sourcecode ( Sorry for that!
) to find a solution for our project, where the customer wants to use your reporting library.
Just another thing I found out:
If you set the output type of ProIT's ClassLibraryWithReportGen to "Windows-Application" everything works. But that can not be the solution!
It looks like there is something wrong with getting the Localization path from the registry on 64bit systems.
This should be changedto this
to get it working on 32bit machines.
And the phkResult in this functionshould be changed to use an uint according to http://www.pinvoke.net/default.aspx/adv ... gopenkeyex => - Changed IntPtr to UIntPtr: When invoking with IntPtr for the handles, you will run into an Overflow. UIntPtr is the right choice if you wish this to work correctly on 32 and 64 bit platforms.
And in your latest version which is compiled against .Net 4.0 you should use the new framework methods to get registry keys:
I don't know why there is a difference between Library-Class and Windows-Application and why it works without debugger. This is your task to find it out 

Just another thing I found out:
If you set the output type of ProIT's ClassLibraryWithReportGen to "Windows-Application" everything works. But that can not be the solution!
It looks like there is something wrong with getting the Localization path from the registry on 64bit systems.
This should be changed
Code: Select all
RegistryKey registryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("\\SOFTWARE\\Stimulsoft\\Stimulsoft Reports");
Code: Select all
RegistryKey registryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Stimulsoft\\Stimulsoft Reports");
And the phkResult in this function
Code: Select all
internal static string GetRegKey64(UIntPtr inHive, string inKeyName, Registry.RegSAM in32or64key, string inPropertyName)
{
int phkResult = 0;
try
{
if (0 != (int) Registry.RegistryWOW6432.RegOpenKeyEx(Registry.RegHive.HKEY_LOCAL_MACHINE, inKeyName, 0U, (int) (Registry.RegSAM.QueryValue | in32or64key), out phkResult))
return (string) null;
And in your latest version which is compiled against .Net 4.0 you should use the new framework methods to get registry keys:
Code: Select all
RegistryKey registryKey;
if (Environment.Is64BitOperatingSystem == true)
{
registryKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
}
else
{
registryKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
}
