0

I have a very strange problem. I use D2007 on Win7 platform.

My application runs fine on the first Win7 machine (mine) but the UI doesn't refresh it correctly on a second Win7 system (a samsung tablet).

I use remote debugging on the Tablet. After a long cycle of evaluation and debugging, I see that the WM_SIZE isn't lauched to one of my frames. Each frame is included on her parent and Align = alClient.

On my machine, this message is well sent and, of course, the UI has the right behavior.

Which external function of the Windows Unit send the WM_Size message code ?


I will explain the problem with more details.

I see a different behaviour of the UI refresh between my two Win7 machines when the application is maximized or resized.

Some of the frames are correctly resized but one of them isn't. The structure is the following :

MainForm -> Some Frames -> PageControl -> TabSheet -> Frame1 -> Frame2.

Note that :

  • my UI runs correctly on a majority of computers.

  • I use the standard windows mechanism

In this structure, all the frames until to TabSheet included are resized but Frame1 is not. The frames are created in run-time.

Because I know the name of the TabSheet, I could stop on a break point and view the WMSize.

I use some conditionnal break points in TWinControl.AlignControls and catch the handle of Frame1.

With a break point on Classes.StdWndProc, I could follow the messages sent to Frame1.Handle.

When all is OK:

  • $0046 : WM_WINDOWPOSCHANGING

  • $0083 : WM_NCCALCSIZE

  • $0085 : WM_NCPAINT

  • $0014 : WM_ERASEBKGND

  • $0047 : WM_WINDOWPOSCHANGED

  • $0005 : WM_SIZE

And when the resize failed:

  • $0046 : WM_WINDOWPOSCHANGING

  • $0085 : WM_NCPAINT

  • $0014 : WM_ERASEBKGND

  • $0047 : WM_WINDOWPOSCHANGED

Because, the code is the same and the OS is a Win7 in both cases, I don't understand the problem. I just know the two message WM_NCCALCSIZE and WM_SIZE are never sent in the second case.

And that's why I look for the functions that return a WM_SIZE response.

NGLN
  • 43,011
  • 8
  • 105
  • 200
  • 3
    WM_SIZE messages are sent by the system window manager. That's the answer to your question but it's very hard to see how it would help you. I think you asked the wrong question. – David Heffernan Feb 01 '13 at 08:24
  • I've noticed the same behavior at times; My hacky solution was to just maximize my window 1 second after it's shown. You can use a timer for that. Didn't really look too deep at the problem. The hack works, fine with me. – Cosmin Prund Feb 01 '13 at 09:51
  • Please have a look at the Themes & Window Scaling (%75,%100,%125). I've had a similar problem, After I changed the theme (same as mine) the scale factor to %100 percent my application did behave as required. – Ali Avcı Feb 04 '13 at 07:41

2 Answers2

0

WM_SIZE is sent to a window after the size had been changed. That mean the system will automatically send the WM_SIZE to your frame after it change size. To update your frame i suggest to call one of this : + UpdateWindow API + YourFrame.Invalidate or YourFrame.Repaint

Nhat Dung
  • 15
  • 2
0

I give you my response that I couldn't post Friday. I find later that the problem seems to come from a bug of Win7 / VCL D2007. I try with an exe compiled with DXE3 that solves the problem.

NGLN
  • 43,011
  • 8
  • 105
  • 200