Update: I think I 'm starting to understand CFStringRef and CFURLRef are pointers and by using .d it seems to not break with error.
Nevertheless, I 'm not sure do I pass a pointed for my string to the function?
Here 's my latest attempt:
Code: Select all
OpenWindow(0, 0, 0, 220, 160, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ImportC "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"
CFStringCreateWithCString(alloc.d, String.s, enc.i)
CFUserNotificationDisplayNotice(Timeout.d, AlertLevel.i, IconUrl.d, SoundUrl.d, LocalizationUrl.d, Title.d, Message.d, DefBtnTitle.d)
EndImport
title.d = CFStringCreateWithCString(#Null, "test1", 0)
msg = CFStringCreateWithCString(#Null, "test2", 0)
CFUserNotificationDisplayNotice(0,0, #Null,#Null, #Null, title, msg, #Null)
Repeat
Event = WindowEvent()
ForEver
Now, I 'm getting an invalid memory error at CFStringCreateWithCString()
But I can't see why, given the definition:
CFStringCreateWithCString
Creates an immutable string from a C string.
CFStringRef CFStringCreateWithCString (
CFAllocatorRef alloc,
const char *cStr,
CFStringEncoding encoding
);
Parameters
alloc
The allocator to use to allocate memory for the new string. Pass NULL or kCFAllocatorDefault to use the current default allocator.
cStr
The NULL-terminated C string to be used to create the CFString object. The string must use an 8-bit encoding.
encoding
The encoding of the characters in the C string. The encoding must specify an 8-bit encoding.
Ref:
https://developer.apple.com/library/mac ... 201-F11124
Any ideas?
