Jump to content

DllCall with NULL values in MoveFileWithProgress?


Recommended Posts

You cannot.

Now your thread just looks stupid.

So I'm posting the original conted.

Thanks google cache

 

Sup guys

 
I have a script in which I want to add a Move File function
 
The MoveFile autoit function is not what I'm looking for, I'd like to simply have autoit send over the move file process to windows's default API
 
So here's the windows function I'm trying to use:
 
 
I've looked at WinApi.au3 and tried to use its function as a template to write the one I want:
 
 
;use windows API to move the folder
;http://msdn.microsoft.com/en-us/library/windows/desktop/aa365242(v=vs.85).aspx

Global Const $MOVE_FILE_REPLACE_EXISTSING = 0x00000001
Global Const $MOVE_FILE_COPY_ALLOWED = 0x00000002
Global Const $MOVE_FILE_DELAY_UNTIL_REBOOT = 0x00000004
Global Const $MOVE_FILE_WRITE_THROUGH = 0x00000008
Global Const $MOVE_FILE_CREATE_HARDLINK = 0x00000010
Global Const $MOVE_FILE_FAIL_IF_NOT_TRACKABLE = 0x00000020

#include <array.au3>

$ret = _WinAPI_MoveFile(@ScriptDir & "\Folder1", @ScriptDir & "\Folder2")

ConsoleWrite($ret & @CRLF)

Func _WinAPI_MoveFile($lpExistingFileName, $lpNewFileName)
    $lpProgressRoutine = 0 ;0 = null?
    $lpData = 0 ;0 = null?
    $dwFlags = 0 ;0 = i dunno

    #cs
    BOOL WINAPI MoveFileWithProgress(
      _In_      LPCTSTR lpExistingFileName,
      _In_opt_  LPCTSTR lpNewFileName,
      _In_opt_  LPPROGRESS_ROUTINE lpProgressRoutine,
      _In_opt_  LPVOID lpData,
      _In_      DWORD dwFlags
    );
    #ce


    Local $aResult = DllCall("kernel32.dll", _
    "handle", "MoveFileWithProgressA", _
    "str", $lpExistingFileName, _
    "str", $lpNewFileName, _
    "ptr", $lpProgressRoutine, _
    "ptr", $lpData, _
    "dword", $MOVE_FILE_COPY_ALLOWED + $MOVE_FILE_WRITE_THROUGH + $MOVE_FILE_REPLACE_EXISTSING)

    _ArrayDisplay($aResult)

    Return $aResult[0]

EndFunc
 
 
Well the file doesn't get moved, and I don't get an error message.
 
To test it, simply create Folder1 and Folder2 within the folder of the script.
 
Can you guys figure out where I'm going wrong? I'm not experienced using DllCall...
 
Thanks!
 

 

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...