LRESULT AccountEditorDialog::OnRemove(WORD, WORD, HWND, BOOL&) { int result = MessageBox(L"Are you sure you want to delete the selected account?", L"Confirm Account Deletion", MB_YESNO | MB_ICONWARNING); if(result == IDYES) { int index = _userAccounts.GetSelectedIndex(); if(index == -1) return 0; Account* account = reinterpret_cast<Account*>(_userAccounts.GetItemData(index)); Assert(account != 0); if(account->GetConnectionStatus() == Connecting || account->GetConnectionStatus() == Connected) account->Disconnect(); DestroyAccount(account); Refresh(); } return 0; }