Events from C++ to Clarion - EVENT()

Hello,

Has anybody sent window event from C++ to Clarion window?

PostMessage() does not return error, but Clarion window does not register event. Code PostMessage((HWND)win_hndl, WM_USER, 0, 0); is not registered in Clarion ThisWindow.TakeEvent() or ThisWindow.TakeWindowEvent().

Interesing thing is that PostMessage((HWND)win_hndl, WM_CLOSE, 0, 0); is registered, and window closes.

I have found this post Printed Icetips Article, but that does not work. And, post is 22 years old. Maybe things changed how are they processes in Clarion window? I can successfully register message in Clarion msg_id = RegisterWindowMessageA(msg_str) and in C++ PostMessage((HWND)win_hndl, msg_id, 0, 0);. But again, it is not processed inside Clarion window.

If you search for the word “subclass” on this site, I think you will find what you need.

Windows messages and Clarion events are not the same thing. Conceptually yes, but in implementation they are different.
Unless/until something drastically changes in the Clarion runtime no Windows message will ever show up in a Clarion ACCEPT loop.
If you want to have a Clarion program respond to a Windows message you’re going to need to subclass the window.

This is nearly 30 years old now, but should explain some concepts for you

There are almost certainly newer articles and tools that make it easier to implement than it is with direct API calls.

@PaulAttryde thank you! Now it works.