Original Post
Is there a facility to use unions in C#? I'm making a class to work with consoles in Win32 and there's a couple things I'm not quite sure of. Here's an example of something I need to do: I don't know quite how to convert that into a C# structure. And also, as far as void pointers go, how would I go about importing this function? Could I do it without using unsafe code (void*)?
typedef struct _INPUT_RECORD {
WORD EventType;
union {
KEY_EVENT_RECORD KeyEvent;
MOUSE_EVENT_RECORD MouseEvent;
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
MENU_EVENT_RECORD MenuEvent;
FOCUS_EVENT_RECORD FocusEvent;
} Event;
} INPUT_RECORD;
HANDLE CreateConsoleScreenBuffer(
DWORD dwDesiredAccess,
DWORD dwShareMode,
const SECURITY_ATTRIBUTES* lpSecurityAttributes,
DWORD dwFlags,
LPVOID lpScreenBufferData
);