Solved

Finder Get Info

Posted on 2000-04-10
2
322 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
Comment Utility
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
Comment Utility
Thanks the  kAEGetInfoSelection worked for me.

Thanks Again
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 99
countEvens challenge 2 55
Line meaning 9 75
Sed question 2 45
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now