Send an event to another app
Send an event to another app
- Subject: Send an event to another app
- From: Alex Kac <email@hidden>
- Date: Wed, 5 Mar 2008 22:20:12 -0600
I am still learning Cocoa so please forgive me if the terms and models
I use are totally out of whack with reality. First let me explain what
I'm trying to do, then explain how I do it in Win32, and ask how would
this be done in OS X.
I have an application that I do not control running. It has put up a
sheet to indicate progress on something it is doing over its document.
This progress could be a week or two long. When the sheet goes up menu
items like "Save" are greyed out. What I wish to do is send this
application, from my own, a message to save its document even though I
cannot do so from the user interface. This may cause it to crash or it
may work. I need to test that.
Under Win32, any menu command can be sent via a
SendMessage(hwndFoundWindow, WM_COMMAND, MAKEWPARAM(0,ID_SAVE),0); and
the app will get the message and execute the command as if a menu was
clicked. This works no matter what framework is used since menus
simply work that way.
I realize that under OS X things are different and they simply don't
work that way. I also know that menus do have a handler and I *assume*
that even if a menu is greyed out or a sheet is open (which I
understand is modal) that the main window can still handle events or
messages. So what I want to do under OS X is write my own app that
periodically will force this app to save its document by calling the
same handler as what the Save menu command would call. Again, I do
realize that "bad things may happen", but for this app we are using
its worth trying for me.
I'm going through Hillegass' book, but am so steeped in Win32 that I'm
simply not sure where to look yet. The above question comes from both
a need to understand fundamentally how ObjC and Cocoa work a bit
better as well as a practical need so if possible its an interesting
part of learning Cocoa for me. Thanks.
Alex Kac - President and Founder
Web Information Solutions, Inc. - Central Texas Microsoft Certified
Partner
"You cannot build a reputation on what you intend to do."
-- Liz Smith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden