Skip to content

Commit 572e657

Browse files
authored
Assume MFC >=9 (VS 2008) (#2669)
1 parent b5b389d commit 572e657

File tree

7 files changed

+10
-73
lines changed

7 files changed

+10
-73
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Coming in build 312, as yet unreleased
2323
This removes the following constants:
2424
* `win32con.FILE_ATTRIBUTE_ATOMIC_WRITE`
2525
* `win32con.FILE_ATTRIBUTE_XACTION_WRITE`
26+
* Removed considerations for MFC < 9 (VS 2008) (mhammond#2669, [@Avasam][Avasam])
27+
* This removes the unusable `PyCSliderCtrl.VerifyPos` method
2628

2729
Build 311, released 2025/07/14
2830
------------------------------

Pythonwin/win32control.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,25 +1855,6 @@ static PyObject *PyCSliderCtrl_clear_sel(PyObject *self, PyObject *args)
18551855
RETURN_NONE;
18561856
}
18571857

1858-
// @pymethod int|PyCSliderCtrl|VerifyPos|Verify the position is between configured min and max
1859-
static PyObject *PyCSliderCtrl_verify_pos(PyObject *self, PyObject *args)
1860-
{
1861-
CHECK_NO_ARGS(args);
1862-
CSliderCtrl *pSC = GetSliderCtrl(self);
1863-
if (!pSC)
1864-
return NULL;
1865-
#if _MFC_VER >= 0x0710
1866-
// This just vanished in VS7
1867-
PyErr_SetString(PyExc_NotImplementedError, "VerifyPos does not appear in this version of MFC");
1868-
return NULL;
1869-
#else
1870-
GUI_BGN_SAVE;
1871-
pSC->VerifyPos();
1872-
GUI_END_SAVE;
1873-
#endif
1874-
RETURN_NONE;
1875-
}
1876-
18771858
// @pymethod int|PyCSliderCtrl|ClearTics|Clear the control's tic marks
18781859
static PyObject *PyCSliderCtrl_clear_tics(PyObject *self, PyObject *args)
18791860
{
@@ -1919,7 +1900,6 @@ static struct PyMethodDef PyCSliderCtrl_methods[] = {
19191900
{"SetTic", PyCSliderCtrl_set_tic, 1}, // @pymeth SetTic|Set a tick at the position
19201901
{"SetTicFreq", PyCSliderCtrl_set_tic_freq, 1}, // @pymeth SetTicFreq|Set the tic mark frequency
19211902
{"ClearSel", PyCSliderCtrl_clear_sel, 1}, // @pymeth ClearSel|Clear any control selection
1922-
{"VerifyPos", PyCSliderCtrl_verify_pos, 1}, // @pymeth VerifyPos|Verify the positon between min and max
19231903
{"ClearTics", PyCSliderCtrl_clear_tics, 1}, // @pymeth ClearTics|Clear any tic marks from the control
19241904
{NULL, NULL}};
19251905

Pythonwin/win32prop.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,9 @@ PyObject *ui_propsheet_press_button(PyObject *self, PyObject *args)
440440
if (!PyArg_ParseTuple(args, "i", &button))
441441
return NULL;
442442
GUI_BGN_SAVE;
443-
BOOL ok = TRUE;
444-
#if _MFC_VER < 0x0710
445-
ok =
446-
#endif
447-
pPS->PressButton(button);
448-
443+
pPS->PressButton(button);
449444
GUI_END_SAVE;
450-
if (!ok)
451-
RETURN_ERR("PressButton failed");
445+
452446
RETURN_NONE;
453447
}
454448

Pythonwin/win32thread.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,8 @@ void CProtectedWinThread::PumpMessages()
108108
// for tracking the idle time state
109109
BOOL bIdle = TRUE;
110110
LONG lIdleCount = 0;
111-
#if _MFC_VER >= 0x0710
112111
_AFX_THREAD_STATE *pState = AfxGetThreadState();
113112
MSG &msgCur = pState->m_msgCur;
114-
#else
115-
MSG &msgCur = m_msgCur;
116-
#endif /* _MFC_VER_ */
117113

118114
// acquire and dispatch messages until a WM_QUIT message is received.
119115
for (;;) {
@@ -128,11 +124,7 @@ void CProtectedWinThread::PumpMessages()
128124
// pump message, but quit on WM_QUIT
129125
if (!PumpMessage()) {
130126
#if defined(_DEBUG)
131-
#if _MFC_VER < 0x0710
132-
m_nDisablePumpCount--; // application must NOT die
133-
#else
134127
pState->m_nDisablePumpCount--; // application must NOT die
135-
#endif
136128
#endif
137129
return;
138130
}

Pythonwin/win32uiExt.h

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -410,23 +410,16 @@ class CPythonWndFramework : public T {
410410

411411
protected:
412412
static AFX_DATA const AFX_MSGMAP messageMap;
413-
static const AFX_MSGMAP *PASCAL _GetBaseMessageMap()
414-
{
415-
#if _MFC_VER >= 0x0700
416-
return T::GetThisMessageMap();
417-
#else
418-
return &T::messageMap;
419-
#endif /* _MFC_VER */
420-
}
413+
static const AFX_MSGMAP *PASCAL _GetBaseMessageMap() { return T::GetThisMessageMap(); }
421414
virtual const AFX_MSGMAP *GetMessageMap() const { return &messageMap; }
422415
};
423416

424417
template <class T>
425418
AFX_DATADEF const AFX_MSGMAP CPythonWndFramework<T>::messageMap = {&CPythonWndFramework<T>::_GetBaseMessageMap,
426419
&CPythonWndFramework<T>::_messageEntries[0]};
427420

428-
// ack - compile error in MFC9 (and not x64), and only for ON_WM_NCHITTEST!
429-
#if _MFC_VER >= 0x0900 && !defined(_WIN64)
421+
// ack - compile error on not x64, and only for ON_WM_NCHITTEST!
422+
#if !defined(_WIN64)
430423
#undef ON_WM_NCHITTEST
431424
// from afxmsg_.h - the UINT was originally LRESULT
432425
#define ON_WM_NCHITTEST() \
@@ -1073,14 +1066,7 @@ class CPythonPrtDlgFramework : public CPythonDlgFramework<T> {
10731066
protected:
10741067
static AFX_DATA const AFX_MSGMAP messageMap;
10751068

1076-
static const AFX_MSGMAP *PASCAL _GetBaseMessageMap()
1077-
{
1078-
#if _MFC_VER >= 0x0700
1079-
return T::GetThisMessageMap();
1080-
#else
1081-
return &T::messageMap;
1082-
#endif
1083-
}
1069+
static const AFX_MSGMAP *PASCAL _GetBaseMessageMap() { return T::GetThisMessageMap(); }
10841070
virtual const AFX_MSGMAP *GetMessageMap() const { return &messageMap; }
10851071
};
10861072

Pythonwin/win32uiole.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,11 @@
1414
#include "afxdao.h"
1515
#endif
1616

17-
#if _MFC_VER >= 0x0700
1817
#include "afxocc.h"
1918
// Sorry about this - OLE support needs MFC private header.
2019
// You MUST install MFC with source-code to build this extension.
2120
// (and this source must be in "../src" relative to the MFC
2221
// includes, which it is by default)
23-
#else
24-
#ifndef MFC_OCC_IMPL_H
25-
#error(MFC_OCC_IMPL_H must be set to the location of the MFC source code)
26-
#endif
27-
#include MFC_OCC_IMPL_H
28-
#endif /* _MFC_VER */
2922

3023
extern PyObject *PyCOleClientItem_Create(PyObject *self, PyObject *args);
3124

Pythonwin/win32win.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -889,14 +889,9 @@ static PyObject *ui_window_dlg_dir_select(PyObject *self, PyObject *args)
889889
// @pyparm int|idListbox||The Id of the listbox.
890890
if (!PyArg_ParseTuple(args, "i:DlgDirSelect", &nIDListBox))
891891
return NULL;
892-
int rc;
893892
TCHAR buf[MAX_PATH];
894893
GUI_BGN_SAVE;
895-
#if _MFC_VER >= 0x0800
896-
rc = pWnd->DlgDirSelect(buf, sizeof(buf) / sizeof(TCHAR), nIDListBox);
897-
#else
898-
rc = pWnd->DlgDirSelect(buf, nIDListBox);
899-
#endif
894+
int rc = pWnd->DlgDirSelect(buf, sizeof(buf) / sizeof(TCHAR), nIDListBox);
900895
// @pyseemfc CWnd|DlgDirSelect
901896
GUI_END_SAVE;
902897
if (!rc)
@@ -916,15 +911,10 @@ static PyObject *ui_window_dlg_dir_select_combo(PyObject *self, PyObject *args)
916911
// @pyparm int|idListbox||The Id of the combobox.
917912
if (!PyArg_ParseTuple(args, "i:DlgDirSelectComboBox", &nIDListBox))
918913
return NULL;
919-
int rc;
920914
TCHAR buf[MAX_PATH];
921915
GUI_BGN_SAVE;
922916
// @pyseemfc CWnd|DlgDirSelectComboBox
923-
#if _MFC_VER >= 0x0800
924-
rc = pWnd->DlgDirSelectComboBox(buf, sizeof(buf) / sizeof(TCHAR), nIDListBox);
925-
#else
926-
rc = pWnd->DlgDirSelectComboBox(buf, nIDListBox);
927-
#endif
917+
int rc = pWnd->DlgDirSelectComboBox(buf, sizeof(buf) / sizeof(TCHAR), nIDListBox);
928918
GUI_END_SAVE;
929919
if (!rc)
930920
RETURN_ERR("DlgDirSelectComboBox failed");

0 commit comments

Comments
 (0)