Case DBT_DEVICEREMOVECOMPLETE://DBT_DEVICEREMOVECOMPLETE, equipment unloading or pull out
{
If (LPDB - & gt; Dbch_devicetype==DBT_DEVTYP_VOLUME)//logical volume
{
PDEV_BROADCAST_VOLUME LPDBV=(PDEV_BROADCAST_VOLUME LPDB);
The switch (LPDBV - & gt; Dbcv_flags)
{
Case 0://U disk
{
STD: : string sUnplugMsg (" U disk is detected: [");
SUnplugMsg +=FirstDriveFromMask (LPDBV - & gt; Dbcv_unitmask);
SUnplugMsg +="] pull out!" ;
SetDlgItemText (IDC_EDIT1, sUnplugMsg c_str ());
}
break;
Case DBTF_MEDIA://CD
STD: : string sCDMsg (" detect disc: [");
SCDMsg +=FirstDriveFromMask (LPDBV - & gt; Dbcv_unitmask);
SCDMsg +="] insert!" ;
SetDlgItemText (IDC_EDIT1, sCDMsg c_str ());
break;
}
}
}
CodePudding user response:
Because you call SetDlgItemText SDK API, not MFC CWnd: : SetDlgItemText, SDK API for more than a HWND window handle parameters, and MFC CWnd class without the first parameter,CodePudding user response:
Method 1: in the first parameter in the function,Method 2: add: before function:
CodePudding user response:
Method 1 function to use access control class pointer, pointer with GetDlgItem () functionCodePudding user response:
Handle and control the ID is not the same thingCodePudding user response:
One is a global function, one is the CWND class internal functionCodePudding user response:
1 #, 3 # positive solution,