Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows CE Is there a function to Change Directory ?

Posted on 2004-09-23
15
Medium Priority
?
1,833 Views
Last Modified: 2013-11-20
I found CreateDirectory() and RemoveDirectory() but cannot find anything to Change Directory !
and _chdir() is not supported.

Using Window CE not the .net version


0
Comment
Question by:hansw77041
[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
  • 8
  • 4
  • 2
  • +1
15 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12135847
Have not found too. I use to store current directory in a global variable and append to filename every time I need it.
0
 

Author Comment

by:hansw77041
ID: 12135957
OK thanks sounds like you are looking for the same soltuion.
I hope some one can tell US the correct way to do this... :-)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12136079
Well, I have 8 years programming with windows CE. Don't expect so.
0
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

 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12136339
By the way... SetCurrentDirectory() and GetCurrentDirectory() WinAPI functions are also not supported.
0
 
LVL 7

Expert Comment

by:jimwasson
ID: 12138232
MoveFile() doesn't do it? I haven't tried it but it's supposed to rename directories, too.
0
 

Author Comment

by:hansw77041
ID: 12138246
OK I'll wait a day or two to see if anyone has found a soltuion.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12138274
Then I recommend to put a link to this question in the WindowsCE TA:
http://www.experts-exchange.com/Programming/Wireless_Programming/WinCE/
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12138286
Jim,
I think Hans want to change current directory, not to change directory's name.
0
 
LVL 7

Expert Comment

by:jimwasson
ID: 12138330
Oops.
0
 
LVL 30

Expert Comment

by:Axter
ID: 12139960
If you don't want to store the current directory in a fix string literal, you can use something like the following:

TCHAR T_szHomeDir[MAX_PATH];
 GetModuleFileName(GetModuleHandle(NULL),T_szHomeDir,MAX_PATH);
 for(i=_tcslen(T_szHomeDir); i && T_szHomeDir[i]!=TEXT('\\');i--);
 T_szHomeDir[i+1]=TCHAR('\0');

Now T_szHomeDir should have the current executable directory, and all you have to do is add a relative path to get to your target directory.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12140012
Usually data in WindowsCE programming style (I mean, according to Microsoft recommendations) is not stored at current executable directory branch but at internal RAM's MyDocuments directory or internal/external Flash Memory's MyDocuments directory. This is due to that many WinCE options like backup and sync are "tied" to those directories.
So, it is not a good practice to use GetModuleFileName() in this case, while could be good for desktop Windows.

0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 12140046
Take a look to this MSDN page:
http://msdn.microsoft.com/library/en-us/wcefiles/html/_wcesdk_Using_the_File_System.asp

This is the most important paragraph:
"Windows CE uses a variety of techniques to simplify memory management and to reduce memory overhead. First, Windows CE ***does not use the current directory concept***. Instead, all of the references to an object are given in the full path. Further, Windows CE automatically compresses all of the files in the object store; therefore, no file has a flag to indicate compression. Of course, a flag does exist that distinguishes between a file in ROM and a file in RAM."

This will explain why you and me won't never find any facility to get "current directory".
0
 

Author Comment

by:hansw77041
ID: 12140256
Thanks for the research.
I just built a Dir Browser and that allows the user to "build" a string by browsing for the Current working direcory.

That solved the problem I had with not being able to us hard coded paths. The reason is the user must be allowed to make any directory on the SD storage card and
then be able to set the path to it.

I think MS are short sighted in this ***does not use the current directory concept*** !

Thanks again.

0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12144583
There are more short sights in MS Windows CE concept, by example, the lack of file extention view. I think it's really annoying for a mid- or high-skilled user. But still love it because you can port small and medium desktop Windows applications with minimum pain.
Thanks for the points,
BR,
Jaime.
0
 

Author Comment

by:hansw77041
ID: 12145813
Yep... I agree.
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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