Re: Dyn loaded files and owner status window



Or quick and dirty....

Grab the handle of the window from its name (or pass it to the dll from the
exe) and then send nominated events to it. The event handler will call your
class.

Another method is to use sockets / named pipes if the calls are relatively
infrequent.
However, the 'right' solution is as Jon Skeet said, to create an
encapsulated message handler which can pass data from one object to another.
He suggests another dll with events - eminently logical. There are
alternatives including standalone exe/service talking to objects over sockets
/ named pipes / event handlers and (if you are masochistic) interrupts.
--
Paul


"Jon Skeet [C# MVP]" wrote:

> GTi wrote:
> > I have a main exe program that have a status window.
> > This exe program loads several dll files with Assembly.LoadFile.
> > I want now this dll files to send my exe program messages so I can
> > display it
> > on my status window.
> > Is there any way I can call a class in my exe program from dll files?
> > The dll files don't know about the exe files and the exe program that
> > loaded may or may not have a status window.
>
> I suggest you do this using interfaces defined in another DLL -
> interfaces that both your program and your DLLs know about. The easiest
> way would probably be to make the classes in your DLLs implement an
> interface that had an event (or set of events), and then make your main
> program subscribe to those events.
>
> Jon
>
>
.



Relevant Pages

  • Re: DLL and communication from another process exe
    ... It is risky to do cross-thread SendMessage, but if all you want is a bool, then if you are ... If I were doing this in a DLL, I might consider creating a UI thread in the DLL that ... creates an invisible window that handles the communication. ... EXE gets SendMessage from DLL ...
    (microsoft.public.vc.mfc)
  • Re: Editors
    ... some strip them on exe files by default. ... "preferred base address" and, yup, relocations are completely ... DLL files, though, aren't loaded into their own address space but are ... EXE's "entry-point", though, is not "special" in that it's just an ...
    (alt.lang.asm)
  • Re: recognize .Net controls properly and get infos/styles/properties
    ... and convert and compile the source in VS 2005 ... Since the error is not stopping the generation of the .exe and .dll I ... have both .net 1.0 and 2.0 window listed in the treeview. ...
    (microsoft.public.vc.language)
  • Re: DLL pass vector by value crash
    ... The prototype for testfunc is a by-value copy, so it has to make a copy of the value. ... Are you using static linking for either the .exe (if so, it probably won't work correctly, ... clearly using the shared CRT DLL for the DLL you are constructing. ... no crash occurs in either config. ...
    (microsoft.public.vc.mfc)
  • Re: DLL pass vector by value crash
    ... stack of the exe and may allocate default member element on the exe heap. ... If this is a dangerous situation, the simple app I set up calling testFunc() ... in a dll did not crash. ... msvcr90.dll!free and access the source code of free.c. ...
    (microsoft.public.vc.mfc)