| Summary: | Can't get HINSTANCE of my window | ||
|---|---|---|---|
| Product: | SDL | Reporter: | realitix <realitix> |
| Component: | video | Assignee: | realitix <realitix> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P2 | CC: | realitix, sezeroz |
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Windows (All) | ||
| Attachments: |
First revision of the patch
Rev2 Patch set 3 - Compiled, Tested, Working |
||
|
Description
realitix
2016-11-10 18:12:01 UTC
You should be able to use GetModuleHandle(NULL) for the hinstance. Please reopen this bug if that doesn't work for you. Hi Sam Lantinga, indeed I could use GetModuleHandle but that would require to use the Windows library. SDL2 is cross plateform and maybe should be in charge of this kind of things. Moreover, you could say "why this property and not another one..", because Vulkan needs it so the HINSTANCE property becomes a lot more important to get. In some context, it can be difficult to get the HINSTANCE, indeed, I'm using pySDL2 (Python) and I can only access properties that SDL2 gives me. I have to use a dirty trick like that to get the HINSTANCE: (https://raw.githubusercontent.com/bglgwyng/pyVulkan/master/examples/win32misc.py) I could add: why SDL2 provides HDC and not HINSTANCE ? Thanks, Jean-Sébastien It totally could, I'll add that to my TODO list. Also I'm going to see if we can add some cross-platform Vulkan support so you don't have to do those tricks. I'm doing it. It will help me to understand SDL2 code. Sam Lantigua, can you tell me the procedure to make a pull request ? Created attachment 2633 [details]
First revision of the patch
Here my first patch,
please review it and let me know what you think about it.
Created attachment 2634 [details]
Rev2
(In reply to realitix from comment #6) > Created attachment 2634 [details] > Rev2 This will fail to build for _WIN64. GetWindowLong() needs replacing to GetWindowLongPtr(), and GWL_HINSTANCE needs replacing to GWLP_HINSTANCE. Thanks for your feedback, I'm working on it Created attachment 2636 [details]
Patch set 3 - Compiled, Tested, Working
This patch works great.
It works on 32 and 64 bits Windows.
Implemented, thanks! https://hg.libsdl.org/SDL/rev/fbd8834ba7b8 |