Re: CreateDirectory() won't work... by Michael
Michael
Sat Nov 19 09:19:15 CST 2005
The call to CreateDirectory is synchronous, so the directory will exist (or
you error out) on return.
You could be failing if the directory already exists.
You can't use MoveFile to move from one storage volume (RAM) to the other
(Storage Card). You have to use CopyFile (and then delete the original).
You should get specific error codes - they can be very useful in determining
the exact cause of the problem. Use GetLastError (but only if something
fails!).
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"blue" <blue@blue.blue> wrote in message
news:OwXx1ZR7FHA.3200@TK2MSFTNGP11.phx.gbl...
>> Post the code. Chances are you are doing something wrong
>
> The code is below. Another problem is that Storage Card is, of course,
> slower than RAM so the first IF executes the error message box (altough
> the folder is created after moment or two, but NOT immediately - and
> that's why IF executes the error message), so I'm wondering how can I slow
> down the process for that moment or two? Something like 'pause the process
> for 0,3 sec and then continue'. Also, Mr. Feinman you've helped me in the
> other post below ('enumerating SIP methods'), but I'm still experiencing
> some problems, so if you're willing to take a quick look at that post
> below (the code is written in it), because I can't find an example with
> SIP functions on the web (on the Usenet neither). Thanks!
>
> if(CreateDirectory(_T(\\Storage Card\\Directory),0)!=0){
> AfxMessageBox(_T("Error!"),MB_OK|MB_ICONERROR);
> return;
> }
>
> MoveFile(_T("\\Windows\\Example.exe"),_T(\\Storage
> Card\\Directory\\Example.exe));
>
>
> //So, directory is created but nothing is moved in it (because of the
> speed of Storage Card I guess). Also, Resco File Explorer shows that
> directory has attributes ReadOnly, ROM (?) and System. But if I mannually
> create Directory and execute just MoveFile(), the problem remains. If the
> destination is just "\\Storage Card" everything works out fine.
>