开发者

Using MS ReportViewer with MFC

开发者 https://www.devze.com 2023-03-17 00:04 出处:网络
I support a legacy MFC C++ application (VS2005) and I want to call some SSRS reports (MS Reporting Services).I was hoping to use the MS Report Viewer control, but it only works with .Net.I’ve come up

I support a legacy MFC C++ application (VS2005) and I want to call some SSRS reports (MS Reporting Services). I was hoping to use the MS Report Viewer control, but it only works with .Net. I’ve come up with some ideas, but I keep thinking that I’m working against some conventional knowledge. I’m hoping to get a second opinion.

We already have a report server setup (remote server processing). It would be really nice to call reports directly from this MFC application (i.e. show summary report for a customer, etc). Right now, we are currently just calling Internet Explorer directly with parameter(s) in the URL. It’s simple, it works, but it’s rather limiting. For example, I can’t setup printer options.

I’ll mention our project does not compile with the /clr option – we use a few 3rd-party libraries and between those and others we get way too many linking errors. It’s just not feasible to try to get it working with this project.

I came up with an idea of creating a simple c# application that wraps the ReportViewer, and control it via a few command line options (server, report name). However, this doesn’t help too much with parameters – I’开发者_如何学编程d have to come up with some way of sending the parameters and then our wrapper program would have to parse them out, etc.

I also thought about creating a dll and calling it from the MFC, but then I keep thinking that I’ll have the same problem with the parameters again.

It would be really nice if there was a MFC version of the Report Viewer, but any searching I’ve done online turns up nothing. It took me a while just to figure out everything I needed to make the proper calls from my sample c# program. Does anyone have any suggestions?


I decided to just stick with calling Internet Explorer directly for now. In case anyone is wondering how to call IE directly, just read it it's path from the registry into a string and add "/iexplore.exe " to the end.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE

At that location, read the string "Path"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号