aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/XiteWin.py
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-10-29 17:03:25 +1100
committerNeil <nyamatongwe@gmail.com>2025-10-29 17:03:25 +1100
commit527af5a4ec23792f40dd26dbbc076b006d75369d (patch)
treea8f8bee04146ded4abb0574870b17e32d7a74293 /test/XiteWin.py
parent66185664e71b7cd65fa933467e338c665b2d5b88 (diff)
downloadscintilla-mirror-527af5a4ec23792f40dd26dbbc076b006d75369d.tar.gz
Feature [feature-requests:#1567]. Fix running tests in Visual C++ debugger.
Set optional SCINTILLA_BIN environment variable to point to build directory. It's unclear just what the problem was but Python 3.13 would crash out in window handling code when run inside the debugger and using its HINSTANCE. Changing to a global class and using None for the HINSTANCE made it work. There are various other minor problems here like using c_int (32-bit) for the window procedure return instead of c_ssize_t (64-bit) but they are not worth destabilizing the code further. Example Scintilla.vcxproj.user for debugging a test script with a particular Python interpreter. <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LocalDebuggerCommand>C:\Users\Neil\AppData\Local\Programs\Python\Python313\python.exe</LocalDebuggerCommand> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <LocalDebuggerCommandArguments>G:\u\hg\scintilla\test\simpleTests.py</LocalDebuggerCommandArguments> <LocalDebuggerWorkingDirectory>G:\u\hg\scintilla\test\</LocalDebuggerWorkingDirectory> <LocalDebuggerEnvironment>SCINTILLA_BIN=G:\\u\\hg\\scintilla\\win32\\x64\\Debug</LocalDebuggerEnvironment> </PropertyGroup> </Project>
Diffstat (limited to 'test/XiteWin.py')
-rw-r--r--test/XiteWin.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/XiteWin.py b/test/XiteWin.py
index 9acf6ebfd..030756a06 100644
--- a/test/XiteWin.py
+++ b/test/XiteWin.py
@@ -28,7 +28,8 @@ scintillaScriptsDirectory = os.path.join(scintillaDirectory, "scripts")
sys.path.append(scintillaScriptsDirectory)
import Face
-scintillaBinDirectory = os.path.join(scintillaDirectory, "bin")
+# To debug a particular Scintilla build, set environment variable SCINTILLA_BIN to its directory
+scintillaBinDirectory = os.environ.get('SCINTILLA_BIN', os.path.join(scintillaDirectory, "bin"))
lexillaDirectory = os.path.join(scintillaDirectory, "..", "lexilla")
lexillaBinDirectory = os.path.join(lexillaDirectory, "bin")
@@ -54,6 +55,7 @@ WS_OVERLAPPEDWINDOW = 0xcf0000
WS_VISIBLE = 0x10000000
WS_HSCROLL = 0x100000
WS_VSCROLL = 0x200000
+CS_GLOBALCLASS = 0x4000
WA_INACTIVE = 0
MF_POPUP = 16
MF_SEPARATOR = 0x800
@@ -139,12 +141,12 @@ class WNDCLASS(ctypes.Structure):
('lpzClassName', LPCWSTR),
)
-hinst = ctypes.windll.kernel32.GetModuleHandleW(0)
+hinst = None
def RegisterClass(name, func, background = 0):
# register a window class for toplevel windows.
wc = WNDCLASS()
- wc.style = 0
+ wc.style = CS_GLOBALCLASS
wc.lpfnWndProc = func
wc.cls_extra = 0
wc.wnd_extra = 0