On Apr 27, 2007, at 3:09 PM, Arnaud Nicolet wrote:

> Le 27 avr. 07 à 20:40 Soir, Charles Yeomans a écrit:
>
>> The LaunchServices function you want is LSOpenApplication, with the
>> kLSLaunchDontSwitch option.  If the MBS plugins don't have it, then
>> it is not hard to declare and call it.
>
> In fact, it sounds harder than I thought.
> The LSOpenApplication requires a parameter (LSApplicationParameters)
> that sounds "enhanced" for me (I'm not an expert on converting c
> declares to RB).
>
> I have this structure to be passed:
>
> struct LSApplicationParameters {
>     CFIndex version;
>     LSLaunchFlags flags;
>     const FSRef * application;
>     void * asyncLaunchRefCon;
>     CFDictionaryRef environment;
>     CFArrayRef argv;
>     AppleEvent * initialEvent
> };
> typedef struct LSApplicationParameters LSApplicationParameters;
>
> I don't know what is the version I must provide.
> Also, I don't know what type "flags" is expected to be (probably an
> integer, but it is not said).
> I'm lost for most of the parameters.

Here's most of the code you need.

Sub OpenApplication(f as FolderItem)
   const CarbonLib = "Carbon.framework"

   soft declare function LSOpenApplication lib CarbonLib (inAppParams  
as Ptr, ourPSN as Ptr) as Integer

   dim parameters as new MemoryBlock(28)

   const kLSLaunchDontSwitch = &h00000200
   dim flags as UInt32 = kLSLaunchDontSwitch

   parameters.UInt32Value(4) = flags

   dim appRef as new FSRef(f)
   parameters.Ptr(8) = appRef

   dim OSError as Integer = LSOpenApplication(parameters, nil)
End Sub


The FSRef class can be found on my web site <http:// 
www.declaresub.com/iDeclare/Files/FileManagerClasses.rbp.zip>.  I am  
somewhere in the process of rewriting that code; if it does not work  
as is, let me know.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to