Link to home
Start Free TrialLog in
Avatar of apostrophe27
apostrophe27

asked on

Add menu items or buttons to a GUI from a dll

I have an MFC GUI program that's distributed throughout the company. Every month or two, a new device comes in that the program has to work with, and I issue a new dll for that device and it uses the GUI as the interface. Then everyone who needs to work with the new device adds the new dll and the front end stays the same.

With the newest device, I'd like to add a new menu selection, or at least 2 radio buttons, to the GUI. Can I do this from the dll? I'm trying to avoid having everyone update the GUI.
Avatar of tbsgadi
tbsgadi
Flag of Israel image

Avatar of js-profi
js-profi

you can't do it with reasonable efforts. the handlers for the radio buttons or menu items should be added to the class they belong to. and the resource should also be updated.
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can put an entire dialog or multiple-page PropertySheet in a DLL.  It can have as many radio buttons and other hoo-ha as you want.
But it will be difficult to change the actions of the main EXE retroactively by modifying only the DLL.
Hi
One solution sketch can be:
The DLL expose a Function to retrieve Any specialized Items.
The Exe call this function and if NULL is returned just use the standard menu.

But to keep backwards compatibility, your EXE have to check a DLL version number or if the DLL support  this function exist before calling it.  
use  getprocaddress
http://msdn.microsoft.com/en-us/library/ms683212%28VS.85%29.aspx
 
good luck

-Lars


Extending the solution provided by DanRollins the following can be done.
Your existing MFC GUI program may be developed using MFC ATL project or simply MFC DLL. Then add new resource dialog (Right click on the project, select Add-> Resource) and place whatever control you want. Create an class of the resource dialog.
Now in case of ATL project you need to write an method that invoke the dialog. This method will be part of the existing interface.
And in case of MFC DLL write an exported function __declspec (dllexport) and invoke the dialog in this function.
Then the EXE program that use this DLL can call this specific method to show the dialog.
This is what we can understand from your query and also please let us know how did you create your existing MFC GUI program.