[PATCH] oledb32: Ensure provider is selected before changing tabs.
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Feb 18 15:29:27 CST 2020
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/oledb32/dslocator.c | 35 +++++++++++++++++++++++++++++++----
dlls/oledb32/resource.h | 2 ++
dlls/oledb32/version.rc | 3 +++
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/dlls/oledb32/dslocator.c b/dlls/oledb32/dslocator.c
index 11ee76cddb..006330b004 100644
--- a/dlls/oledb32/dslocator.c
+++ b/dlls/oledb32/dslocator.c
@@ -274,13 +274,40 @@ static LRESULT CALLBACK data_link_properties_dlg_proc(HWND hwnd, UINT msg, WPARA
break;
}
- case WM_COMMAND:
+ case WM_NOTIFY:
{
- if (LOWORD(wp) == IDC_BTN_NEXT)
+ NMHDR *hdr = ((LPNMHDR)lp);
+ switch(hdr->code)
{
- /* TODO: Implement Connection dialog */
- MessageBoxA(hwnd, "Not implemented yet.", "Error", MB_OK | MB_ICONEXCLAMATION);
+ case PSN_KILLACTIVE:
+ {
+ /*
+ * FIXME: This needs to replace the connection page based off the selection.
+ * We only care about the ODBC for now which is the default.
+ */
+
+ HWND lv = GetDlgItem(hwnd, IDC_LST_CONNECTIONS);
+ if (!SendMessageW(lv, LVM_GETSELECTEDCOUNT, 0, 0))
+ {
+ WCHAR title[256], msg[256];
+
+ LoadStringW(instance, IDS_PROVIDER_TITLE, title, ARRAY_SIZE(title));
+ LoadStringW(instance, IDS_PROVIDER_ERROR, msg, ARRAY_SIZE(msg));
+ MessageBoxW(hwnd, msg, title, MB_OK | MB_ICONEXCLAMATION);
+ SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+
+ return FALSE;
+ }
}
+
+ break;
+ }
+ case WM_COMMAND:
+ {
+ if (LOWORD(wp) == IDC_BTN_NEXT)
+ SendMessageW(GetParent(hwnd), PSM_SETCURSEL, 1, 0);
break;
}
default:
diff --git a/dlls/oledb32/resource.h b/dlls/oledb32/resource.h
index 3760a38487..dfedb34a54 100644
--- a/dlls/oledb32/resource.h
+++ b/dlls/oledb32/resource.h
@@ -19,6 +19,8 @@
#define IDD_PROVIDER 1000
#define IDC_BTN_NEXT 1001
#define IDC_LST_CONNECTIONS 1002
+#define IDS_PROVIDER_TITLE 1003
+#define IDS_PROVIDER_ERROR 1004
#define IDS_PROPSHEET_TITLE 2000
#define IDS_COL_PROVIDER 2001
diff --git a/dlls/oledb32/version.rc b/dlls/oledb32/version.rc
index 97714086eb..080e444eb7 100644
--- a/dlls/oledb32/version.rc
+++ b/dlls/oledb32/version.rc
@@ -45,6 +45,9 @@ STRINGTABLE
IDS_PERM_SHAREDENYWRITE "Share Deny Write"
IDS_PERM_SHAREEXCLUSIVE "Share Exclusive"
IDS_PERM_WRITE "Write"
+
+ IDS_PROVIDER_TITLE "Data Link Error"
+ IDS_PROVIDER_ERROR "Please select a provider."
}
IDD_PROVIDER DIALOG 0, 0, 227, 225
--
2.25.0
More information about the wine-devel
mailing list