another errors building VC6 project under VS .NET 8

another errors building VC6 project under VS .NET 8

Post by Doug Harri » Thu, 19 Jan 2006 10:21:45

On Tue, 17 Jan 2006 08:57:11 -0600, Giackolo

It would have been a miracle if this ever actually worked in VC6. Microsoft
improved message map error checking in VC.NET, and VC7.1 is telling you
OnPrintFile doesn't have the right signature for an ON_NOTIFY_REFLECT
handler. (It doesn't have the right signature for ON_COMMAND, either, but
you duplicated the error message for ON_NOTIFY_REFLECT above.) Attempting
to solve this problem by replacing ON_COMMAND with ON_NOTIFY_REFLECT is not
the right approach at all. Assuming IDM_FILE_7 identifies a menu item, the
message is WM_COMMAND, so you must use ON_COMMAND. You simply need to
declare your function properly; see this topic for more:

Handlers for Commands and Control Notifications

Doug Harrison
Visual C++ MVP

another errors building VC6 project under VS .NET 8

Post by Scott McPh » Thu, 19 Jan 2006 10:28:07

The code is wrong, the error message is correct. The function signature
for your ON_COMMAND message handler is incorrect. ( detects this
error but VSv6 failed to detect it.) The required signature is:

void Function(); you have to change your function to match. There is no CString
parameter and no LRESULT returned.

Scott McPhillips [VC++ MVP]


another errors building VC6 project under VS .NET 8

Post by David Wilk » Thu, 19 Jan 2006 10:31:11


ON_COMMAND message handlers should have (and always had) void return
type. It would seem that someone (you?) must have added this handler
manually and put it inside the //{{AFX section.

Credit to Microsoft, I have to say that when I made my VC6 code so it
would compile in VC7, none of the issues had to do with MFC (except
PostThreadMessage() return value, which was changed for some reason),
but rather to errors in my own code that VC6 had allowed (mostly
conversions between size_t and int). After I had corrected these errors,
my code would compile in both VC6 and VC7. Unfortunately (shame on
Microsoft) I have decided for now to keep my app in VC6, because I
dislike the VC7 IDE so very much.

David Wilkinson