MFC's PostMessage equivalent API in Photon

We are migrating the MFC application in QNX. We would like port user messages in MFC that is WM_USER in Photon. Please help.

You need to read the documentation on QNX message passing. I’ve never heard of anyone building cover functions for the MFC messages, but maybe someone has who will respond. If not, you may want to write them yourself.

I read your post about messaging in QNX in relation to MFC, I have written a messagesystem for QNX/Windows based systems and have some expirience. My question is, would it not be easier to make a wrapper for the MFC stuff and simply use the QNX messaging as it is suppose to? You don´t write much about you environment, if you give us some more info it would be easier to understand your actual problem, in this case with this little info I would suggest to:

Define the MFC messages as they are defines in Windows (is it Windows CE you are using?), and then simply make a wrapper that redefines the whatever send/recieve you use in Windows to go to QNX instead, using the predefined flags and IDs as parameters in the buffer of QNX messages, that way you could keep your MFC way of communicating, making porting easier. From what I remember QNX messaging is straight farward and simple which should also make it flexible to port in that way.

I might be wrong, but then give us more info.

If you need further professional help, let me know.

Regards

/Jörgen Buder
Purple Scout AB
Embedded and Open Source

Having read some about the option you are talking about I understand you want the event to be compatible for Photon, am I right? In that case studying Photon events would be as earlier mentioned a good start, but all in all I believe that the bottom messaging is the same.

We have defined some user messages like this:

One.cpp


#define WM_USER_AB WM_USER+1
#define WM_USER_PQ WM_USER+2
#define WM_USER_XY WM_USER+3

Our message map is as follows:
BEGIN_MESSAGE_MAP(C_ABSDlg, CFDialog)
ON_MESSAGE( WM_USER_AB, OnAB)
ON_MESSAGE( WM_USER_PQ, OnPQ)
ON_MESSAGE( WM_USER_XY, OnXY)
END_MESSAGE_MAP()

We do some bussiness logic in OnAB, OnPQ and OnXY functions.
We register this user defined messages using attach function.

ab.Attach(this, WM_USER_AB);

ab is object of element class, and there is one thread which monitors changes in all object of element class.

now when value of ab changes the monitoring thread send the the notification by
::PostMessage(m_hwnd, WM_USER_AB); so internally OnAB function gets called.

We would like similar funtioanlity in QNX.

Ok, a quick answer then

Without going to deep into the details (thanks by the way).

I believe that you will have to develop this mechanism yourself, I do not remember anything like that In QNX system (windowing event), however you should be able to do kind of the same and then use the send function. But you may have to do it your self.

Any expert that knows better?

It sound like a typical callback functionality that are message based and triggered from that monitoring thread?

Puja,

I’m not sure if I understand correctly what you are looking for. There is a mechanism in QNX Photon, that allows you to trigger a function call in the context of the Photon thread by sending a pulse. Please check documentation of PtPulseArm() and PtAppAddInput() for this feature.

-Peter

I read about Window-management flags like Ph_WM_CLOSE, Is there any way to write Ph_WM_MYOWNFLAG and register it with window manager and Forward a window event to the window?