المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : DLL, EXE, dialog question



C++ Programming
01-30-2010, 01:00 AM
The outline of the problem:
I have an exe which will be displaying the status of various pieces of remote equipment in the form of icons and screens.
The remote equipment is NOT defined at this stage so I want a DLL which I can NAME in a setup file, load, and which has a standard interface to my main exe. The interface (at the moment) is 'load', 'giveMeStatusIcon', 'updateStatus' (largely so I can force the change of the status icon), 'showStatusScreen'

The basics of loading a DLL from a name, getting the interface, calling the functions above all work. I can on my 'exe' screen show the returned status icons - these icons are resources in the dll and returned as icons for my exe to display

The problem comes when I ask it to show the status screen. This screen is defined in the DLL resource, and thats the way I want it - I don't want my exe to have to worry about what is in that DLL screen, what it does or how it does it. The DLL gets called, loads the dialog resource ok, but the DoModal call causes an assert - the DLL is not a CWinApp so DoModal can't apparently work.

I guess one possible way is to stop creating a DLL and create an EXE, start that and setup some inter process comms to deal with the communication. But I would much rather stick to the plan of using a DLL.

Does anyone have any suggestions?

Note I do NOT want to write all possible remote device DLL's now and start putting .h files in my exe, I want to stick to the basic idea of having these as items I can develop next month, next year, or whenever and use frmo my exe via loading of a dll file with a fixed API (at least to my exe) at run time.