In C# program I have an implementation of the following function:
int Test();
Which is defined in the native part of a program (which is written in C++) as follows:
HRESULT Test();
or possibly:
DWORD Test();
So while implementing the functions I need to return HRESULT and other standard Windows codes from the C# part. At this moment I've implemented it as follows:
public int Test()
{
return 0x00000102; // WAIT_TIMEOUT
}
The question is how can I use the human-readable codes in C#? I want to write something like: return WAIT_TIMEOUT;
in the same manner as I can do it in C++.
I'm seeking a solution which doesn't require to download external libraries or something like that. Only standard .NET.
And by the way WAIT_TIMEOUT
isn't a HRESULT
, but I hope you understand the question - the question isn't about exceptional situations, but about standard Windows constants. I'm just trying to use standard Windows defines in C# (E_NOTIMPL
, WAIT_OBJECT_0
, S_FALSE
, etc.)