Win64 compilation fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-02-10 13:02:51 +00:00
parent af5b273c11
commit 975b6bcf9b
12 changed files with 66 additions and 68 deletions

View File

@@ -18,11 +18,14 @@
// wxSelectedIndices is just a sorted array of indices // wxSelectedIndices is just a sorted array of indices
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) { return n1 - n2; } inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2)
{
return (int)(n1 - n2);
}
WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(size_t, WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(size_t,
wxSizeTCmpFn, wxSizeTCmpFn,
wxSelectedIndices); wxSelectedIndices);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxSelectionStore is used to store the selected items in the virtual // wxSelectionStore is used to store the selected items in the virtual

View File

@@ -249,7 +249,11 @@ private:
// finally, we need this typedef instead of declaring m_buffer directly // finally, we need this typedef instead of declaring m_buffer directly
// because otherwise the assert mentioned above wouldn't compile with some // because otherwise the assert mentioned above wouldn't compile with some
// compilers (notably CodeWarrior 8) // compilers (notably CodeWarrior 8)
#ifdef __WIN64__
typedef char wxCritSectBuffer[40];
#else // __WIN32__
typedef char wxCritSectBuffer[24]; typedef char wxCritSectBuffer[24];
#endif
union union
{ {
unsigned long m_dummy1; unsigned long m_dummy1;

View File

@@ -70,10 +70,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
// colour dialog hook proc // colour dialog hook proc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
UINT CALLBACK wxColourDialogHookProc(HWND hwnd, UINT_PTR CALLBACK
UINT uiMsg, wxColourDialogHookProc(HWND hwnd,
WPARAM WXUNUSED(wParam), UINT uiMsg,
LPARAM lParam) WPARAM WXUNUSED(wParam),
LPARAM lParam)
{ {
if ( uiMsg == WM_INITDIALOG ) if ( uiMsg == WM_INITDIALOG )
{ {

View File

@@ -127,7 +127,7 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// the pointer to standard radio button wnd proc // the pointer to standard radio button wnd proc
static WXFARPROC gs_wndprocEdit = (WXFARPROC)NULL; static WNDPROC gs_wndprocEdit = (WNDPROC)NULL;
// ============================================================================ // ============================================================================
// implementation // implementation
@@ -409,12 +409,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
// edit control, we must subclass it as well // edit control, we must subclass it as well
if ( !(style & wxCB_READONLY) ) if ( !(style & wxCB_READONLY) )
{ {
gs_wndprocEdit = (WXFARPROC)::SetWindowLong gs_wndprocEdit = wxSetWindowProc((HWND)GetEditHWND(),
( wxComboEditWndProc);
(HWND)GetEditHWND(),
GWL_WNDPROC,
(LPARAM)wxComboEditWndProc
);
} }
// and finally, show the control // and finally, show the control

View File

@@ -1073,13 +1073,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds)
} }
// and subclass it // and subclass it
FARPROC windowProc = MakeProcInstance wxSetWindowProc(ms_hwndRas, wxRasStatusWindowProc);
(
(FARPROC)wxRasStatusWindowProc,
wxGetInstance()
);
::SetWindowLong(ms_hwndRas, GWL_WNDPROC, (LONG) windowProc);
} }
m_data.hWnd = ms_hwndRas; m_data.hWnd = ms_hwndRas;

View File

@@ -50,10 +50,10 @@
LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg, LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
WPARAM wParam, LPARAM lParam); WPARAM wParam, LPARAM lParam);
UINT CALLBACK wxFindReplaceDialogHookProc(HWND hwnd, UINT_PTR CALLBACK wxFindReplaceDialogHookProc(HWND hwnd,
UINT uiMsg, UINT uiMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin macros // wxWin macros
@@ -201,14 +201,11 @@ void wxFindReplaceDialogImpl::SubclassDialog(HWND hwnd)
// as then we'd have infinite recursion in wxFindReplaceWindowProc // as then we'd have infinite recursion in wxFindReplaceWindowProc
if ( !wxCheckWindowWndProc((WXHWND)hwnd, (WXFARPROC)wxFindReplaceWindowProc) ) if ( !wxCheckWindowWndProc((WXHWND)hwnd, (WXFARPROC)wxFindReplaceWindowProc) )
{ {
WNDPROC oldParentWndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_WNDPROC); // set the new one and save the old as user data to allow access to it
// save old wnd proc elsewhere to access it from // from wxFindReplaceWindowProc
// wxFindReplaceWindowProc m_oldParentWndProc = wxSetWindowProc(hwnd, wxFindReplaceWindowProc);
m_oldParentWndProc = oldParentWndProc;
(void)::SetWindowLong(hwnd, GWL_USERDATA, (LONG)oldParentWndProc);
// and set the new one wxSetWindowUserData(hwnd, m_oldParentWndProc);
(void)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG)wxFindReplaceWindowProc);
} }
} }
@@ -219,7 +216,8 @@ wxFindReplaceDialogImpl::~wxFindReplaceDialogImpl()
if ( m_hwndOwner ) if ( m_hwndOwner )
{ {
::SetWindowLong(m_hwndOwner, GWL_WNDPROC, (LONG)m_oldParentWndProc); // undo subclassing
wxSetWindowProc(m_hwndOwner, m_oldParentWndProc);
} }
} }
@@ -327,7 +325,7 @@ LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
s_lastMsgFlags = 0; s_lastMsgFlags = 0;
#endif // wxUSE_UNICODE_MSLU #endif // wxUSE_UNICODE_MSLU
WNDPROC wndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_USERDATA); WNDPROC wndProc = (WNDPROC)wxGetWindowUserData(hwnd);
// sanity check // sanity check
wxASSERT_MSG( wndProc != wxFindReplaceWindowProc, wxASSERT_MSG( wndProc != wxFindReplaceWindowProc,
@@ -340,10 +338,11 @@ LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
// Find/replace dialog hook proc // Find/replace dialog hook proc
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
UINT CALLBACK wxFindReplaceDialogHookProc(HWND hwnd, UINT_PTR CALLBACK
UINT uiMsg, wxFindReplaceDialogHookProc(HWND hwnd,
WPARAM WXUNUSED(wParam), UINT uiMsg,
LPARAM lParam) WPARAM WXUNUSED(wParam),
LPARAM lParam)
{ {
if ( uiMsg == WM_INITDIALOG ) if ( uiMsg == WM_INITDIALOG )
{ {

View File

@@ -782,10 +782,10 @@ void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
HWND hwndBtn = (HWND)hWndBtn; HWND hwndBtn = (HWND)hWndBtn;
if ( !s_wndprocRadioBtn ) if ( !s_wndprocRadioBtn )
s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC); s_wndprocRadioBtn = (WXFARPROC)wxGetWindowProc(hwndBtn);
::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc); wxSetWindowProc(hwndBtn, wxRadioBtnWndProc);
::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this); wxSetWindowUserData(hwndBtn, this);
} }
void wxRadioBox::SendNotificationEvent() void wxRadioBox::SendNotificationEvent()
@@ -933,8 +933,8 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
NMHDR* hdr = (NMHDR *)lParam; NMHDR* hdr = (NMHDR *)lParam;
if ( hdr->code == TTN_NEEDTEXT ) if ( hdr->code == TTN_NEEDTEXT )
{ {
wxRadioBox *radiobox = (wxRadioBox *) wxRadioBox *
::GetWindowLong(hwnd, GWL_USERDATA); radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
wxCHECK_MSG( radiobox, 0, wxCHECK_MSG( radiobox, 0,
wxT("radio button without radio box?") ); wxT("radio button without radio box?") );
@@ -955,8 +955,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
case WM_KEYDOWN: case WM_KEYDOWN:
{ {
wxRadioBox *radiobox = (wxRadioBox *) wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
::GetWindowLong(hwnd, GWL_USERDATA);
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
@@ -1015,8 +1014,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
case WM_SETFOCUS: case WM_SETFOCUS:
case WM_KILLFOCUS: case WM_KILLFOCUS:
{ {
wxRadioBox *radiobox = (wxRadioBox *) wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
::GetWindowLong(hwnd, GWL_USERDATA);
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
@@ -1034,8 +1032,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
#ifdef __WIN32__ #ifdef __WIN32__
case WM_HELP: case WM_HELP:
{ {
wxRadioBox *radiobox = (wxRadioBox *) wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
::GetWindowLong(hwnd, GWL_USERDATA);
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") ); wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );

View File

@@ -149,7 +149,7 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
wxSpinCtrl *spin = (wxSpinCtrl *)::GetWindowLong(hwnd, GWL_USERDATA); wxSpinCtrl *spin = (wxSpinCtrl *)wxGetWindowUserData(hwnd);
// forward some messages (the key and focus ones only so far) to // forward some messages (the key and focus ones only so far) to
// the spin ctrl // the spin ctrl
@@ -170,7 +170,7 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
spin->MSWWindowProc(message, wParam, lParam); spin->MSWWindowProc(message, wParam, lParam);
// The control may have been deleted at this point, so check. // The control may have been deleted at this point, so check.
if (!(::IsWindow(hwnd) && ((wxSpinCtrl *)::GetWindowLong(hwnd, GWL_USERDATA)) == spin)) if ( !::IsWindow(hwnd) || wxGetWindowUserData(hwnd) != spin )
return 0; return 0;
break; break;
@@ -186,8 +186,7 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
/* static */ /* static */
wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy) wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy)
{ {
wxSpinCtrl *spin = (wxSpinCtrl *)::GetWindowLong((HWND)hwndBuddy, wxSpinCtrl *spin = (wxSpinCtrl *)wxGetWindowUserData((HWND)hwndBuddy);
GWL_USERDATA);
int i = ms_allSpins.Index(spin); int i = ms_allSpins.Index(spin);
@@ -363,9 +362,9 @@ bool wxSpinCtrl::Create(wxWindow *parent,
SetValue(initial); SetValue(initial);
// subclass the text ctrl to be able to intercept some events // subclass the text ctrl to be able to intercept some events
m_wndProcBuddy = (WXFARPROC)::GetWindowLong(GetBuddyHwnd(), GWL_WNDPROC); wxSetWindowUserData(GetBuddyHwnd(), this);
::SetWindowLong(GetBuddyHwnd(), GWL_USERDATA, (LONG)this); m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(),
::SetWindowLong(GetBuddyHwnd(), GWL_WNDPROC, (LONG)wxBuddyTextWndProc); wxBuddyTextWndProc);
// should have the same font as the other controls // should have the same font as the other controls
SetFont(GetParent()->GetFont()); SetFont(GetParent()->GetFont());

View File

@@ -688,7 +688,7 @@ struct wxStreamOutData
}; };
DWORD CALLBACK DWORD CALLBACK
wxRichEditStreamOut(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb) wxRichEditStreamOut(DWORD_PTR dwCookie, BYTE *buf, LONG cb, LONG *pcb)
{ {
*pcb = 0; *pcb = 0;

View File

@@ -902,7 +902,7 @@ bool wxThread::SetConcurrency(size_t level)
// get system affinity mask first // get system affinity mask first
HANDLE hProcess = ::GetCurrentProcess(); HANDLE hProcess = ::GetCurrentProcess();
DWORD dwProcMask, dwSysMask; DWORD_PTR dwProcMask, dwSysMask;
if ( ::GetProcessAffinityMask(hProcess, &dwProcMask, &dwSysMask) == 0 ) if ( ::GetProcessAffinityMask(hProcess, &dwProcMask, &dwSysMask) == 0 )
{ {
wxLogLastError(_T("GetProcessAffinityMask")); wxLogLastError(_T("GetProcessAffinityMask"));
@@ -983,7 +983,8 @@ bool wxThread::SetConcurrency(size_t level)
return false; return false;
} }
#endif #endif // !__WXWINCE__
return true; return true;
} }

View File

@@ -217,8 +217,7 @@ WXHWND wxToolTip::GetToolTipCtrl()
#if wxUSE_TTM_WINDOWFROMPOINT #if wxUSE_TTM_WINDOWFROMPOINT
// subclass the newly created control // subclass the newly created control
gs_wndprocToolTip = (WNDPROC)::GetWindowLong(hwnd, GWL_WNDPROC); gs_wndprocToolTip = wxSetWindowProc(hwnd, wxToolTipWndProc);
::SetWindowLong(hwnd, GWL_WNDPROC, (long)wxToolTipWndProc);
#endif // wxUSE_TTM_WINDOWFROMPOINT #endif // wxUSE_TTM_WINDOWFROMPOINT
} }
} }

View File

@@ -974,13 +974,13 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
wxAssociateWinWithHandle(hwnd, this); wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC)::GetWindowLong((HWND)hWnd, GWL_WNDPROC); m_oldWndProc = (WXFARPROC)wxGetWindowProc((HWND)hWnd);
// we don't need to subclass the window of our own class (in the Windows // we don't need to subclass the window of our own class (in the Windows
// sense of the word) // sense of the word)
if ( !wxCheckWindowWndProc(hWnd, (WXFARPROC)wxWndProc) ) if ( !wxCheckWindowWndProc(hWnd, (WXFARPROC)wxWndProc) )
{ {
::SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc); wxSetWindowProc(hwnd, wxWndProc);
} }
else else
{ {
@@ -1008,7 +1008,7 @@ void wxWindowMSW::UnsubclassWin()
{ {
if ( !wxCheckWindowWndProc((WXHWND)hwnd, m_oldWndProc) ) if ( !wxCheckWindowWndProc((WXHWND)hwnd, m_oldWndProc) )
{ {
::SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc); wxSetWindowProc(hwnd, (WNDPROC)m_oldWndProc);
} }
m_oldWndProc = NULL; m_oldWndProc = NULL;
@@ -3678,8 +3678,13 @@ wxWindowMSW::MSWOnMeasureItem(int WXUNUSED_UNLESS_ODRAWN(id),
wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE ); wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth, size_t w, h;
&pMeasureStruct->itemHeight); bool rc = pMenuItem->OnMeasureItem(&w, &h);
pMeasureStruct->itemWidth = w;
pMeasureStruct->itemHeight = h;
return rc;
} }
wxControl *item = wxDynamicCast(FindItem(id), wxControl); wxControl *item = wxDynamicCast(FindItem(id), wxControl);
@@ -5103,7 +5108,7 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd)
// do it as well, win would be already non NULL // do it as well, win would be already non NULL
if ( ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON ) if ( ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON )
{ {
win = (wxWindow *)::GetWindowLong(hwnd, GWL_USERDATA); win = (wxWindow *)wxGetWindowUserData(hwnd);
} }
//else: it's a wxRadioButton, not a radiobutton from wxRadioBox //else: it's a wxRadioButton, not a radiobutton from wxRadioBox
#endif // wxUSE_RADIOBOX #endif // wxUSE_RADIOBOX