Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Writing High-DPI Win32 Applications
Writing High-DPI Win32 Applications [message #34841] Wed, 14 December 2011 10:45 Go to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I recall a thread wondering about the fuzzyness of TheIDE (and others) when scaling the display to. e.g. 150% on Windows Vista or 7. Now I found an article http://msdn.microsoft.com/en-us/library/dd464660.aspx about Writing High-DPI Win32 Applications.

I added ::SetProcessDPIAware(); call in <CtrlCore/Win32GuiA.h> in GUI_APP_MAIN starting at line 36 as shown below, and got rid of the fuzzyness. Plus all Ctrls I used in my application scaled nicely to 150 %. It is important to note that this call should not be done in a DLL, but instead only in the main application process to avoid race condition. Another way could be adding a manifest, but it seemed like a lot of work to me.

Additionally, this call must be done before reading dpi from Windows, since otherwise Windows reports constantly 96 dpi, and prevents the proper scaling of Ctrls, although fuzzyness may still disappear.

#define GUI_APP_MAIN \
\
void GuiMainFn_();\
\
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nCmdShow) \
{ \
	::SetProcessDPIAware();\
	UPP::Ctrl::InitWin32(hInstance); \
	UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::FromSystemCharset(lpCmdLine)); \
	UPP::AppInitEnvironment__(); \
	GuiMainFn_(); \
	UPP::Ctrl::CloseTopCtrls(); \
	UPP::UsrLog("---------- About to delete this log..."); \
	UPP::DeleteUsrLog(); \
	UPP::Ctrl::ExitWin32(); \
	UPP::AppExit__(); \
	return UPP::GetExitCode(); \
} \
\
void GuiMainFn_()


I do not know, if this breaks anything in your applications, but it seems to me UPP handles this nicely.

Could this be merged?

Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Compile U++
Next Topic: Is U++ compatible with VC++ Express 2012?
Goto Forum:
  


Current Time: Sun Apr 28 01:46:58 CEST 2024

Total time taken to generate the page: 0.05495 seconds