[futurebasic] CFUserNotification

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Bernie <fb.mailing.list@...>
Date: Fri, 29 Dec 2006 11:13:45 +0000
I have CFUserNotification working well in an Xcode app but FB don't  
like it (think I've come unstuck in the glue code). Can 'someone'  
show me what I've got wrong here?


'----------
local fn CoreFoundationBundle
'~'1
begin globals
dim as CFBundleRef sCoreFoundationBundle// static
end globals
if ( sCoreFoundationBundle == 0 ) then sCoreFoundationBundle = ¬
fn CreateBundleForFramework( "CoreFoundation.framework" )
end fn = sCoreFoundationBundle

toolbox fn CFDictionaryCreateMutable( CFAllocatorRef allocator, ¬
CFIndex capacity, pointer keyCallBacks, ¬
pointer valueCallBacks ) = CFMutableDictionaryRef


#define CFUserNotificationRef as pointer

begin globals
dim as pointer gCFUserNotificationCreate
end globals

/*
CFUserNotificationRef CFUserNotificationCreate(CFAllocatorRef  
allocator, ¬
CFTimeInterval timeout, CFOptionFlags flags, SInt32 *error, ¬
CFDictionaryRef dictionary);
*/
local fn CFUserNotificationCreate( allocator as CFAllocatorRef, ¬
timeout as CFTimeInterval, flags as CFOptionFlags, ¬
@err as ^SInt32, dictionary as CFDictionaryRef )
beginassem
   lwz r12,^gCFUserNotificationCreate
   mtspr ctr,r12
   mr r31,r2
   bctrl
   mr r2,r31
endassem
end fn// returns CFUserNotificationRef

gCFUserNotificationCreate = fn GetMachFunctionFromBundle( ¬
fn CoreFoundationBundle, "CFUserNotificationCreate" )

dim as CFUserNotificationRef un
dim as CFMutableDictionaryRef dict
dim as CFOptionFlags flags
dim as SInt32 @ err

dict = fn CFDictionaryCreateMutable( 0, 0, 0, 0 )
long if ( dict )
CFDictionarySetValue( dict, fn CFSTR( "AlertHeader" ), ¬
fn CFSTR( "My Notification" ) )// required

un = fn CFUserNotificationCreate( 0, 0.0, 0, @err, dict )
long if ( un )

beep

end if
//CFRelease( dict )
end if


do
HandleEvents
until gFBQuit
'----------

TIA

Bernie