Solved

Finder Get Info

Posted on 2000-04-10
2
324 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 58
format the code in java 6 86
How to convert MFC::CString to UTF8 wchar_t* 10 139
Excel file not created as expected 7 46
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

20 Experts available now in Live!

Get 1:1 Help Now