Today one of my customers pointed me to this issue. I am calling Win32 in order to enable HiDPI support for a windows app.
I do this within try…end try exception handling but on program start he still recieves this error message on Windows without HiDPI support (Win2003 Server).
Any clue why try… end try does not catch this error?
Can you post the code you’re using?
dim b as Boolean = false
// enable HiDPI
Declare Function SetProcessDPIAware Lib "user32" () As Boolean
b = SetProcessDPIAware
Does it happen on XP Machines only?
You have to use Soft Declare and check the function is available first of calling it.
I do not think Xojo is able to catch an error triggered by a declare. This does not look like a Xojo Exception.
The function is indeed part of User32.dll https://msdn.microsoft.com/en-us/library/windows/desktop/ms633543(v=vs.85).aspx but what the error states is that it cannot find it.
I believe it is because Windows Server 2003 is not supported :
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
The error is the requested function is not available on the system.
That’s why soft declaring it permits the application to run at least.
Then, using the IsFunctionAvailable() method you can check if the system support it and if so proceeding calling the function.
This is the right way to proceed with declares.
Yes! Thank you Massino… never used soft declares before… hopfully all cocoa declares are already soft… now I have to change all my apps sigh
Cocoa declares are always soft.