Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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 :
C++
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( ... );
 
Share this answer
 
Comments
Mohibur Rashid 19-Oct-11 5:36am    
Thank you for your quick reply
Richard MacCutchan 19-Oct-11 5:39am    
Happy to help; good luck with your project development.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900