MoveFileEX and NT4 - Not Working!

MoveFileEX and NT4 - Not Working!

Post by Jeff Eberli » Fri, 24 Apr 1998 04:00:00



Hello there,

I'm trying to use the MoveFileEX function in NT4 and I keep getting a 1 back as the return code, unless one of the values is blank.

Here's the line of code that's failing...

MoveFileEx("c:\cartman.txt","d:\gma.txt",4)

(4 is the # of MOVEFILE_DELAY_UNTIL_REBOOT)

* This line returns a 0 but still doesn't do anything...
MoveFileEx("d:\gma.txt","",4)

What am I doing wrong?

Thanks!
Jeff
--
Jeff Eberlin - Programming - R&D
TeleMagic, Inc.

 
 
 

MoveFileEX and NT4 - Not Working!

Post by Yannick Delwich » Fri, 24 Apr 1998 04:00:00


Hi,
Is your file moved after reboot?
If yes, then everything is allright. If no, I don't see what would be
wrong in what you wrote.

Greets.
Yannick

 
 
 

MoveFileEX and NT4 - Not Working!

Post by Felix Kasza [MV » Fri, 24 Apr 1998 04:00:00


Jeff,

 > MoveFileEx("c:\cartman.txt","d:\gma.txt",4)
 > (4 is the # of MOVEFILE_DELAY_UNTIL_REBOOT)

From the docs:

        "MOVEFILE_COPY_ALLOWED

         If the file is to be moved to a different
         volume, the function simulates the move by
         using the CopyFile and DeleteFile functions.
         Cannot be combined with the
         MOVEFILE_DELAY_UNTIL_REBOOT flag."

This says, in effect, that MFE() will not do cross-device moves with
MOVEFILE_DELAY_UNTIL_REBOOT.

Cheers,
Felix.

--
If you post a reply, kindly refrain from emailing it, too.
I have killfiled hotmail.com and yahoo.com. If you are legit,
come forth and be recognized -- with a *real* email address.

 
 
 

MoveFileEX and NT4 - Not Working!

Post by Jeff Eberli » Fri, 24 Apr 1998 04:00:00


It doesn't matter if it's cross device.... it won't work on the same device
either....


>Jeff,

> > MoveFileEx("c:\cartman.txt","d:\gma.txt",4)
> > (4 is the # of MOVEFILE_DELAY_UNTIL_REBOOT)

>From the docs:

> "MOVEFILE_COPY_ALLOWED

> If the file is to be moved to a different
> volume, the function simulates the move by
> using the CopyFile and DeleteFile functions.
> Cannot be combined with the
> MOVEFILE_DELAY_UNTIL_REBOOT flag."

>This says, in effect, that MFE() will not do cross-device moves with
>MOVEFILE_DELAY_UNTIL_REBOOT.

>Cheers,
>Felix.

>--
>If you post a reply, kindly refrain from emailing it, too.
>I have killfiled hotmail.com and yahoo.com. If you are legit,
>come forth and be recognized -- with a *real* email address.

 
 
 

MoveFileEX and NT4 - Not Working!

Post by Felix Kasza [MV » Fri, 24 Apr 1998 04:00:00


Jeff,

 > * This line returns a 0 but still doesn't do anything...

OK, next item: 0 == FALSE, in this case. now call getLastError() and
check why MFE() barfed.

Also, I was assuming you use VB (since replacing preprocessor defines
with manifest constants seems to be done mostly by VB people). If you
are using C or C++, have you doubled those backslashes in your source?

Cheers,
Felix.

--
If you post a reply, kindly refrain from emailing it, too.
I have killfiled hotmail.com and yahoo.com. If you are legit,
come forth and be recognized -- with a *real* email address.

 
 
 

MoveFileEX and NT4 - Not Working!

Post by Jeff Eberli » Sat, 25 Apr 1998 04:00:00


Actually, it's Visual FoxPro (good call!)... I called GetLastError and it
returned 127 and I don't know what that means....


>Jeff,

> > * This line returns a 0 but still doesn't do anything...

>OK, next item: 0 == FALSE, in this case. now call getLastError() and
>check why MFE() barfed.

>Also, I was assuming you use VB (since replacing preprocessor defines
>with manifest constants seems to be done mostly by VB people). If you
>are using C or C++, have you doubled those backslashes in your source?

>Cheers,
>Felix.

>--
>If you post a reply, kindly refrain from emailing it, too.
>I have killfiled hotmail.com and yahoo.com. If you are legit,
>come forth and be recognized -- with a *real* email address.

 
 
 

MoveFileEX and NT4 - Not Working!

Post by Felix Kasza [MV » Sat, 25 Apr 1998 04:00:00


Jeff,

 > I called GetLastError and it returned 127

ERROR_PROC_NOT_FOUND, which is quite surprising to me. You _are_ on
NT, right? (If not, check out KB article Q140570, "How to Move Files
That Are Currently in Use" for a Win95 method.)

This small C++ proglet works fine for me:

#include <windows.h>
#include <stdio.h>
#pragma hdrstop

int main( int argc, char *argv[] )
{
        if ( argc != 3 )
        {
                puts( "usage: mvbf somefile targetpath" );
                return 1;
        }

        if ( MoveFileEx( argv[1], argv[2],
                MOVEFILE_DELAY_UNTIL_REBOOT | MOVEFILE_REPLACE_EXISTING ) )
        {
                puts( "The move/rename will be done during the next boot." );
                return 0;
        }
        else
        {
                printf( "Sorry -- Win32 error %lu was returned.\n",
                        GetLastError() );
                return 2;
        }

Quote:}

If you check your email, you should find a compiled version to play
with. I'd be interested to hear whether this gives the same results.

Cheers,
Felix.

--
If you post a reply, kindly refrain from emailing it, too.
I have killfiled hotmail.com and yahoo.com. If you are legit,
come forth and be recognized -- with a *real* email address.

 
 
 

1. CAB files not working in NT4

I have created an ActiveX EXE application in VB6 (Win98SE) and created the
CAB file using the Package and Deployment Wizard. It works fine on the
development machine (in IE5.5).
When I copy the files onto an NT4 Server and try and open the application in
IE4.1 (via Intranet) it comes up with the "Open or Save" dialog box
(although I can load it from the Server onto the development machine).
According to the MSDN Library documentation the security needs to be set to
Medium - tried that, same problem. I then set the security to Custom and
enabled all the ActiveX settings - same problem.

There's obviously a setting somewhere that's not correct.

Can anyone point me in the right direction??

Thanks.
James Organ

2. Please answer Chuck

3. GetDesktopWindow API call does not work properly under Win95/NT4.0

4. comp.sources.testers - Frequently Asked Questions (FAQ)

5. CListCtrl::GetSelectionMark() works on NT4 not on W95

6. OSI services over TCP/IP for VMS (RFC1006)

7. Why does LoadImage work on NT4 but not Win95?

8. Zero Phase vs. Linear Phase

9. My app works properly in Win95/NT4 - but not in Win98?????

10. named pipe code works under NT4.0 but not Win2k or XP....

11. Comm handle sharing works in Win98 but not NT4?

12. Tapi app works under NT4.0 and not under Win 95

13. Works in NT4 but not in 95