Menu

#681 CreateWindowFromHandle causes app crash in embedded Win32 app

v1.0 (example)
open
nobody
None
5
2014-09-26
2014-09-26
Egal
No

Python is embedded in our main app.
I use 'Very High Level Embedding' and just call PyRun_SimpleString. The string is created on the fly with the current window handle embedded.
The called script looks something like that:

shellHandle = 0x0...0 #Handle is filled on the fly
import win32api
wnd = win32ui.CreateWindowFromHandle(shellHandle)
wnd.SetWindowText("new window text")

The text of the window has changed but when the script has finished the app crashes.
What happens at the end of the script?
Is Destroy called on wnd? (which should not)

System: Window 8.1 64bit
Python: 3.4.1
Pythonwin: build 219

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.