How to retrieve a system error message
-
Hello, I want to retrieve the text associated with a system error message from the windows resources. Example: Environment.GetResourceString('ArgumentOutOfRange_Index')); This code wont compile because GetResourceString is not a public method. So how can I get the error message for 'ArgumentOutOfRange_Index'? Thanks in advance! Kees Vermeulen
-
Hello, I want to retrieve the text associated with a system error message from the windows resources. Example: Environment.GetResourceString('ArgumentOutOfRange_Index')); This code wont compile because GetResourceString is not a public method. So how can I get the error message for 'ArgumentOutOfRange_Index'? Thanks in advance! Kees Vermeulen
Something like this maybe...
string errorMessage = new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error()).Message;
Or maybe p/invoke the Win32 FormatMessage() API. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: