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
Running Windows (or anything else) on your Mac Discussion of Classic or running Windows, Linux and other OSes on the Mac.

WaitNextEvent method giving me the problem!!


Post Reply New Thread Subscribe

 
Thread Tools
skiran
Guest
 
Posts: n/a

I am using Apple Event Mechanism.. Whenever some action occurs on the client side I launch the server application and then send the event to that aplication..

As Mac OS classic uses cooperative scheduling, after launching the application, I am calling WaitNextEvent method.. But the event is being sent before the application is being launched.. I am using FlushEvents method just after launching the application.. Eventhen I am facing the same problem..

I am putting the code below.. Can anybody help me on this??

ProcessSerialNumber psn;
OSStatus i, err;
AppleEvent event = { typeNull, 0 };
AppleEvent reply = { typeNull, 0 };
AEAddressDesc target = { typeNull, 0 };
AEDescList creator_list = { typeNull, 0 };
AEDescList extension_list = { typeNull, 0 };
AEIdleUPP MyIdleUPP;
#if 0 // pick one
err = LaunchDocuBOMJavaLinkX();
#else
EventRecord event1;
err = LaunchDocuBOMJavaLinkClassic();
FlushEvents(everyEvent,0);
WaitNextEvent(autoKeyMask,&event1,1200,NULL);
#endif

if ( ! err ) err = ProcessUtils::FindProcessBySignature( kDocuBOMCreatorCode, psn );

if ( ! err ) err = AECreateDesc( typeProcessSerialNumber, &psn, sizeof(psn), &target );

if ( ! err ) err = AECreateAppleEvent( kAEDocuBOMEventClass, kAECheckOut, &target, kAutoGenerateReturnID, kAnyTransactionID, &event );

if ( ! err && ( inArrayOfCreatorCodesToOpen || inArrayOfFilenameExtensionsToOpen ) ) {
if ( inArrayOfCreatorCodesToOpen ) {
err = AECreateList( nil, 0, false, &creator_list );
for ( i = 0; ! err && inArrayOfCreatorCodesToOpen[ i ]; ++i ) {
err = AEPutPtr( &creator_list, 0, typeType, &inArrayOfCreatorCodesToOpen[ i ], sizeof(OSType) );
}
}
if ( inArrayOfFilenameExtensionsToOpen) {
err = AECreateList( nil, 0, false, &extension_list );
for ( i = 0; ! err && inArrayOfFilenameExtensionsToOpen[ i ]; ++i ) {
err = AEPutPtr( &extension_list, 0, typeChar, inArrayOfFilenameExtensionsToOpen[ i ], long(strlen( inArrayOfFilenameExtensionsToOpen[ i ] ) + 1) );
}
}
}
if ( ! err && creator_list.descriptorType != typeNull ) err = AEPutParamDesc( &event, keyCreatorCodeList, &creator_list );
if ( ! err && extension_list.descriptorType != typeNull ) err = AEPutParamDesc( &event, keyFilenameExtensionList, &extension_list );

if ( ! err ) err = GetCurrentProcess( &psn );
if ( ! err ) err = AEPutParamPtr( &event, keyDirectObject, typeProcessSerialNumber, &psn, sizeof(ProcessSerialNumber) );

MyIdleUPP= NewAEIdleUPP(MyAEIdleCallback);
if ( ! err ) err = AESend( &event, &reply, kAEWaitReply, kAEHighPriority, kNoTimeOut, MyIdleUPP, nil );

AEDisposeDesc( &extension_list );
AEDisposeDesc( &creator_list );
AEDisposeDesc( &target );
AEDisposeDesc( &event );
AEDisposeDesc( &reply );

return err;
QUOTE Thanks

Post Reply New Thread Subscribe


« Trying to find an old Mac game | Fotoarangemendsoftware -need helP! »
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
Problem after problem after problem... MrChris Archival Forum 7 03-11-2005 03:46 AM
HELP wierd iMac startup problem iluvmacs Apple Desktops 8 09-13-2004 07:47 AM
Problem with Finder in OS X 10.3.4 Bright_Eyes OS X - Operating System 3 07-06-2004 06:02 PM
G5 Video problem WilliS Apple Desktops 3 05-05-2004 10:16 AM
G3 Hard Drive problem joe mama Apple Desktops 1 02-18-2004 02:22 PM

All times are GMT -4. The time now is 06:25 PM.

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?