Solved

SetCurrentDirectory question

Posted on 2001-06-26
4
321 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
  • 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

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
ASCII Non-Printable characters/codes and their HTML equivalents 6 104
notReplace  challenge 53 116
viewing source code from eclipse 13 88
pre4 challenge 19 93
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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

17 Experts available now in Live!

Get 1:1 Help Now