Solved

SetCurrentDirectory question

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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 …
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

11 Experts available now in Live!

Get 1:1 Help Now