可动态加载的报告 [英] Dynamically loadable Report

查看:67
本文介绍了可动态加载的报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
这是一个愚蠢的计划:

我需要经常开发报告.它们是不同的要求.我要进行的下一个项目也将具有相同的功能,它们将以多种方式实现.好几次了.

到目前为止,我已经构建的项目都在一个系统中.也就是说,它们都是一起编译的,每当我开发一个新窗口时,我都必须重新执行代码,然后将其交付给客户端(因为我所知道的).无论如何,这次我要进行更改.

这次我想这样做:
我将创建一个通用格式和不同的dll文件,但是使用相同的方法.

说Report1,它将具有通用功能.


创建:将窗口创建为子窗口.
打印:使用打印机打印报告
PDF [可选]:将输出保存为PDF格式

报告2:具有相同功能
创建:将窗口创建为子窗口.
打印:使用打印机打印报告
PDF [可选]:将输出保存为PDF格式

现在在主窗口中:
它将查找所有报告dll将驻留的公共目录.

我将根据报告目录中的可用dll(将如何显示菜单文本不是问题)动态创建菜单列表.

还有一种在主窗口中加载dll并加载通用功能的方法.
它将根据用户要求使用创建功能或打印功能或PDF(如果存在)功能.

我相信这是有可能的.但是我不知道该怎么做.我相信我需要一些基本的指导来实现它.

请帮帮我.

我的英语和我的描述方式不是很好.如果您有任何疑问或疑问,请告诉我

Hi all,
Here is a silly plan:

I need to develop reports frequently. They are different requirements. The next project I am going to make also will have same thing, they will come in several way. in several time.

So far the projects I have build are all in one system. That Is, they are all compiled together, whenever I developed a new window I had to re-execute the code and then delivered it to client(Because that what I know). Anyway, this time I want to make a change.

This time I want to do it like this way:
I will create a common format and different dll files, but with the same method.

say Report1, It will have common functions.

Like
Create: to create the window as child.
Print: To Print The report with printer
PDF[optional]: To Save The output to PDF format

Report 2: with same functionality
Create: to create the window as child.
Print: To Print The report with printer
PDF[optional]: To Save The output to PDF format

Now In the main window:
It will look for the common directory where all the report dll will reside.

I will create a menu list dynamically based on the available dlls(How Menu text will be displayed is not the problem) in the report directory.

And a method to load the dll and load the common functions in the main window.
It will use the Create function or Print Function or PDF(if it exists) function based on user request.

I believe it is possible. But I dont know how to do it. I believe I need some basic instruction to achieve it.

Please help me.

My English and the way I describe is not very good. If you have any doubt or question, let me know

推荐答案

您的主程序应使用 GetProcAddress获取每个所需函数的地址() [ ^ ]并调用它来创建您的报告.像:
Your main program should use the LoadLibrary()[^] function to load the DLL specific to the users report type. Then having obtained the handle to the DLL you can get the address of each required function via GetProcAddress()[^] and call it to create your report. Something like :
if (bFinancial)
    HMODULE hModule = LoadLibrary("FinancialReport.dll");
else if (bCommercial)
    HMODULE hModule = LoadLibrary("CommercialReport.dll");
else
    HMODULE hModule = LoadLibrary("BasicReport.dll");

// ... further processing

FARPROC fProc = GetProcAddress(hModule, "Create");
fProc( ... );


这篇关于可动态加载的报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆