5 ms·
Use ChatGPT! It's night and day for Win32 dev in my experience, and the code it produces is really good. One thing to note before going into Win32: You're goin
by jansommer 3y ago
Use ChatGPT! It's night and day for Win32 dev in my experience, and the code it produces is really good.
One thing to note before going into Win32: You're going to have a pixelated, upscaled ui if you don't take care of high dpi support yourself, and that involves patching system controls. So prepare yourself for lots of dpi-work if that's a concern. (One thing I've been experimenting with is superclassing the system controls and "overwriting" the original by registering a superclass of eg. the edit control as simply "edit". This makes other system controls, like the combobox, use your dpi scaled/custom version).
- zerr 3y agoExactly my experience. In general, for the sane person, it is impossible to write more than a few lines of Win32 API code without copy/paste... ChatGPT came quite handy here.
- dataflow 3y agoI'm confused. Are you sure high DPI needs patching system controls to avoid pixelation? Doesn't dpiAwareness avoid the pixelation? I certainly haven't needed to patch anything for this in the past. If you have an example you could point to, that would be great, since I don't know if I'm missing something here. Also, question: do you know of a good way to test for high-DPI mode on a low-DPI screen?
- masfuerte 3y agoYou just need to add a manifest to your app indicating that you support high DPI. To test your app just change the DPI in the display settings.
- dataflow 3y agoI guess I was hoping for something little clunky than that, but thanks for the suggestion.
- jansommer 3y agoNope, you get the pleasure of implementing dpi support yourself. https://building.enlyze.com/posts/writing-win32-apps-like-its-2020-part-3/ https://building.enlyze.com/posts/writing-win32-apps-like-it...
- dataflow 3y agoThanks for the link. Glancing at it, I still don't see where there's a need to patch system controls for high DPI support, though. The closest thing I see there is for changing their fonts, but that seems different from patching them (no superclassing that I can see, etc.). Moreover, it's for dynamic DPI support (i.e. supporting DPI changes), not high DPI support. Is that what you were referring to?
- jansommer 3y agoI think you should try a plain win32 program on a high dpi and just see for yourself.
- dataflow 3y agoThat's not exactly a... helpful answer. In fact I already have a Win32 (dialog-based, if that makes any difference) one that looks just fine on 200% DPI on Windows 10. All it required handling was scaling the obvious stuff (icon sizes, overall window size, etc.) and the manifest, nothing that required superclassing or otherwise patching common controls. i.e. I just haven't run into the problem you're mentioning. I'm kind of confused why you linked to an article that doesn't support your claim either. Hence why I'm asking you instead of spending hours trying to reproduce what you're saying.
- jansommer 3y agoI don't know why you assume I'm here to give you helpful answers, but I'll bite. Try a combo box on high dpi. The arrow button gets a lot thinner than on 96 dpi.