ON_COMMAND macro in MFC - opinions / explanations please.
-
This is puzzling me. I can add menu item with system generated and #define(d) ID and the menu text will be grayed out until I add a function to process the ON_COMMAND macro. However, I have a static DLL which has just the #define(s) IDs and if I use the ID in MFC OnCommand function ( WPARAM) – in case switch – the menu will be active. The way it looks – if the ID is defined in DLL the menu is OK, but if “locally” it needs the function in ON_COMMAND macro and than the OnCommand function is not used. If this is normal , OK Thanks for your time. Cheers Vaclav
-
This is puzzling me. I can add menu item with system generated and #define(d) ID and the menu text will be grayed out until I add a function to process the ON_COMMAND macro. However, I have a static DLL which has just the #define(s) IDs and if I use the ID in MFC OnCommand function ( WPARAM) – in case switch – the menu will be active. The way it looks – if the ID is defined in DLL the menu is OK, but if “locally” it needs the function in ON_COMMAND macro and than the OnCommand function is not used. If this is normal , OK Thanks for your time. Cheers Vaclav
-
-
Vaclav_Sal wrote:
and just for you
No, it's for everyone, because there are important and fundamental differences in how a static library and a DLL are connected to the executable. And that affects how your problem occurs and how it may be resolved.
LIB + DLL + .H . I think you should add you Dll,lib and .H in you Debug folder . Then you can use it just like a class. you can try !
-
LIB + DLL + .H . I think you should add you Dll,lib and .H in you Debug folder . Then you can use it just like a class. you can try !
You just posted that to Richard...
-
This is puzzling me. I can add menu item with system generated and #define(d) ID and the menu text will be grayed out until I add a function to process the ON_COMMAND macro. However, I have a static DLL which has just the #define(s) IDs and if I use the ID in MFC OnCommand function ( WPARAM) – in case switch – the menu will be active. The way it looks – if the ID is defined in DLL the menu is OK, but if “locally” it needs the function in ON_COMMAND macro and than the OnCommand function is not used. If this is normal , OK Thanks for your time. Cheers Vaclav
Not sure I follow what you're saying... elaborate a bit perhaps?
-
You just posted that to Richard...
-
Vaclav_Sal wrote:
and just for you
No, it's for everyone, because there are important and fundamental differences in how a static library and a DLL are connected to the executable. And that affects how your problem occurs and how it may be resolved.
Stick to the point Richard.
-
This is puzzling me. I can add menu item with system generated and #define(d) ID and the menu text will be grayed out until I add a function to process the ON_COMMAND macro. However, I have a static DLL which has just the #define(s) IDs and if I use the ID in MFC OnCommand function ( WPARAM) – in case switch – the menu will be active. The way it looks – if the ID is defined in DLL the menu is OK, but if “locally” it needs the function in ON_COMMAND macro and than the OnCommand function is not used. If this is normal , OK Thanks for your time. Cheers Vaclav
Vaclav_Sal wrote:
if the ID is defined in DLL
It cant be defined in a dll, it must be defined in a header file to have any meaning in your app. Don't really get what you mean though.
-
Stick to the point Richard.
-
This is puzzling me. I can add menu item with system generated and #define(d) ID and the menu text will be grayed out until I add a function to process the ON_COMMAND macro. However, I have a static DLL which has just the #define(s) IDs and if I use the ID in MFC OnCommand function ( WPARAM) – in case switch – the menu will be active. The way it looks – if the ID is defined in DLL the menu is OK, but if “locally” it needs the function in ON_COMMAND macro and than the OnCommand function is not used. If this is normal , OK Thanks for your time. Cheers Vaclav
-
Hi, This is completely normal in MFC from a CFrameWnd derived class. This behavior is governed by the variable CFrameWnd::m_bAutoMenuEnable[^]. Best Wishes, -David Delaune
Thanks David. I will try to clean up my code - it seems silly to intercept the menu message using ON_COMMAND macro and "re post" same message so OnCommand can process it. It really does not matter, to me, where the menu message gets processed, but since I started using libraries / modules I was just rying to keep processing uniform and under one function. It was dissapointing that majority of replies managed to stay off the subject. Cheers Vaclav
-
Thanks David. I will try to clean up my code - it seems silly to intercept the menu message using ON_COMMAND macro and "re post" same message so OnCommand can process it. It really does not matter, to me, where the menu message gets processed, but since I started using libraries / modules I was just rying to keep processing uniform and under one function. It was dissapointing that majority of replies managed to stay off the subject. Cheers Vaclav