|
-
April 5th, 2020, 01:55 PM
#4
Re: How to pass int return type function in ON_COMMAND of BEGIN_MESSAGE_MAP
 Originally Posted by Beginner_MFC
When member function whose return type is int is placed inside the ON_COMMAND of BEGIN_MESSAGE_MAP, It shows error of invalid type conversion.
Yep, ON_COMMAND() macro expects the function to look like
Code:
afx_msg void func();
Suggest whats the alternative for that or how can i pass int return function .
The the only way to satisfy the compiler is to give it what it wants. In other words, you either change the func to return nothing or otherwise provide a wrapper function, something like that:
Code:
afx_msg int func();
afx_msg void cmd_func()
{
int ret = func();
TRACE("func() returned %d\n", ret);
}
Best regards,
Igor
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|