Solved

SetCurrentDirectory question

Posted on 2001-06-26
4
350 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 25 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Macro to save highlighted rows as a separate file 5 46
withoutTen challenge 14 137
Thin secure Windows 10 5 107
Problem to Office 1 40
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

735 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