Mac c++ function to send message to lazarus app to be received by WndProc lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- wizbowes · 2013-05-16 12:06 Not sure if this is the best place to ask - but I'm running out of ideas. I have a Lazarus application I'm porting from Windows.  In Windows the application can receive messages from a c++ dll using the following code: Code: [Select]procedure TForm1.WndProc(var Message: TLMessage); var   mykey : integer; begin   inherited;   case Message.Msg of     WM_MY_MESSAGE:       begin         mykey := Message.WParam;         if (mykey > 0) and (mykey < 13) then            myActionFunction(mykey);       end;   end; end; Porting this to the Mac works fine and I can pass messages about between lazarus applications using PostMessage - all is good.  However I also need to mac a Framework written in c++ that posts these messages.  In windows it's simple enough: Code: [Select]HWND myApp= FindWindow(0,"My Application");     if (myApp != NULL){       PostMessage(myApp, WM_USER + 1, i,0);     } However I have no idea what the equivalent of this is  XCode.  Sadly my Framework must be in c++ to make use of an SDK... ---------------------------------------------------------------------- Jonas Maebe · 2013-05-17 09:43 For Delphi-compatibility, Lazarus emulates the Windows messaging infrastructure on other platforms. It translates standard OS events to this emulated Windows messaging infrastructure. It doubt it contains support for translating arbitrary events though. You'll probably have to install a Carbon event handler yourself and send a custom Carbon event from the C++ app that you define yourself, which you then can put on the Lazarus message queue via the PostMessage() method of the widgetset instance. ---------------------------------------------------------------------- wizbowes · 2013-05-17 22:31 Sounds beyond my ability on the Mac.  Thanks for your response.