Get file path in Qt from winapi file HANDLE as QString, QFileInfo or something similiar
-
My application makes use of CopyFileExW for fast copying, and includes the LPPROGRESS_ROUTINE callback to track progress. Since I can copy files simultaneously, I need to keep track of file progress in a global sense.
To do this, I would use a
QMap<QString, quint64>
as a map of filepath / file hash and written bytes per file. In order to get the file path or file hash, I need to get the file path. One suggestion is to use GetFinalPathNameByHandleA which looks promising.Problem:
It appears I do not have access to the GetFinalPathNameByHandleA function found in
<fileapi.h>
as seen in the image below:How can I get a file path from a file HANDLE (in Windows spedcifically)?
-
@CybeX said in Get file path in Qt from winapi file HANDLE as QString, QFileInfo or something similiar:
It appears I do not have access to the GetFinalPathNameByHandleA function found in <fileapi.h> as seen in the image below:
According to your screenshot,
#if _WIN32_WINNT >= 0x0600
returned false. That's why the section is disabled.You need to
#include
the header that defines_WIN32_WINNT
(Google should show you the way)