Click here to Skip to main content
15,902,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: IsWindow(m_hwnd) returns 0. Pin
Dave Bryant10-Nov-03 17:14
Dave Bryant10-Nov-03 17:14 
GeneralRe: IsWindow(m_hwnd) returns 0. Pin
suninwater10-Nov-03 19:24
suninwater10-Nov-03 19:24 
GeneralRe: IsWindow(m_hwnd) returns 0. Pin
Dave Bryant11-Nov-03 8:26
Dave Bryant11-Nov-03 8:26 
GeneralRe: IsWindow(m_hwnd) returns 0. Pin
MultiThread10-Nov-03 17:27
MultiThread10-Nov-03 17:27 
GeneralRe: IsWindow(m_hwnd) returns 0. Pin
Swinefeaster10-Nov-03 18:19
Swinefeaster10-Nov-03 18:19 
GeneralCDialogBar Background color Pin
asierra10-Nov-03 16:21
asierra10-Nov-03 16:21 
GeneralDesign opinions/help needed Pin
Steve Messer10-Nov-03 16:06
Steve Messer10-Nov-03 16:06 
GeneralRe: Design opinions/help needed Pin
Antti Keskinen11-Nov-03 11:21
Antti Keskinen11-Nov-03 11:21 
I'll try to approach this problem from a perspective more closer to mine.

So, let's formulate that you have a standard Windows application, with a dialog as a main window. Okay, your application now loads two DLLs into it's address space. After these DLLs are loaded, you need to use GetProcAddress to get an address of an exported function, which you can then call from your application.. Correct ? No ?

Are your plugins supposed to act as little programs of their own ? Then you need to create a new thread and post the function to execute on that thread for the thread creator. For example, the Kernel creates a thread and specifies your 'WinMain' function to execute there. You can do the same: get the exported (worker) function from the DLL, and use it's address to start a new thread. Your function, then, can do anything it wants from just returning 'SUCCESS' to starting a message pump and creating a window. This is called multi-threading application, and is something I don't know much of. I've never needed it so far Smile | :)

You said that the plugins are represented as dialogs. So, let's assume you define a class for this dialog, a derived CDialog, for example. Then, you declare a global object in the 'DllMain', and use 'GetProcAddress' to get the address of an exported function, which does nothing more than return the address of this global object.

Here's the general flow chart:

Application XYZ starts -> App maps a DLL using LoadLibrary -> The DLLs DllMain routine creates a dynamic/static CMyDialog object -> The app uses GetProcAddress to get an exported function from the DLL and calls it -> This function returns the address of this object

App can now, in combination with the header file of the object, call dialog's member functions (Create / DoModal) and start it. Make it modal, specify your application window as parent, and vot, you got yourself an ordinary dialog Smile | :)

I believe using MFC classes this way requires a bit more thought, though, but this is the general idea. I am unsure how it works, look up MSDN for more help.

On the alternative, you can use the multi-threaded solution to create seperate threads for your plugin dialogs (Like, small applications with dialog as main window), then use SendMessage to send messages to these windows.

If this is not the idea you're after, then could you clarify more of your ideas. What is it that your plugins need to do ? Why are they placed in external DLL plugins ? Why just not objects inside your main application class ?

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Design opinions/help needed Pin
Steve Messer11-Nov-03 18:05
Steve Messer11-Nov-03 18:05 
GeneralRe: Design opinions/help needed Pin
Antti Keskinen12-Nov-03 8:25
Antti Keskinen12-Nov-03 8:25 
GeneralRe: Design opinions/help needed Pin
Steve Messer12-Nov-03 12:07
Steve Messer12-Nov-03 12:07 
GeneralRe: Design opinions/help needed Pin
Antti Keskinen13-Nov-03 0:44
Antti Keskinen13-Nov-03 0:44 
GeneralRe: Design opinions/help needed Pin
Steve Messer13-Nov-03 1:35
Steve Messer13-Nov-03 1:35 
GeneralRe: Design opinions/help needed Pin
Antti Keskinen13-Nov-03 5:17
Antti Keskinen13-Nov-03 5:17 
GeneralRe: Design opinions/help needed Pin
Steve Messer13-Nov-03 7:18
Steve Messer13-Nov-03 7:18 
GeneralOnGridEndEdit and MessageBox Pin
adonisv10-Nov-03 12:48
adonisv10-Nov-03 12:48 
GeneralFILETIME compilation error Pin
rmnowick10-Nov-03 12:31
rmnowick10-Nov-03 12:31 
GeneralRe: FILETIME compilation error Pin
Dave Bryant10-Nov-03 14:04
Dave Bryant10-Nov-03 14:04 
QuestionHow to change a toolbar bitmap image? Pin
ElizabethC10-Nov-03 11:08
ElizabethC10-Nov-03 11:08 
AnswerRe: How to change a toolbar bitmap image? Pin
Roger Allen11-Nov-03 0:40
Roger Allen11-Nov-03 0:40 
GeneralRe: How to change a toolbar bitmap image? Pin
ElizabethC12-Nov-03 6:47
ElizabethC12-Nov-03 6:47 
GeneralRe: How to change a toolbar bitmap image? Pin
Roger Allen12-Nov-03 6:49
Roger Allen12-Nov-03 6:49 
GeneralRe: How to change a toolbar bitmap image? Pin
ElizabethC12-Nov-03 10:49
ElizabethC12-Nov-03 10:49 
Generalopengl with visual c++ Pin
bik10-Nov-03 10:48
bik10-Nov-03 10:48 
GeneralRe: opengl with visual c++ Pin
Andrew Walker10-Nov-03 12:24
Andrew Walker10-Nov-03 12:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.