Re: Sending a UserRegistered Message from a dll to the main applicaition

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Christopher J. Holland (msnews_at_microsoft.com)
Date: 07/15/04


Date: Thu, 15 Jul 2004 01:59:03 -0700

I am no expert in this area, just interested...

I did a bit of reading and from what I understand, he should be using
HWND_BROADCAST.
The purpose of using RegisterWindowMessage(), is not really knowing the
application that receives the message.
Although, the dll could ask for the handle and post the message using the
handle as well.

By using HWND_BROADCAST;
"The message is posted to all top-level windows in the system,
including disabled or invisible unowned windows, overlapped windows,
and pop-up windows. The message is not posted to child windows."

That would mean the message will only go to the applications Top Level
window
and not some dialog underneath, he would have to handle the message at the
top level,
then dispatch the message further down to the Dialog.
main.exe (could be a dialog based app?)

Something else that I am thinking about, is that when you load a dll, I am
thinking it is just like saying
"new code"
So, if in his example he was to post a message, my thinking is that it would
only go
to the window/thread in which the DLL was called, whatever that may be.
If that is not true, where does the message actually go?

Is my thinking correct?

Thanks,

-- 
Christopher J. Holland [!MVP]
http://www.mvps.org/vcfaq/
http://www.codeguru.com
http://www.codeproject.com
http://www.naughter.com/
http://support.microsoft.com/default.aspx
http://msdn.microsoft.com/howto/
http://msdn.microsoft.com/library/
http://www3.pgh.net/~newcomer
"Anders Eriksson" <anders.eriksson@morateknikutveckling.se> wrote in message
news:w6krysaxxfa5.dlg@morateknikutveckling.se...
> Hello!
>
> I have an MFC 7.1 application that uses a dll. The dll is not MFC it's a
> SDK DLL.
>
> Both the application and the dll is compiled as UNICODE.
>
> I want to send a user registered message from the .dll to the main .exe
>
> I have used
> static const UINT UWM_OUTPORT_MSG =
>
::RegisterWindowMessage(_T("UWM_OUTPORT_{737386A0-62B1-4701-A9D5-436A8C07B83
F}"));
>
> In both the .dll and the .exe
>
> and in the dll i do:
>
> PostMessage(NULL,UWM_OUTPORT_MSG,0,0);
>
> and in the main app I have:
>
> BEGIN_MESSAGE_MAP(CIOOutputDlg, CTabPageSSL)
> ON_REGISTERED_MESSAGE(UWM_OUTPORT_MSG, OnOutPortMsg)
> END_MESSAGE_MAP()
>
> LRESULT CIOOutputDlg::OnOutPortMsg(WPARAM, LPARAM)
> {
> // do something
> }
>
> The OnOutPortMsg method will never be called!!
>
> Please help!
>
> // Anders


Relevant Pages

  • ANN: Our solution to create stand-alone windows software
    ... Dll, Ocx, and any other file to a single exe. ... Stand-Alone Xpress can turn any Windows ...
    (comp.programming)
  • Re: .Net packaging/wrapper application?
    ... it just didn't work well in reality due to DLL ... Windows works is to look in the executable's directory for a needed DLL ... the way apps used to work when they developed Windows. ... Looks to me like Jim is looking for the .NET equivalent of compiling ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Unnown process... 5eplorer.exe
    ... do not remove the cause (a "super"-hidden .dll program) but only remove ... symptom files and registry settings. ... It has all permissions but 'copy' denied to everyone, ... then by using the Windows XP Recovery Console. ...
    (microsoft.public.win2000.general)
  • Re: WinSxS, functional under 2k ?
    ... The newSide-by-Side Assembly technology was introduced with Windows XP to help reduce or eliminate DLL Hell. ... If you recall earlier Windows versions, like Windows 95, when you installed an application you were warned if the installer tried to replace a DLL from the system folder with an older version and you were asked if you wanted to accept the change. ... Until Windows XP it wasn't so easy to use different versions of shared system DLLs, that is what the new Side-by-Side assemblies attempts to resolve. ...
    (microsoft.public.win2000.general)
  • Re: Determine name and path of dropped object?
    ... MDE I would really suggest the use of external DLL to hold the subclassing ... windows after loading the Microsoft Office Visual Basic Editor, ... Public Declare Sub DragAcceptFiles Lib "shell32.dll" _ ...
    (microsoft.public.access.modulesdaovba)