I think that you are on the right track. No matter the language or the framework, at the very bottom is the Operating System, so everything ends there, eventually: system calls.
For example, to open a file in Windows the system call is CreateFile()
, no matter if you used C fopen
, C++ ifstream
, C# System.IO.*
or Java java.io.*
.
About your questions of System.Windows.Forms, they use the usual Win32 windows, so the windows are identified by HWND
values, represented in the CLR as IntPtr
.
And about the function to show the window, your question is a bit misleading, as there are several functions involved, and several layers in the Win32 API.
For example to create a window, you call CreateWindowEx()
, to show it if hidden call ShowWindow()
, and the paint itself will be handled when the window procedure (a callback you have to write) receives the WM_PAINT
message. But in order to receive messages you have to write a message pump (GetMessagte() / DispatchMessage()
).
But to create a simple MessageBox()
there is a function already available that does all that for you: MessageBox()
, for which the System.Windows.Forms.MessageBox
class is a direct wrapper.
So now, what was the question? Ah, yes, can we interoperate between System.Windows.Forms
and Win32? Yes!