I don't know if this can be considered a bug report or a suggestion (maybe both).
Feel free to move this post to the appropriate section if I posted it in the wrong one.
From MSDN:
WM_COPYDATA Return value:
If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE.
Instead, when calling em_ user defined commands, TC always returns FALSE (0).
I suggest to return TRUE (1) and to return FALSE only in case of error, i.e. if the command has not been implemented.
Or you can notify the window passing the data, if its handle was set in the wParam argument of SendMessage, just like the "GW" / "GA" usage of WM_COPYDATA which notify a "RW" / "RA" to the calling window.
This way, as an added bonus, you can avoid the error message box in TC, if the calling window handle has been passed.
WM_COPYDATA return code when calling em_ commands
Moderators: Hacker, petermad, Stefan2, white
- chandragor
- Member
- Posts: 127
- Joined: 2005-06-01, 10:10 UTC
- Location: Italy
WM_COPYDATA return code when calling em_ commands
Happy owner of license #12422 since 1997
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: WM_COPYDATA return code when calling em_ commands
I'm not sure whether this is such a good idea to change it. People will assume that it returns true when the command was successful, but this isn't always possible to determine because the commands may be executed asynchronously.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- chandragor
- Member
- Posts: 127
- Joined: 2005-06-01, 10:10 UTC
- Location: Italy
Re: WM_COPYDATA return code when calling em_ commands
I understand.
Yet I think it would be a good idea if there was a way to give some feedback to the calling program if the requested em_ command was not defined.
The only way, right now, is to parse the UserCmd.ini file for a section with that name.
Thanks anyway.
Yet I think it would be a good idea if there was a way to give some feedback to the calling program if the requested em_ command was not defined.
The only way, right now, is to parse the UserCmd.ini file for a section with that name.
Thanks anyway.
Happy owner of license #12422 since 1997
Re: WM_COPYDATA return code when calling em_ commands
There's another reason why it's not generally possible to return True: em_ commands might consist of more than one cm_ command, and some of them might fail. What should be returned in such a case and who could decide what's the best approach? The truth is that It's not so simple (true/false).
However, I agree that it should be possible to determine whether or not an em_ command is defined.
Regards
Dalai
However, I agree that it should be possible to determine whether or not an em_ command is defined.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
- chandragor
- Member
- Posts: 127
- Joined: 2005-06-01, 10:10 UTC
- Location: Italy
Re: WM_COPYDATA return code when calling em_ commands
Yes, it should be, also because any user defined command can be defined even in a language-specific wcmd_*.ini ...
Regards
chandragor
Regards
chandragor
Happy owner of license #12422 since 1997