A strange bug was found on the company's products.
On a dual-display machine, when the product's main window is maximized, eight pixels are lost at the left and top boundary. The loss here means that it does not belong to this window anymore. Clicking this area will activate the following window. You can use setjavaswrgn to reset the window area to retrieve the Lost part, but the window will lose the Windows topic and become the classic title bar and border.
Finally, the problem code was identified using the brute force method, and the bug was reproduced through the demo program. The final cause is that a Win32 API updatelayeredwindow causes this problem.
It is easy to reproduce this bug. Create an MFC dialog box application, first maximize the window, and then use the window handle as a parameter to call the following method.
========================================================== ======================================
Static void reproducelostedge (hwnd)
{
// Set the window to layered
Int style = getwindowlongptr (hwnd, gwl_exstyle );
Setwindowlong (hwnd, gwl_exstyle, style | ws_ex_layered );
Point ptdst;
Ptdst. x = 1; // left edge will lost 1 + 8 Pixel
Ptdst. Y = 3; // top edge will lost 3 + 8 Pixel
// The parameter ptdst takes core effect,
// No edge wocould lost if use null as this argument
Updatelayeredwindow (hwnd, null, & ptdst, null, 0, null, 0 );
// Setlayeredwindowattributes (hwnd, 0, 0, lwa_alpha );
}
========================================================== ======================================
Each time the preceding reproduction method is executed, the boundaries of several pixels are lost on the basis of the original one. The number of lost pixels is affected by the ptdst parameter. If the parameter is a vertex (x, y), X + 8 pixels are lost at the left boundary, and Y + 8 pixels are lost at the upper boundary. The base 8 here should be the value that maximizes the window beyond the screen workspace. In addition, if ptdst is a null pointer, no bugs will occur. According to msdn, The ptdst here should be null, which is another aspect of incorrect usage.
The original code wants to set the window to completely transparent to hide it. Calling updatelayeredwindow here is an incorrect usage. It is correct to use setlayered?wattributes. But in any case, this should be a Windows bug. Currently, Windows 7 SP1 is reproduced on English and some German machines. However, if there is only one monitor, there is no such bug from XP, Vista to win7.
Finally, how can I recover a bug? Restart and logout are all possible. The simplest is to modify the display settings to use only one monitor, and then choose to restore the original settings during preview.