Posted on 2000-04-26
Last Modified: 2013-12-04
const UINT CWndExcel::WM_GETNAVINFO = (0xC111); //::RegisterWindowMessage(_T("WM_GETNAVINFO"));

I have one dialog app(MFC based but question is Windows Q);
I also have a dll that loads to excel and subclass excel. I want to send message from
excel_subclassed window  to dialog window.

if I use above a value WM_USER + x
I get the message.
if I use WM_APP + x < 0xc000
works fine
but if I use RegisterWindowMessage
to get my message no
for example the one I get is 49597
between 0xc000 and 0xffff
I dont receive the message.
both windows has exactly the same message no, but no response ????
this is windows 2000, I also randomly
selected (semi random) 0xc111,
that did not work. it seems if message no >= 0xc000 it fails ??
what to do ???
Question by:hasmet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

GlennDean earned 300 total points
ID: 2753369
You can't declare the WM_USER message handler the same as for those of a RegisterWindowMessage.  
  The macro you must use is

LVL 15

Expert Comment

ID: 2753493
const UINT CWndExcel::WM_GETNAVINFO = (0xC111); //::RegisterWindowMessage(_T("WM_GETNAVINFO"));

That is wrong.

You have to call RegisterWindowMessage both in the dll and in your app and use the returned value, but not the hard-code it.

This line must be BOTH in the dll and in the app:

const UINT CWndExcel::WM_GETNAVINFO = ::RegisterWindowMessage(_T("WM_GETNAVINFO"));


Author Comment

ID: 2755186
Yes of course, I am sorry if I confuse you but that is exactly what I do.
when it did not work then I started putting hard code values.
im my app I use
const UINT CMyDlg::WM_GETNAVINFO = ::RegisterWindowMessage(_T("WM_GETNAVINFO"));

in dll
const UINT CWndExcel::WM_GETNAVINFO = ::RegisterWindowMessage(_T("WM_GETNAVINFO"));

this is the the way it does not work??
so when I try hard code values,
instead of creating them with
RegisterWindowMessage, then it works if values are less than 0xc000.
above 0xc000, it doesnot work and this is the range of RegisterWindowMessage
anyway ??? so it seems RegisterWindowMessage range is infeasible???

I delibaretly commented out
RegisterWindowMessage in my question above to test some hard code values.

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 23

Expert Comment

ID: 2755897
Have you tried using Spy++ to see if the message is indeed sent?

Author Comment

ID: 2757077
Adjusted points from 200 to 300

Author Comment

ID: 2757078
SPY++ SHOWS THAT message is send;
0038038A S message:0xC1BD[Registered:"WM_GETNAVINFO"] wParam:00000000 lParam:00000000

in fact I now created two dlg (MFC)
apps, one sends one receives.
the receiving one is as below

const UINT CAppdlgDlg::WM_GETNAVINFO = ::RegisterWindowMessage(_T("WM_GETNAVINFO"));
LRESULT CAppdlgDlg::OnGetInfo(WPARAM wParam, LPARAM lParam)
      Beep(3000, 200);
      return 0;
LRESULT CAppdlgDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
      // TODO: Add your specialized code here and/or call the base class
      if(WM_GETNAVINFO == message)
            Beep(3000, 200);
      return CDialog::DefWindowProc(message, wParam, lParam);

this is odd but DefWindowProc gets it and beeps. but not coming to OnGetInfo ???

remember that if the message is WM_APP + 100, it works !! so it is not a matter
of implementing it, somehow MFC fails to
deliver it from DefWindowProc to
OnGetInfo ??? this is really odd ???
I am sorry this question may be an MFC
section, but most experts know it here anyway.

Author Comment

ID: 2757093
I am sorry, I my program was complicated
but when I simplified it, I could
see your answer.
LVL 15

Expert Comment

ID: 2757100
GlennDann already gave you the right answer.


but not ON_MESSAGE

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question