How to use MoveFileWithProgress and how to move Directories from one drive to another?
<p>I recently asked <a href="http://stackoverflow.com/questions/8432115/is-there-a-way-to-move-a-file-with-the-ability-to-cancel-the-move-in-the-middle">Is there a way to move a file with the ability to cancel the move in the middle?</a> and was told to use <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365242%28v=vs.85%29.aspx" rel="nofollow">MoveFileWithProgress</a>.</p>

<p>a) From that msdn page: "When moving a directory, lpExistingFileName and lpNewFileName must be on the same drive." – So how do I move from one to another?</p>

<p>b) How do I use this at all? I know how to use the "regular" msdn documentation to get namespaces and assemblies. There must be something similar here for the <code>DllImport</code> line. But I don't know what it is. Is it "WINAPI"? Should I have:</p>

<pre><code>[SuppressUnmanagedCodeSecurity]
[DllImport("WINAPI.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool MoveFileWithProgress (
    string lpExistingFileName, string lpNewFileName,
    CopyProgressRoutine lpProgressRoutine,
    IntPtr lpData, int dwFlags);
</code></pre>

<p>And how am I supposed to know what's <code>string</code> and what's <code>IntPtr</code> etc? What I did now is "copy" from a wrapper for <code>CopyFileEx</code> that I found <a href="http://msdn.microsoft.com/en-us/magazine/cc163851.aspx" rel="nofollow">here</a>.</p>

<p>Any help welcome.</p>

<p>EDIT:</p>

<p>So I've found out how to call this particular method (the <code>DllImport</code> is "Kernel32.dll"). Although I'll be happy if someone can point me to a tutorial of how to use this not-"regular" code in general.</p>
