Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Add menu items or buttons to a GUI from a dll

Posted on 2010-01-07
6
Medium Priority
?
350 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:apostrophe27
6 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 26200782
0
 
LVL 7

Expert Comment

by:js-profi
ID: 26201066
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.
0
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 26201580
If the radion buttons are permantently available on the main GUI then you would have to recode it anyway to support that.  If they can be on a modal dialog that could reside in the dll (assuming the main app calls a function in the dll for settings).
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 49

Expert Comment

by:DanRollins
ID: 26207643
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.
0
 
LVL 4

Expert Comment

by:lhl60
ID: 26207943
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


0
 
LVL 1

Expert Comment

by:pibarale
ID: 26272370
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.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Screencast - Getting to Know the Pipeline
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question