473,594 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with managed C++/.NET/windows form viewer

Hello, all...

I am attempting to write a managed c++ dll that will open a crystal
report in the windows form viewer. For various reasons, I need to be
able to write this in C++ w/MFC as opposed to C#. The code below is
called when the user doubleclicks an entry in a tree control. The
first time the user doubleclicks this entry, the code below works
wonderfully. However, the second time the user doubleclicks, the
windows form viewer flashes the report on the screen for a split
second, then disappears. It appears that the code below works fine on
the odd-numbered invocations, but the even numbered invocations act as
described (i.e. the code below works every other attempt, but on the
attempts when it doesn't work the viewer flashes on the screen for a
split second). Also, it seems like the destructor never gets called
(perhaps this is a symptom of the problem???) I have never worked
much with managed code or .NET, so any advice or help would be
appreciated.

Thanks,
Dean
__gc class ViewForm : public System::Windows ::Forms::Form
{
private:
CrystalDecision s::Windows::For ms::CrystalRepo rtViewer
*crystalReportV iewer1;
ReportDocument *crReportDocume nt;
public:
ViewForm()
{
MessageBox(NULL , "CONSTRUCTO R", "TEST", MB_OK);
InitForm() ;
}
~ViewForm()
{
MessageBox(NULL , "DESTRUCTOR ", "TEST", MB_OK);
Dispose() ;
}
void InitForm()
{
#pragma push_macro("new ")
#undef new
crystalReportVi ewer1 = new
CrystalDecision s::Windows::For ms::CrystalRepo rtViewer();
#pragma pop_macro("new" )
crystalReportVi ewer1->ActiveViewInde x = -1;
crystalReportVi ewer1->Dock =
System::Windows ::Forms::DockSt yle::Fill;
crystalReportVi ewer1->Name = "crystalReportV iewer1";
crystalReportVi ewer1->TabIndex = 0;
Controls->Add (crystalReportV iewer1);
WindowState =
System::Windows ::Forms::FormWi ndowState::Maxi mized;
Load += new System::EventHa ndler (this, ViewForm_Load);
}
void ViewForm_Load(S ystem::Object* sender, System::EventAr gs* e)
{
#pragma push_macro("new ")
#undef new
crReportDocumen t = new ReportDocument( );
#pragma pop_macro("new" )
crReportDocumen t->Load("C:\\Repo rts\\test.rpt") ;
crystalReportVi ewer1->ReportSource = crReportDocumen t;
}
};

extern void EXPORT testReportViewe r()
{
AFX_MANAGE_STAT E(AfxGetStaticM oduleState());
Application::Ru n(new ViewForm());
}
Nov 16 '05 #1
4 2349
Hi Dean,

Thanks for your post. Please refer to the following sample which
demonstrates opening a crystal report in the windows form viewer.
C++ .NET Windows Application - Accessing Subreport
http://support.crystaldecisions.com/...s/cppnet_win_s
ubreport_basic. exe.asp

The following article lists more .NET Crystal Report sample in C++ .NET.
Crystal Reports: Listing of .NET Sample Applications in C# and C++ .NET
http://support.crystaldecisions.com/...s/apps_net.pdf

In addition, please be noted that "Microsoft supports setup and
installation for the Crystal Reports products that are included with Visual
Studio .NET. All other support is provided by Crystal Decisions."
(described in the KB article 317789 below). So I recommend you contact
Crystal Decisions to check whether there is any known issue on their side.

INFO: Licensing and Support for Crystal Reports for Visual Studio .NET
http://support.microsoft.com/?id=317789

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #2
Hello Dean,

Did the information I posted last time help you resolve the problem?

I look forward to your response.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #3
Tian,

Thanks for responding to the original message. The site you posted
did not help me much, but I did find a solution through other means.
I was attempting to open my class with Application::Ru n, but instead I
should have used the ShowDialog() method. Now my application works
great!

Thanks again,
Dean
Nov 16 '05 #4
Hello Dean,

I am very glad to hear that you have resolved the problem! :-)

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
276
by: Lars Grøtteland | last post by:
Hello! Could anyone help me please. I tried the following - I created an application in .NET 2003. The project is a MFC Application a CDialog. I ran the application fine. I changed the properties for the app - so I should use Managed Code (Use Managed Extensions = YES). It still ran fine. I should now be able to add new things like Windows Forms. Am I right? You see I tried to add a Windows Form(:NET) item in my app, but when I tried...
2
1981
by: Andrew S. Giles | last post by:
OK, Ive run my head into this wall for too long. I need help. I am developing an applicaiton in C# to present a user with a GUI to specify a configurable list of machines that he wants to listen to the output of. Specify a filename to shove all of the data (into Excel), and start the whole thing going. I get that done no problem. The problem comes with the Data. The data is coming from a different application, and I am not 100% sure of...
18
1526
by: MuZZy | last post by:
Hi, I got a situation here :) an dwonder if someone can help me. I have an MDI app and say, the child form has a button, clicking on which calls a database transaction - grabbing a lot of tables to the form's TDataSet variable. One transaction grabs about 10 or more Mb of data. If i do several transactions, the memory occupied by the app goes say goes up to 180Mb - i watch it in Task Manager. Now i close the child form, and...
1
1939
by: Dean Poling | last post by:
Hi, all... I posted this in the Crystal Decisions user forums with no solution, so here goes: I have created a managed c++ dll that contains a crystal reports viewer constructed with the windows form viewer and the native crystal libraries included in vs.net. I want my users to be able to export a displayed report to a file, and as luck would have it the default crystal reports viewer has an export button that opens a 'save as'
4
2479
by: nick | last post by:
hi I'm tryin to write a program that keeps track of the contents of the clipboard to a textbox, but i keep getting "An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication4.exe" error. here is the sample code Public Class Form1 Inherits System.Windows.Forms.Form Public Declare Function SetClipboardViewer Lib "user32" Alias "SetClipboardViewer" (ByVal hwnd As Long) As Integer
10
8301
by: Sylvain Audet | last post by:
Hello! We have a Windows application that is using Crystal Reports reports containing Barcode fonts. Those reports are called through reflection into a Crystal Report Viewer and we need to have the Barcode fonts to be self-installed at runtime whenever a report is viewed. I tried the following steps: Public Shared Sub InstallFonts()
3
2428
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an object :(((( Anyone pls help me to solve this problem!!! thanks in advance,
3
5517
by: Adam Clauss | last post by:
We have a Windows service written in C#. As of late, it has started crashing after running for as little as 2 minutes. I have a handler for AppDomain.UnhandledException which does NOT get called in case (it is setup correctly - I have seen it called in other places). The only error information I get is from Event Viewer: Faulting application rtmsdriversvc.exe, version 2.2.2.0, stamp 45ed8d14, faulting module kernel32.dll, version...
1
2337
by: bh | last post by:
I have a vb.net 2003 front-end, which is a crystal report (8.5) viewer/generator. When trying to export the crystal report to excel spreadsheets, today, which has always been successful, up until this week, the following error is generated: Crystal Report Windows Forms Viewer: Error in file (myreport.rpt): Error detected by export dll My only guess is that a windows-update (we've had 2 this week) did something to affect the built-in...
0
7877
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8253
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8009
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8240
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6661
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3867
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.