#include "stdafx.h"
#include "device.h"
#include <windows.h>
#include<TlHelp32.h>
#define MAX_PATH 1024
char * setw(int w)
{
return "h";
}
MyClass::MyClass(string _root_name,string _real_path)
{
this->_root_name = _root_name;
this->_real_path = _real_path;
}
bool MyClass::createdisc()
{
BOOL rs2 = DefineDosDevice(DDD_RAW_TARGET_PATH, L"U:", L"\\GLOBAL??\\D:\\paper");
if (0)
{
rs2 = DefineDosDevice(DDD_REMOVE_DEFINITION, L"U:", NULL);
cout << "delete device" << endl;
return false;
}
return true;
}
callbackinfo MyClass::discwather()
{
callbackinfo info;
DWORD cbBytes;
char file_name[MAX_PATH]; //设置文件名
char file_name2[MAX_PATH]; //设置文件重命名后的名字
char notify[1024];
int count = 0;
#include "device.h"
#include <windows.h>
#include<TlHelp32.h>
#define MAX_PATH 1024
char * setw(int w)
{
return "h";
}
MyClass::MyClass(string _root_name,string _real_path)
{
this->_root_name = _root_name;
this->_real_path = _real_path;
}
bool MyClass::createdisc()
{
BOOL rs2 = DefineDosDevice(DDD_RAW_TARGET_PATH, L"U:", L"\\GLOBAL??\\D:\\paper");
if (0)
{
rs2 = DefineDosDevice(DDD_REMOVE_DEFINITION, L"U:", NULL);
cout << "delete device" << endl;
return false;
}
return true;
}
callbackinfo MyClass::discwather()
{
callbackinfo info;
DWORD cbBytes;
char file_name[MAX_PATH]; //设置文件名
char file_name2[MAX_PATH]; //设置文件重命名后的名字
char notify[1024];
int count = 0;

这篇博客介绍了如何使用C++在Windows操作系统上创建一个虚拟盘符,如U:,并将该盘符指向指定的路径。同时,通过ReadDirectoryChangesW函数实现了对U:盘内文件的变动事件监控,包括文件添加、修改、删除和重命名的情况。
最低0.47元/天 解锁文章
1157

被折叠的 条评论
为什么被折叠?



