?
Solved

SetCurrentDirectory question

Posted on 2001-06-26
4
Medium Priority
?
371 Views
Last Modified: 2013-11-20
Hi,
I need to change the current directory to "My Computer".
How do I do that ?

Yoav.
0
Comment
Question by:yoavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:jacobkristensen
ID: 6228065
Have you tried the SetCurrentDirectory(LPCTSTR lpPathName) - method?
0
 
LVL 32

Accepted Solution

by:
jhance earned 75 total points
ID: 6228076
"My Computer" is not a directory so SetCurrentDirectory() can't be used.  "My Computer" is a figment of the Windows Shell's imagination.  In other words, it's a VIRTUAL FOLDER that only exists because the shell creates it to look like one.

The only things that can operate on this are things that work via the Windows shell.  If you're unfamiliar with Shell programming, I'd suggest Dino Esposito's book, Visual C++ Windows Shell Programming from WROX Press.

Basically, you use the SHGetDesktopFolder() API to access the "My Computer" contents.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6229613
I haven't tried this, so I don't know if it will work.
But you could try using the name of your computer.
Example:
If your computer's name is "Devolp32" then you could try the following:
SetCurrentDirectory("\\Devolp32\");
0
 
LVL 32

Expert Comment

by:jhance
ID: 6229899
SetCurrentDirectory() only works on file system object.  The "My Computer" is a Windows shell object and will not appear in the filesystem.  You also cannot set the current directory to "\\Computername".  This is invalid...
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

719 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