Get file path in Qt from winapi file HANDLE as QString, QFileInfo or something similiar
CybeX last edited by
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.
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)?
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 >= 0x0600returned false. That's why the section is disabled.
You need to
#includethe header that defines
_WIN32_WINNT(Google should show you the way)
and to add to @JKSH: you probably want to use
GetFinalPathNameByHandleWas this is the UNICODE version.