Register the Help Book

This is the easy bit. Just drop this code into your app and call fn RegisterMyHelpBook during program initialisation.

	'----------
	output "MyGreatApp"
	
	// AppleHelp.h
	toolbox fn AHRegisterHelpBook( const FSRef * appBundleRef ) = OSStatus
	
	// CFBundle.h
	toolbox fn CFBundleGetMainBundle = CFBundleRef
	toolbox fn CFBundleCopyBundleURL( CFBundleRef bundle ) = CFURLRef
	
	// CFURL.h
	toolbox fn CFURLGetFSRef( CFURLRef url, FSRef *fsRef) = Boolean
	
	local mode
	local fn RegisterMyHelpBook
	'~'1
	dim as CFBundleRef  myApplicationBundle
	dim as CFURLRef     myBundleURL
	dim as FSRef        myBundleRef
	dim as OSStatus     ignore
	
	myApplicationBundle = fn CFBundleGetMainBundle()
	long if ( myApplicationBundle )
	myBundleURL = fn CFBundleCopyBundleURL( myApplicationBundle )
	long if ( myBundleURL)
	long if ( fn CFURLGetFSRef( myBundleURL, @myBundleRef ) )
	ignore = fn AHRegisterHelpBook( @myBundleRef )
	end if
	CFRelease( myBundleURL )
	end if
	end if
	end fn
	'----------
	

Place the Help Book