我正在从.NET C#迁移到QT C++,并尝试在QT中使用此Win32函数来模拟驱动器:
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool DefineDosDevice(int flags, string devname, string path);
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern int QueryDosDevice(string devname, StringBuilder buffer, int bufSize);
上面的代码是用C#编写的,但我不知道如何在QT中使用它们,有人可以给我一个示例如何做到这一点以及如何在QT中使用任何Win32 API吗?
DefineDosDevice
函数,它已经在Windows.h
中声明了。而且你肯定不应该两者都做。 - Cody Gray