c u盤使用記錄 C 如何讀取U盤中的檔案啊

2021-10-13 02:28:59 字數 2284 閱讀 7419

找到了……

當把u盤放插入,然後程式自動將u盤的內容複製到本地硬碟

using system;

using system.collections.generic;

using

using system.data;

using system.drawing;

using system.text;

using system.windows.forms;

using

namespace u盤更新

public partial class form1 : form

public const int wm_devicechange = 0x219;

public const int dbt_devicearrival = 0x8000;

public const int dbt_configchangecanceled = 0x0019;

public const int dbt_configchanged = 0x0018;

public const int dbt_customevent = 0x8006;

public const int dbt_devicequeryremove = 0x8001;

public const int dbt_devicequeryremovefailed = 0x8002;

public const int dbt_deviceremovecomplete = 0x8004;

public const int dbt_deviceremovepending = 0x8003;

public const int dbt_devicetypespecific = 0x8005;

public const int dbt_devnodes_changed = 0x0007;

public const int dbt_querychangeconfig = 0x0017;

public const int dbt_userdefined = 0xffff;

public form1()

initializecomponent();

private void form1_load(object sender, eventargs e)

protected override void wndproc(ref message m)

tryif (m.msg == wm_devicechange)

switch (m.wparam.toint32())

case wm_devicechange:

break;

case dbt_devicearrival://u盤插入

driveinfo s = driveinfo.getdrives();

foreach (driveinfo drive in s)

if (drive.drivetype == drivetype.removable)

listbox1.items.add("u盤已插入,碟符為:" + drive.name.tostring());

break;

break;

case dbt_configchangecanceled:

break;

case dbt_configchanged:

break;

case dbt_customevent:

break;

case dbt_devicequeryremove:

break;

case dbt_devicequeryremovefailed:

break;

case dbt_deviceremovecomplete: //u盤解除安裝

break;

case dbt_deviceremovepending:

break;

case dbt_devicetypespecific:

break;

case dbt_devnodes_changed:

break;

case dbt_querychangeconfig:

break;

case dbt_userdefined:

break;

default:

break;

catch (exception ex)

messagebox.show(ex.message);

base.wndproc(ref m);

浮生若夢天邊月,醉死如酒水中星。紅樓一夢千人嘆,豈讓萬夫空做賤。部落格:

c u盤使用記錄 C 檢測是否有u盤插入的方法

該c 可監控是否有u盤插入,同時可以監控其它驅動器的變化 using system using system.collections.generic using system.componentmodel using system.data using system.drawing using sy...

Ubuntu 如何讀取U盤內容

vmware版本為15,ubuntu版本18.04 之前用vmware14,插入u盤後不能掛載,網上查詢後為軟體bug。步驟 插入優盤,開啟終端 輸入以下命令 檢視磁碟名 sudo fdisk l 檢視u盤在ubuntu裡面的磁碟名稱這裡為 dev sdb1,檔案型別fat32 掛載u盤 sudo ...

C 如何讀取U盤插入的時間

如圖 通過檢測登錄檔裡的 enum usbstor 已經可以獲取u盤的型號,但是如何檢測到u盤的插入時間呢?參考 extracting usb artifacts from windows 7 how to analyze usb device history in windows windows ...