Solved

Finder Get Info

Posted on 2000-04-10
2
329 Views
Last Modified: 2013-12-26
How can I get the Finder to display the Get Info window for a document from an FSSpecPtr to the document? Any suggestions?
0
Comment
Question by:dwp090598
2 Comments
 
LVL 2

Accepted Solution

by:
roov earned 100 total points
ID: 2703074
You need to send the Finder an appleEvent, requesting for it to display the GetInfo box.

Below is the code, which MUST be called after initializing the Mac toolbox...

Enjoy,
Reuven

do {
      OSErr                  err = noErr, err2;
      AEAddressDesc      finderProcessDesc;
      OSType                  finderProcessSignature = 'MACS';
      AppleEvent            finderAEvent, finderAEventReply;
      AEDescList            docList;

      // Get Finder's process desciptor
      err = AECreateDesc(
                  typeApplSignature,
                  (Ptr)&finderProcessSignature,
                  sizeof(finderProcessSignature),
                  &finderProcessDesc);
      if (err != noErr)
            break;
      // Create AppleEvent to Finder
      err = AECreateAppleEvent(
                        kAEFinderEvents,
                        kAEGetInfoSelection,
                        &finderProcessDesc,
                        kAutoGenerateReturnID,
                        kAnyTransactionID,
                        &finderAEvent);
      // Plugin the file spec
      // This is a three step process:
      // 1. Prepare an AEList
      // 2. Plugin the file spec into the list
      // 3. Plugin the list into the AEvent
            // 1. Prepare an AEList
      err = AECreateList(nil,0,false,&docList);
      if (err != noErr) {
            // We could/should perform the test right after AECreateAppleEvent,
            // but since the bailing is the same...
            err2 = AEDisposeDesc(&finderProcessDesc);
            err2 = AEDisposeDesc(&finderAEvent);
            break;
      }
            // 2. Plugin the file spec into the list
      err = AEPutPtr(&docList,1,typeFSS,&fspec,sizeof(fspec));
      if (err != noErr) {
            err2 = AEDisposeDesc(&finderProcessDesc);
            err2 = AEDisposeDesc(&finderAEvent);
            break;
      }
            // 3. Plugin the list into the AEvent
      err = AEPutParamDesc (&finderAEvent,keyDirectObject,&docList);
      if (err != noErr) {
            err2 = AEDisposeDesc(&finderProcessDesc);
            err2 = AEDisposeDesc(&finderAEvent);
            break;
      }

      // Send the event of it's way...
      err = AESend(
                        &finderAEvent,
                        &finderAEventReply,
                        kAENoReply,
                        kAEHighPriority,
                        kAEDefaultTimeout,
                        NULL,
                        NULL);
      // Cleanup...
      err2 = AEDisposeDesc(&finderProcessDesc);
      err2 = AEDisposeDesc(&finderAEvent);
} while (false);

0
 

Author Comment

by:dwp090598
ID: 2709637
Thanks the  kAEGetInfoSelection worked for me.

Thanks Again
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 35
substring method in java 1 130
sumHeights  challenge 17 75
Change to event 1 119
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question