Click here to Skip to main content
15,911,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
smesser wrote:
What if I where to use a modeless dialog with a callback function. I could process messages that way or I could use the SendMessage interface I added to my plugin interface. My problem is that when the dialog in the dll comes up Modal then it stops any processing from the parent application.

The plugins can do anything. The plugin I am currently testing with gets the current weather from the internet and displays it. The dialog has buttons for refreshing and returning to the main application. This would be done by remote control. You select for example the back button which would cause the main application to send an ENTER command to the plugin. Well, this is my intention anyways.


Upon reviewing your original post again I saw a possible problem in your implementation: did you remember to start the message pump for the dialog when you created it ? A thread without a message pump can create a dialog, but the dialog won't do anything.

If you use MFC for the dialogs (CDialog derivance), see AfxLoadLibrary MSDN entry for an easy example on how to create the main application's portion of the code. There is an example (In MSDN Library April 2003), which loads a DLL, gets a CView-derived class's runtime info using an exported function, and creates a new document template based on the value returned by the function.

The Dll side would consist of your class definition (.h), and an implementation file. This implementation file has two requisities: it creates an object of the class on it's global level, that is, NOT inside DllMain. Also, it must export a function to return the address of the object.
Or if you would like to use the AfxLoadLibrary example straight on, the exported function would result a RUNTIME_CLASS( Your class name here )

You can use the same approach to pass out any type of class information, even a ready object, if you so please. I am not sure whether the AfxLoadLibrary creates a new thread upon which DllMain of the loaded library executes. In that case, you must be very careful when specifying the main application window as the parent, as inter-thread information may easily become corrupted :I

And yeah, use AfxLoadLibrary instead of LoadLibrary. The MFC version makes sure that main application data is not corrupted.

If you can't get it to work, you can download a small MFC application I made. It uses a DLL to create a dialog and then runs that dialog. See it's source file 'CLoaderApp' for a full description of it's soul life.

Here's a link: www.tpu.fi/~t1akeski/MFC_goes_DLL.zip[^]

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible., for example.
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 
GeneralRe: opengl with visual c++ Pin
Orhun Birsoy10-Nov-03 13:07
Orhun Birsoy10-Nov-03 13:07 
Generalfile system in Mac Pin
pnpfriend10-Nov-03 10:31
pnpfriend10-Nov-03 10:31 

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.