From 004af0b963f80212a7d3a4f81e5f21d20d8d1841 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 May 2018 23:25:15 +0200 Subject: [PATCH] Use correct DDE callback signature in Win64 build Don't use the deprecated since Win16 (!) and doing nothing MakeProcInstance() and fix the signature of DDECallback() which was actually wrong in Win64 build but the problem was hidden due to the casts done inside and outside MakeProcInstance() before. Remove this macro and fix the signature to actually conform to the real callback one. This also fixes another gcc8 -Wcast-function-type warning. --- src/msw/dde.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index ad8b5d4a63..ccea317306 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -66,14 +66,14 @@ static void DDEDeleteConnection(HCONV hConv); static wxDDEServer *DDEFindServer(const wxString& s); extern "C" HDDEDATA EXPENTRY -_DDECallback(WORD wType, - WORD wFmt, +_DDECallback(UINT wType, + UINT wFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, - DWORD lData1, - DWORD lData2); + ULONG_PTR lData1, + ULONG_PTR lData2); // Add topic name to atom table before using in conversations static HSZ DDEAddAtom(const wxString& string); @@ -149,9 +149,7 @@ extern void wxDDEInitialize() if ( !DDEInitialized ) { // Should insert filter flags - PFNCALLBACK callback = (PFNCALLBACK) - MakeProcInstance((FARPROC)_DDECallback, wxGetInstance()); - UINT rc = DdeInitialize(&DDEIdInst, callback, APPCLASS_STANDARD, 0L); + UINT rc = DdeInitialize(&DDEIdInst, _DDECallback, APPCLASS_STANDARD, 0L); if ( rc != DMLERR_NO_ERROR ) { DDELogError(wxT("Failed to initialize DDE"), rc); @@ -773,14 +771,14 @@ bool wxDDEConnection::DoAdvise(const wxString& item, #define DDERETURN HDDEDATA HDDEDATA EXPENTRY -_DDECallback(WORD wType, - WORD wFmt, +_DDECallback(UINT wType, + UINT wFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, - DWORD WXUNUSED(lData1), - DWORD WXUNUSED(lData2)) + ULONG_PTR WXUNUSED(lData1), + ULONG_PTR WXUNUSED(lData2)) { switch (wType) {