In my day job, there is a team of people who maintain a very big desktop PC program written in C#.
I'm the guy who programs the microcontrollers in C++.
I am very familiar with the Win32 API from when I programmed in Visual Basic circa 1998 - 2002, and I've written a few C programs too with a message loop.
The idea being floated around my company at the moment is that I will write a dynamic shared library in C++ and produce a DLL file to give to the C# guys. The C# guys will then load my DLL file into their program, and they will call a function inside my DLL file and give it a handle to a window (i.e. HWND) on the screen.
So my DLL will have access to a piece of real estate on the screen. I will create buttons and text boxes using the C functions in the Win32/Win64 API, i.e. the likes of CreateWindowExW.
Normally a Win32/Win64 program written in C has a message loop where 'GetMessage' is called continuously, but I won't have access to the message loop as it's probably buried somewhere inside the CLR (Common Language Runtime). So this means that I can't directly intercept the BN_CLICKED messages sent to the buttons I've created on screen.
What I can do though is subclass each of the windows I create, and specify a custom WndProc for each of them, and so then the message loop inside the CLR will call DispatchMessage which will invoke my custom WndProc. So this means that my DLL will be able to react to the button clicks.
Do you reckon I'll be able to get this to work?
I'm the guy who programs the microcontrollers in C++.
I am very familiar with the Win32 API from when I programmed in Visual Basic circa 1998 - 2002, and I've written a few C programs too with a message loop.
The idea being floated around my company at the moment is that I will write a dynamic shared library in C++ and produce a DLL file to give to the C# guys. The C# guys will then load my DLL file into their program, and they will call a function inside my DLL file and give it a handle to a window (i.e. HWND) on the screen.
So my DLL will have access to a piece of real estate on the screen. I will create buttons and text boxes using the C functions in the Win32/Win64 API, i.e. the likes of CreateWindowExW.
Normally a Win32/Win64 program written in C has a message loop where 'GetMessage' is called continuously, but I won't have access to the message loop as it's probably buried somewhere inside the CLR (Common Language Runtime). So this means that I can't directly intercept the BN_CLICKED messages sent to the buttons I've created on screen.
What I can do though is subclass each of the windows I create, and specify a custom WndProc for each of them, and so then the message loop inside the CLR will call DispatchMessage which will invoke my custom WndProc. So this means that my DLL will be able to react to the button clicks.
Do you reckon I'll be able to get this to work?