New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

invoking an application with in another application


Post Reply New Thread Subscribe

 
Thread Tools
sharada
Guest
 
Posts: n/a

Hai ,
i am new to mac.i donot know how to do the things here .

i want to create two applications , i.e. app1 and app2.

All app1 does is invokes app2 if not started. Sleeps for some time (i.e. 60 sec). Then exits.
App1 basically invokes app2 the very first time it is run. Next instance of App1 simply checks to see if App2 is running. If so, prints a message like App2 is already running. So both App1 instances will essentially communicate with App

When one instance of App1 exits, we do not shutdown App2 (since other instance of App1 can still be talking to it).

When second instance of App1 exits (last instance of App1), it shuts down App2 and then exits.i want to write these two applications in "C".


please help me regarding this , if possible send me some code samples.

Thanks & Regards,
sharada..
QUOTE Thanks
rman

 
rman's Avatar
 
Member Since: Dec 24, 2002
Location: Los Angeles, California
Posts: 12,591
rman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud ofrman has much to be proud of
Mac Specs: 2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi

rman is offline
It appears to me, that you want a shell script call app1 and a C application called app2. The shell script app1 will have a loop and a if then statement of sort. It will then check to see if app2 is running if not it start it, and then go to sleep for a short period of time. Upon waking it will check for app2, and repeat the cycle. I don't see app1 communicating with app2, just checking to see if it is up. We would need more to get a feel for what you are trying to do.

Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!
QUOTE Thanks
sharada
Guest
 
Posts: n/a

hai ,
thanks for response ,i donot want to use shell script. first of all i need to run one application sum with in other application Launcher(like create process in windows), Launcher invokes sum if not started. Sleeps for some time (i.e. 60 sec). Then exits.
Launcher basically invokes sum the very first time it is run. Next instance of Launcher simply checks to see if sum is running. If so, print a message like sum is already running. So both Launcher instances will essentially communicate with sum.i need to do the code in pure c. ( nothing but "C") first please ,guide me to this things first.

Thanks & Regards,
sharada..
QUOTE Thanks
cazabam

 
cazabam's Avatar
 
Member Since: Jun 06, 2006
Posts: 1,153
cazabam is a glorious beacon of lightcazabam is a glorious beacon of lightcazabam is a glorious beacon of lightcazabam is a glorious beacon of lightcazabam is a glorious beacon of lightcazabam is a glorious beacon of light
Mac Specs: MacBook 2.0GHz White, 512MB RAM, 60GB HDD

cazabam is offline
There are many ways to do this, ranging from the simplistic to the insanely complex. From a terminal, type:

man 3 exec

That will detail how to launch programs from within a C program. Also look at:

man 3 fork

for splitting off new processes.

As for checking if it's already running, you could do it with a simple lock file in the user's home directory, or something complex involving semaphores, signals, shared memory or any number of other IPC mechanisms. It's quite a complex subject; searching the web for 'unix ipc' will give you many pointers.
QUOTE Thanks

Post Reply New Thread Subscribe


« need opinion about my app | getting the Hard Drives in Mac Intel from qt »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Testing application unde Mac OS ljube OS X - Apps and Games 0 11-17-2006 09:18 AM
Application has to be transferred in a .sit Aikinai Switcher Hangout 4 10-18-2005 10:19 PM
Custom application launchers in Dock? nanoo OS X - Operating System 10 10-13-2005 03:04 PM
How to make an application full screen for Mac OS X that are called through html? yu2 Web Design and Hosting 2 08-17-2005 01:35 AM
Custom Internet Application Randomly Freezing rlecjr OS X - Development and Darwin 0 08-27-2004 09:40 AM

All times are GMT -4. The time now is 11:26 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?