Professional Web Applications Themes

Unmounting a AFP volume (removing it from desktop) - Mac Programming

Hello everybody, Hopefully someone can give me help figuring out a way to make this work. What I'm trying to do is simply unmount an AFP volume, with this I mean to remove it from the desktop. I have tried the Carbon "UnmountVol" function, but although returns me no error, the volume still appears on my desktop ... this is my code: OSErr osErr; osErr = UnmountVol("\pMyVolume", 0); // osErr = noErr Do I need to call another function after that?? ... I have tried the MoreFiles "UnmountAndEject" function with the same results : OSErr osErr; osErr = UnmountAndEject("\pMyVolume", 0); ...

  1. #1

    Default Unmounting a AFP volume (removing it from desktop)

    Hello everybody,

    Hopefully someone can give me help figuring out a way to make this
    work. What I'm trying to do is simply unmount an AFP volume, with this
    I mean to remove it from the desktop. I have tried the Carbon
    "UnmountVol" function, but although returns me no error, the volume
    still appears on my desktop ... this is my code:

    OSErr osErr;
    osErr = UnmountVol("\pMyVolume", 0); // osErr = noErr

    Do I need to call another function after that?? ... I have tried the
    MoreFiles "UnmountAndEject" function with the same results :

    OSErr osErr;
    osErr = UnmountAndEject("\pMyVolume", 0); // osErr = noErr

    Any ideas?
    Thanks in advance ...

    Roberto
    Jorge Guest

  2. #2

    Default Re: Unmounting a AFP volume (removing it from desktop)

    In article <4beb34a4.0309031110.256b2f23posting.google.com >,
    [email]rgasparini29[/email] (Jorge) wrote:
    > Hopefully someone can give me help figuring out a way to make this
    > work. What I'm trying to do is simply unmount an AFP volume, with this
    > I mean to remove it from the desktop. I have tried the Carbon
    > "UnmountVol" function, but although returns me no error, the volume
    > still appears on my desktop ... this is my code:
    >
    > OSErr osErr;
    > osErr = UnmountVol("\pMyVolume", 0); // osErr = noErr
    >
    > Do I need to call another function after that?? ... I have tried the
    > MoreFiles "UnmountAndEject" function with the same results :
    >
    > OSErr osErr;
    > osErr = UnmountAndEject("\pMyVolume", 0); // osErr = noErr
    >
    > Any ideas?
    Try adding a trailing ":", as in:

    osErr = UnmountAndEject("\pMyVolume:", 0);

    or, try using applescript: open script editor, then paste in:

    tell application "Finder"
    eject alias "MyVolume:"
    end

    If that works, (and it does for me.) you can look up some of my previous
    postings on pasting compiled appleScript into the resource fork of your
    application, then calling the compiled appleScript with parameters from
    C/C++ code.
    -- David Phillip Oster
    David Phillip Oster Guest

  3. #3

    Default Re: Unmounting a AFP volume (removing it from desktop)

    Thanks David,

    The first option doesn't work, the result is the same. But I'm gonna
    check the applescript alternative ...

    Thank you!
    Regards ...


    David Phillip Oster <osterieee.org> wrote in message news:<oster-0FBE53.14514703092003news.sf.sbcglobal.net>...
    > In article <4beb34a4.0309031110.256b2f23posting.google.com >,
    > [email]rgasparini29[/email] (Jorge) wrote:
    >
    > > Hopefully someone can give me help figuring out a way to make this
    > > work. What I'm trying to do is simply unmount an AFP volume, with this
    > > I mean to remove it from the desktop. I have tried the Carbon
    > > "UnmountVol" function, but although returns me no error, the volume
    > > still appears on my desktop ... this is my code:
    > >
    > > OSErr osErr;
    > > osErr = UnmountVol("\pMyVolume", 0); // osErr = noErr
    > >
    > > Do I need to call another function after that?? ... I have tried the
    > > MoreFiles "UnmountAndEject" function with the same results :
    > >
    > > OSErr osErr;
    > > osErr = UnmountAndEject("\pMyVolume", 0); // osErr = noErr
    > >
    > > Any ideas?
    >
    > Try adding a trailing ":", as in:
    >
    > osErr = UnmountAndEject("\pMyVolume:", 0);
    >
    > or, try using applescript: open script editor, then paste in:
    >
    > tell application "Finder"
    > eject alias "MyVolume:"
    > end
    >
    > If that works, (and it does for me.) you can look up some of my previous
    > postings on pasting compiled appleScript into the resource fork of your
    > application, then calling the compiled appleScript with parameters from
    > C/C++ code.
    > -- David Phillip Oster
    Jorge Guest

  4. #4

    Default Re: Unmounting a AFP volume (removing it from desktop)

    I wrote:
    > tell application "Finder"
    > eject alias "MyVolume:"
    > end
    That is what I use.

    In article <4beb34a4.0309040714.2649e3deposting.google.com >,
    [email]rgasparini29[/email] (Jorge) wrote:
    > The first option doesn't work, the result is the same. But I'm gonna
    > check the applescript alternative ...
    >
    In C++, using part of PowerPlant, it looks like this:

    static void TellFinderEject(ConstStringPtr inPathS){
    StAEDescriptor ae;
    OSType sig = 'MACS';
    StAEDescriptor aeDest(typeApplSignature, &sig, sizeof sig);
    StAEDescriptor aeAH;
    FSSpec fs;
    ThrowIfOSErr_(FSMakeFSSpec(0, 0, inPathS, &fs));
    AliasHandle ah = NULL;
    ThrowIfOSErr_(NewAliasMinimal(&fs, &ah));
    HLock((Handle) ah);
    UAEDesc::AddPtr(aeAH, 0, typeAlias, *ah, GetHandleSize((Handle) ah));
    if(NULL != ah){
    DisposeHandle((Handle) ah);
    }
    ThrowIfOSErr_(AECreateAppleEvent(kAEFinderSuite, kAEEject, aeDest,
    kAutoGenerateReturnID, kAnyTransactionID, ae));
    UAEDesc::AddKeyDesc(ae, keyDirectObject, aeAH);
    UAppleEventsMgr::SendAppleEvent(ae);
    }

    and I call it like this:

    TellFinderEject("\pMyVolume:");
    David Phillip Oster Guest

  5. #5

    Default Re: Unmounting a AFP volume (removing it from desktop)

    Per discussion on carbon development list a couple of weeks ago you should
    avoid making minimal aliases when sending events to Finder in Mac OS X
    because they might not be properly resolved (it is some weird limitation of
    OS X Finder). You should create full alias instead.

    Tom
    Abracode


    On 9/4/03 11:00 AM, in article
    [email]oster-6C3B60.08593904092003news.sf.sbcglobal.net[/email], "David Phillip Oster"
    <osterieee.org> wrote:
    > I wrote:
    >> tell application "Finder"
    >> eject alias "MyVolume:"
    >> end
    >
    > That is what I use.
    >
    > In article <4beb34a4.0309040714.2649e3deposting.google.com >,
    > [email]rgasparini29[/email] (Jorge) wrote:
    >
    >> The first option doesn't work, the result is the same. But I'm gonna
    >> check the applescript alternative ...
    >>
    >
    > In C++, using part of PowerPlant, it looks like this:
    >
    > static void TellFinderEject(ConstStringPtr inPathS){
    > StAEDescriptor ae;
    > OSType sig = 'MACS';
    > StAEDescriptor aeDest(typeApplSignature, &sig, sizeof sig);
    > StAEDescriptor aeAH;
    > FSSpec fs;
    > ThrowIfOSErr_(FSMakeFSSpec(0, 0, inPathS, &fs));
    > AliasHandle ah = NULL;
    > ThrowIfOSErr_(NewAliasMinimal(&fs, &ah));
    > HLock((Handle) ah);
    > UAEDesc::AddPtr(aeAH, 0, typeAlias, *ah, GetHandleSize((Handle) ah));
    > if(NULL != ah){
    > DisposeHandle((Handle) ah);
    > }
    > ThrowIfOSErr_(AECreateAppleEvent(kAEFinderSuite, kAEEject, aeDest,
    > kAutoGenerateReturnID, kAnyTransactionID, ae));
    > UAEDesc::AddKeyDesc(ae, keyDirectObject, aeAH);
    > UAppleEventsMgr::SendAppleEvent(ae);
    > }
    >
    > and I call it like this:
    >
    > TellFinderEject("\pMyVolume:");
    Guest

  6. #6

    Default Re: Unmounting a AFP volume (removing it from desktop)

    In article <BB7CCD90.D51%tomabracode.com>, <tomabracode.com> wrote:
    > Per discussion on carbon development list a couple of weeks ago you should
    > avoid making minimal aliases when sending events to Finder in Mac OS X
    > because they might not be properly resolved (it is some weird limitation of
    > OS X Finder). You should create full alias instead.
    >
    > Tom
    > Abracode
    Thank you! I'll change it at once.
    David Phillip Oster Guest

  7. #7

    Default Re: Unmounting a AFP volume (removing it from desktop)

    But, is there any way to unmount an AFP volume using CarbonLib? ... I
    have read in previous posts that the better way is tell the Finder to
    unmount it. How can I send programmatically an apple event to the
    Finder to unmount the volume?? ... I think the finder event is
    "kAEEject" ...

    Regards, and thanks in advance ...
    Rob


    David Phillip Oster <osterieee.org> wrote in message news:<oster-D3A2EF.20571604092003news.sf.sbcglobal.net>...
    > In article <BB7CCD90.D51%tomabracode.com>, <tomabracode.com> wrote:
    >
    > > Per discussion on carbon development list a couple of weeks ago you should
    > > avoid making minimal aliases when sending events to Finder in Mac OS X
    > > because they might not be properly resolved (it is some weird limitation of
    > > OS X Finder). You should create full alias instead.
    > >
    > > Tom
    > > Abracode
    >
    > Thank you! I'll change it at once.
    Jorge Guest

Similar Threads

  1. Problem unmounting a NFS filesystem
    By Jackson A. Krainer in forum AIX
    Replies: 1
    Last Post: July 22nd, 09:14 PM
  2. when volume changes a beep sounds at the new volume
    By Doug in forum Windows XP/2000/ME
    Replies: 0
    Last Post: July 12th, 08:39 PM
  3. removing desktop icons
    By Don in forum Windows XP/2000/ME
    Replies: 3
    Last Post: July 8th, 07:56 PM
  4. [SOLVED] forcibly unmounting and bash history
    By Andrej Hocevar in forum Debian
    Replies: 0
    Last Post: July 6th, 04:30 PM
  5. Removing desktop icon from one account is removing from all accounts
    By Kyle in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 3rd, 03:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139