INT_PTR CALLBACK AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
AboutDlgData* dlgData =
- reinterpret_cast<AboutDlgData*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ reinterpret_cast<AboutDlgData*>(GetWindowLongPtr(hDlg, DWLP_USER));
switch (msg) {
case WM_INITDIALOG: {
dlgData = new AboutDlgData();
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(dlgData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(dlgData));
dlgData->hTabCtrl = GetDlgItem(hDlg, IDC_ABOUT_TAB);
case WM_DESTROY:
DeleteObject(dlgData->hTitleFont);
delete dlgData;
- SetWindowLongPtrW(hDlg, GWLP_USERDATA, 0);
+ SetWindowLongPtrW(hDlg, DWLP_USER, 0);
return 0;
case WM_CLOSE:
EndDialog(hDlg, 0);
INT_PTR CALLBACK LogDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
auto *dlgData =
- reinterpret_cast<LogDlgData *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ reinterpret_cast<LogDlgData *>(GetWindowLongPtr(hDlg, DWLP_USER));
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
switch (msg) {
case WM_INITDIALOG:
{
dlgData = new LogDlgData();
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(dlgData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(dlgData));
WMi18n &i18n = WMi18n::GetInstance();
SetWindowText(hDlg, i18n.GetTranslationW("log.title").c_str());
}
case WM_DESTROY:
delete dlgData;
- SetWindowLongPtrW(hDlg, GWLP_USERDATA, 0);
+ SetWindowLongPtrW(hDlg, DWLP_USER, 0);
WMLog::GetInstance().UnregisterForLogUpdates(hDlg);
return 0;
case WM_CLOSE:
INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
SettingsDlgData* dlgData =
- reinterpret_cast<SettingsDlgData*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ reinterpret_cast<SettingsDlgData*>(GetWindowLongPtr(hDlg, DWLP_USER));
switch (msg) {
case WM_INITDIALOG: {
WMi18n &i18n = WMi18n::GetInstance();
assert(dlgData == nullptr);
WMSettings* settings = reinterpret_cast<WMSettings*>(lParam);
dlgData = new SettingsDlgData(settings);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(dlgData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(dlgData));
dlgData->hTabCtrl = GetDlgItem(hDlg, IDC_SETTINGS_TAB);
return TRUE;
case WM_DESTROY:
delete dlgData;
- SetWindowLongPtrW(hDlg, GWLP_USERDATA, 0);
+ SetWindowLongPtrW(hDlg, DWLP_USER, 0);
return 0;
default:
break;
if (btDeviceData == nullptr) {
return FALSE;
}
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(btDeviceData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(btDeviceData));
LoadBluetoothAddDlgTranslation(hDlg, btDeviceData->devName.length() != 0);
if (btDeviceData->devName.length() != 0) {
SetWindowTextW(GetDlgItem(hDlg, IDC_BT_DEVICE_NAME),
const int textLen = Edit_GetTextLength(hDevName);
if (textLen != 0) {
wchar_t devNameBuf[BT_DEV_NAME_MAX_LEN + 1] = { 'L\0' };
- BtDeviceData* btDevName = reinterpret_cast<BtDeviceData*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ BtDeviceData* btDevName = reinterpret_cast<BtDeviceData*>(GetWindowLongPtr(hDlg, DWLP_USER));
if (btDevName != nullptr) {
Edit_GetText(hDevName, devNameBuf, ARRAY_SIZE(devNameBuf));
btDevName->devName = devNameBuf;
WMSettings* settings = reinterpret_cast<WMSettings*>(lParam);
assert(settings != nullptr);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(settings));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(settings));
DWORD enabled = settings->QueryValue(SettingsKey::MUTE_ON_BLUETOOTH);
return 0;
}
case WM_SAVESETTINGS: {
- WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, DWLP_USER));
std::vector<std::wstring> devices = ExportBluetoothDeviceList(GetDlgItem(hDlg, IDC_BLUETOOTH_LIST));
settings->StoreBluetoothDevices(devices);
dlgData->settings = reinterpret_cast<WMSettings *>(lParam);
assert(dlgData->settings != nullptr);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(dlgData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(dlgData));
FillLanguageList(GetDlgItem(hDlg, IDC_LANGUAGE), *dlgData);
return TRUE;
}
case WM_DESTROY: {
- SettingsGeneralData *dlgData = reinterpret_cast<SettingsGeneralData *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ SettingsGeneralData *dlgData = reinterpret_cast<SettingsGeneralData *>(GetWindowLongPtr(hDlg, DWLP_USER));
if (dlgData != nullptr) {
delete dlgData;
- SetWindowLongPtr(hDlg, GWLP_USERDATA, 0);
+ SetWindowLongPtr(hDlg, DWLP_USER, 0);
}
return FALSE;
}
return 0;
}
case WM_SAVESETTINGS: {
- SettingsGeneralData *dlgData = reinterpret_cast<SettingsGeneralData *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ SettingsGeneralData *dlgData = reinterpret_cast<SettingsGeneralData *>(GetWindowLongPtr(hDlg, DWLP_USER));
assert(dlgData != nullptr);
HWND hAutostart = GetDlgItem(hDlg, IDC_RUNONSTARTUP);
if (endpointData == nullptr) {
return FALSE;
}
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(endpointData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(endpointData));
LoadManageEndpointsAddDlgTranslation(hDlg, endpointData->name.length() != 0);
if (endpointData->name.length() != 0) {
const int textLen = Edit_GetTextLength(hEpName);
if (textLen != 0) {
wchar_t epNameBuf[ENDPOINT_NAME_MAX_LEN + 1] = { 'L\0' };
- EndpointData *epData = reinterpret_cast<EndpointData*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ EndpointData *epData = reinterpret_cast<EndpointData*>(GetWindowLongPtr(hDlg, DWLP_USER));
if (epData != nullptr) {
Edit_GetText(hEpName, epNameBuf, ARRAY_SIZE(epNameBuf));
epData->name = epNameBuf;
WMSettings *settings = reinterpret_cast<WMSettings *>(lParam);
assert(settings != nullptr);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(settings));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(settings));
DWORD endpointMode = settings->QueryValue(SettingsKey::MUTE_INDIVIDUAL_ENDPOINTS_MODE);
if (endpointMode == MUTE_ENDPOINT_MODE_INDIVIDUAL_ALLOW_LIST) {
Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVE), FALSE);
Button_Enable(GetDlgItem(hDlg, IDC_ENDPOINT_REMOVEALL), FALSE);
} else if (LOWORD(wParam) == IDOK) {
- WMSettings *settings = reinterpret_cast<WMSettings *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ WMSettings *settings = reinterpret_cast<WMSettings *>(GetWindowLongPtr(hDlg, DWLP_USER));
std::vector<std::wstring> devices = ExportEndpointNameList(GetDlgItem(hDlg, IDC_ENDPOINT_LIST));
settings->StoreManagedAudioEndpoints(devices);
if (Button_GetCheck(GetDlgItem(hDlg, IDC_ENDPOINT_LIST_IS_ALLOWLIST))) {
WMSettings* settings = reinterpret_cast<WMSettings*>(lParam);
assert(settings != nullptr);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(settings));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(settings));
// General
SetCheckButton(hNotify, *settings, SettingsKey::NOTIFICATIONS_ENABLED);
int isEnabled = Button_GetCheck(GetDlgItem(hDlg, IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY));
Button_Enable(GetDlgItem(hDlg, IDC_MANAGE_ENDPOINTS), isEnabled);
} else if (LOWORD(wParam) == IDC_MANAGE_ENDPOINTS) {
- WMSettings *settings = reinterpret_cast<WMSettings *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ WMSettings *settings = reinterpret_cast<WMSettings *>(GetWindowLongPtr(hDlg, DWLP_USER));
if (!DialogBoxParam(
nullptr,
MAKEINTRESOURCE(IDD_MANAGE_ENDPOINTS),
return 0;
case WM_SAVESETTINGS:
{
- WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, DWLP_USER));
HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS);
HWND hManageEndpoints = GetDlgItem(hDlg, IDC_MANAGE_AUDIO_ENDPOINTS_INDIVIDUALLY);
if (qh_entry == nullptr) {
return FALSE;
}
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(qh_entry));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(qh_entry));
const bool isEdit = qh_entry->start != 0 || qh_entry->end != 0;
LoadQuietHoursAddDlgTranslation(hDlg, isEdit);
nullptr);
return FALSE;
} else {
- auto *qh_entry = reinterpret_cast<QuietHoursEntry *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ auto *qh_entry = reinterpret_cast<QuietHoursEntry *>(GetWindowLongPtr(hDlg, DWLP_USER));
qh_entry->start = start.wHour * 3600 + start.wMinute * 60 + start.wSecond;
qh_entry->end = end.wHour * 3600 + end.wMinute * 60 + end.wSecond;
EndDialog(hDlg, 0);
auto qhdata = new QuietHoursDlgData();
assert(qhdata != nullptr);
qhdata->settings = settings;
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(qhdata));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(qhdata));
if (IsAppThemed())
{
HWND hForce = GetDlgItem(hDlg, IDC_FORCEUNMUTE);
HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS);
HWND hQuietHoursTimes = GetDlgItem(hDlg, IDC_QUIET_HOURS_TIMES);
- auto qhdata = reinterpret_cast<QuietHoursDlgData *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ auto qhdata = reinterpret_cast<QuietHoursDlgData *>(GetWindowLongPtr(hDlg, DWLP_USER));
const int qhEnabled = Button_GetCheck(hEnable) == BST_CHECKED;
const int qhForceUnmute = Button_GetCheck(hForce) == BST_CHECKED;
{
HWND hQuietHoursTimes = GetDlgItem(hDlg, IDC_QUIET_HOURS_TIMES);
FreeListViewEntries(hQuietHoursTimes);
- auto qhdata = reinterpret_cast<QuietHoursDlgData *>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ auto qhdata = reinterpret_cast<QuietHoursDlgData *>(GetWindowLongPtr(hDlg, DWLP_USER));
delete qhdata;
EndDialog(hDlg, 0);
return TRUE;
if (wifiData == nullptr) {
return FALSE;
}
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(wifiData));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(wifiData));
LoadWifiAddDlgTranslation(hDlg, wifiData->ssidName.length() != 0);
const int textLen = Edit_GetTextLength(hSsid);
if (textLen != 0) {
wchar_t ssidBuf[SSID_MAX_LEN + 1];
- WiFiData* wifiData = reinterpret_cast<WiFiData*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ WiFiData* wifiData = reinterpret_cast<WiFiData*>(GetWindowLongPtr(hDlg, DWLP_USER));
if (wifiData != nullptr) {
Edit_GetText(hSsid, ssidBuf, ARRAY_SIZE(ssidBuf));
wifiData->ssidName = ssidBuf;
LoadWifiDlgTranslation(hDlg);
WMSettings* settings = reinterpret_cast<WMSettings*>(lParam);
assert(settings != nullptr);
- SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(settings));
+ SetWindowLongPtr(hDlg, DWLP_USER, reinterpret_cast<LONG_PTR>(settings));
DWORD enabled = settings->QueryValue(SettingsKey::MUTE_ON_WLAN);
Button_SetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE),
return 0;
}
case WM_SAVESETTINGS: {
- WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+ WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, DWLP_USER));
std::vector<std::wstring> networks = ExportSsidListItems(GetDlgItem(hDlg, IDC_WIFI_LIST));
settings->StoreWifiNetworks(networks);