This forum uses cookies. Click X button to hide this message. What is stored? 
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Meaningful error message when program start fails

 
Post new topic   Reply to topic    Total Commander Forum Index -> TC suggestions (English) Printable version
View previous topic :: View next topic  
Author Message
Dalai
Power Member
Power Member


Joined: 28 Jan 2005
Posts: 5511
Location: Meiningen (Südthüringen)

PostPosted: Sat Jun 17, 2017 3:38 pm    Post subject: Meaningful error message when program start fails Reply with quote

Hi,

This recent thread reminded me again that TC doesn't show a meaningful error message when the launch of an executable fails. One has to start the program again via context menu to make Explorer execute this program to learn the reason why the program launch failed. This is really annoying!

Please make TC show a meaningful error when a program fails to start. In Delphi there's even a group of functions that can help to do so. I use something like this:
Code:
MessageBox(Self.Handle, PChar(SysErrorMessage(GetLastError)), PLUGINNAME, MB_OK or MB_ICONHAND);
This makes the system translate the error code into an error message and also translates this to the current OS language, so there's no need to change TC's language files.

I'm not sure whether or not Delphi 2 has SysErrorMessage function, but I'm sure that there's a way to deal with that if that's the case. Of course instead of GetLastError you could use any other approriate variable, e.g. the return code of a function or something. Maybe even RaiseLastOsError/RaiseLastWin32Error could help in this situation.

Regards
Dalai
_________________
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 33864
Location: Switzerland

PostPosted: Tue Jun 20, 2017 3:09 am    Post subject: Reply with quote

It doesn't but there seems to be a Windows function:
FormatMessage

The only problem would be that the message language would differ from the language chosen within Total Commander. Maybe I will show a combined error (the one I show now and the windows error).
_________________
Author of Total Commander
http://www.ghisler.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dalai
Power Member
Power Member


Joined: 28 Jan 2005
Posts: 5511
Location: Meiningen (Südthüringen)

PostPosted: Tue Jun 20, 2017 6:22 am    Post subject: Reply with quote

ghisler(Author) wrote:
It doesn't but there seems to be a Windows function:
FormatMessage

Yes, that's the one that SysErrorMessage uses, too.

Quote:
The only problem would be that the message language would differ from the language chosen within Total Commander.

Well, that's better than it is now, isn't it? No matter which language the current "Access denied" message is shown, it's meaningless. As I see it, FormatMessage has a dwLanguageId parameter which might help with that.

Quote:
Maybe I will show a combined error (the one I show now and the windows error).

Yes, that could be a solution, too.

Regards
Dalai
_________________
#101164 Personal licence
Athlon X4 880K, 16 GiB RAM, Gigabyte F2A88X-D3HP, Win7 x64

Plugins: Services2, Startups
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC suggestions (English) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group