Ask a Question related to Mac Programming, Design and Development.
-
Jorge #1
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
-
Problem unmounting a NFS filesystem
Hello everybody, I'm having a 'little' problem while unmounting a NFS filesystem. Some days ago I change the IP address of a lab machine that was... -
when volume changes a beep sounds at the new volume
A beep sounds every time a change the volume. I have turned off all the windows sounds in control pannel -> Sounds. I've looked in every other... -
removing desktop icons
I'm new to XP and haven't yet been able to find the method of removing the desktop icons for "shortcut to web sites" and "contains letters,... -
[SOLVED] forcibly unmounting and bash history
First of all, why didn't post it to the list? Do you think it's too OT? But, on the other hand, both your mails were no help and also misleading.... -
Removing desktop icon from one account is removing from all accounts
Using XP Professional. I want the Guest account to have only a few icons. The other two accounts should have many more. When I remove the icon... -
David Phillip Oster #2
Re: Unmounting a AFP volume (removing it from desktop)
In article <4beb34a4.0309031110.256b2f23@posting.google.com >,
[email]rgasparini29@yahoo.com[/email] (Jorge) wrote:
Try adding a trailing ":", as in:> 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?
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
-
Jorge #3
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 <oster@ieee.org> wrote in message news:<oster-0FBE53.14514703092003@news.sf.sbcglobal.net>...> In article <4beb34a4.0309031110.256b2f23@posting.google.com >,
> [email]rgasparini29@yahoo.com[/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 OsterJorge Guest
-
David Phillip Oster #4
Re: Unmounting a AFP volume (removing it from desktop)
I wrote:
That is what I use.> tell application "Finder"
> eject alias "MyVolume:"
> end
In article <4beb34a4.0309040714.2649e3de@posting.google.com >,
[email]rgasparini29@yahoo.com[/email] (Jorge) wrote:
In C++, using part of PowerPlant, it looks like this:> The first option doesn't work, the result is the same. But I'm gonna
> check the applescript alternative ...
>
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
-
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.08593904092003@news.sf.sbcglobal.net[/email], "David Phillip Oster"
<oster@ieee.org> wrote:
> I wrote:>>> tell application "Finder"
>> eject alias "MyVolume:"
>> end
> That is what I use.
>
> In article <4beb34a4.0309040714.2649e3de@posting.google.com >,
> [email]rgasparini29@yahoo.com[/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
-
David Phillip Oster #6
Re: Unmounting a AFP volume (removing it from desktop)
In article <BB7CCD90.D51%tom@abracode.com>, <tom@abracode.com> wrote:
Thank you! I'll change it at once.> 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
David Phillip Oster Guest
-
Jorge #7
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 <oster@ieee.org> wrote in message news:<oster-D3A2EF.20571604092003@news.sf.sbcglobal.net>...> In article <BB7CCD90.D51%tom@abracode.com>, <tom@abracode.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



Reply With Quote

