Solved

SetCurrentDirectory question

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 35
Replacement selected text 2 61
unable to delete all specified values regedit 38 416
Not needed 13 112
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…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 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