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

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.

LVL 23

Expert Comment

ID: 2755897
Have you tried using Spy++ to see if the message is indeed sent?
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline


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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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.…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now