eject button functionality
This commit is contained in:
parent
6dddc1cc6b
commit
f057077826
2 changed files with 7 additions and 5 deletions
|
@ -273,7 +273,7 @@ bool GUI_App::on_init_inner()
|
|||
this->obj_manipul()->update_if_dirty();
|
||||
|
||||
|
||||
RemovableDriveManager::get_instance().update(wxGetLocalTime(), true);
|
||||
//RemovableDriveManager::get_instance().update(wxGetLocalTime(), true);
|
||||
|
||||
|
||||
// Preset updating & Configwizard are done after the above initializations,
|
||||
|
|
|
@ -96,14 +96,16 @@ void RemovableDriveManager::eject_drive(const std::string &path)
|
|||
return;
|
||||
}
|
||||
DWORD deviceControlRetVal(0);
|
||||
DeviceIoControl(handle, FSCTL_LOCK_VOLUME, nullptr, 0, nullptr, 0, &deviceControlRetVal, nullptr);
|
||||
DeviceIoControl(handle, FSCTL_DISMOUNT_VOLUME, nullptr, 0, nullptr, 0, &deviceControlRetVal, nullptr);
|
||||
BOOL error = DeviceIoControl(handle, IOCTL_STORAGE_EJECT_MEDIA, nullptr, 0, nullptr, 0, &deviceControlRetVal, nullptr);
|
||||
CloseHandle(handle);
|
||||
if (error == 0)
|
||||
{
|
||||
CloseHandle(handle);
|
||||
std::cerr << "Ejecting " << mpath << " failed " << deviceControlRetVal << " " << GetLastError() << " \n";
|
||||
return;
|
||||
}
|
||||
|
||||
CloseHandle(handle);
|
||||
|
||||
m_current_drives.erase(it);
|
||||
break;
|
||||
|
@ -198,7 +200,7 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
DEVICE_NOTIFY_WINDOW_HANDLE // type of recipient handle
|
||||
);
|
||||
break;
|
||||
/*
|
||||
|
||||
case WM_DEVICECHANGE:
|
||||
{
|
||||
if(wParam == DBT_DEVICEREMOVECOMPLETE)
|
||||
|
@ -207,7 +209,7 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
|||
}
|
||||
}
|
||||
break;
|
||||
*/
|
||||
|
||||
default:
|
||||
// Send all other messages on to the default windows handler.
|
||||
lRet = DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
|
Loading…
Reference in a new issue