WM_COPYDATA return code when calling em_ commands

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
chandragor
Member
Member
Posts: 118
Joined: 2005-06-01, 10:10 UTC
Location: Italy

WM_COPYDATA return code when calling em_ commands

Post by *chandragor »

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.
Happy owner of license #12422 since 1997
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: WM_COPYDATA return code when calling em_ commands

Post by *ghisler(Author) »

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
User avatar
chandragor
Member
Member
Posts: 118
Joined: 2005-06-01, 10:10 UTC
Location: Italy

Re: WM_COPYDATA return code when calling em_ commands

Post by *chandragor »

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.
Happy owner of license #12422 since 1997
User avatar
Dalai
Power Member
Power Member
Posts: 9352
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: WM_COPYDATA return code when calling em_ commands

Post by *Dalai »

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
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
chandragor
Member
Member
Posts: 118
Joined: 2005-06-01, 10:10 UTC
Location: Italy

Re: WM_COPYDATA return code when calling em_ commands

Post by *chandragor »

Yes, it should be, also because any user defined command can be defined even in a language-specific wcmd_*.ini ...

Regards
chandragor
Happy owner of license #12422 since 1997
Post Reply