xsharp.eu • Strange behavior with Size/Getwindowrect/setwindowpos
Page 1 of 1

Strange behavior with Size/Getwindowrect/setwindowpos

Posted: Mon Jul 10, 2017 12:16 pm
by ArneOrtlinghaus
I have a strange behavior in the dotnet version of our programs: Modal Dialogwindows (inherited from dialogwindow) return with the access Size a width/height that is exactly 10 points larger than the real size of the window or the size returned by the Win32 version. The same values are returned using getwindowrect directly. Getclientrect returns the same values as the Win32 version. The assign size/Setwindowpos behaves similarly: It sizes the window 10 points smaller than the sizes passed to, so that odlg:size := odlg:size works ok.

This happens on different operating systems with Visual themes enabled or not. Without sizing the windows the windows are displayed in the same size as in Win32. It is independent of the size and position of the window. The sizes of dtawindows are ok. It must be related to a Windows behavior. A work around could be simple, but I want to understand this behavior.

Strange behavior with Size/Getwindowrect/setwindowpos

Posted: Mon Jul 10, 2017 1:03 pm
by Chris
Hi Arne,

I made a test, created an Mdi app in VO which only shows DialogWindow and displays its Size, then ported it to X#, both versions do show the same value for Size. So I think there's something additional that's playing in role in the behavior you're seeing in your app, but it's too hard to imagine what. Maybe some other code that executes differently in VO/x# for some reason? Please also create a small test app with a simple dialog, does it show the same behavior?

Chris

Strange behavior with Size/Getwindowrect/setwindowpos

Posted: Mon Jul 10, 2017 1:50 pm
by ArneOrtlinghaus
Hi Chris,
thank you for the response.
it is true that it does not happen with a small test project with the standard libraries.

Only at the moment I have no idea what it can be and it is difficult and/or time takting for me to separate the code. I looked at the problem different times and I was surprised that the WinAPI functions delivered values that are different from what is really displayed.

Currently it is not very important. For the moment I have created an access/assign Size that helps resolving the issue subtracting/adding 10 points(pixel). Probably in the future months I will try to look further into the details.

Arne