Home > Software engineering >  No border form scaling shake
No border form scaling shake

Time:09-27

Just contact the win32, wrote a simple without borders form, but when you zoom in the top left corner of the form form, form the right boundary and lower boundary is constantly shaking, there is the same problem in upper and lower left corner zoom, zoom in the lower right corner is normal, could you tell me how to solve?
The code below
 # if defined (UNICODE) & amp; & ! Defined (_UNICODE) 
# define _UNICODE
# elif defined (_UNICODE) & amp; & ! Defined (UNICODE)
# define UNICODE
# endif

#include
#include

Declare Windows procedure/* */
LRESULT a CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/* Make the class name into a global variable */
TCHAR szClassName []=_T (" CodeBlocksWindowsApp ");

Int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
Int nCmdShow)
{
The HWND HWND;/* This is the handle for our window */
MSG messages;/* Here messages to the application are saved */
Modifed WNDCLASSEX wincl;/* Data structure for the windowclass */

/* The Window structure */
Wincl. HInstance=hThisInstance;
Wincl. LpszClassName=szClassName;
Wincl. LpfnWndProc=WindowProcedure;/* This function is called by Windows */
Wincl. Style=CS_DBLCLKS;/* Catch double - on */
Wincl. CbSize=sizeof (modifed WNDCLASSEX);

/* Use the default icon and the mouse pointer */
Wincl. HIcon=LoadIcon (NULL, IDI_APPLICATION);
Wincl. HIconSm=LoadIcon (NULL, IDI_APPLICATION);
Wincl. HCursor=LoadCursor (NULL, IDC_ARROW);
Wincl. LpszMenuName=NULL;/* No menu */
Wincl. CbClsExtra=0;/* No extra bytes after the window class */
Wincl. CbWndExtra=0;/* structure or the window instance */
/* Use Windows' s default see colour as the background of the window */
Wincl. HbrBackground=(HBRUSH) COLOR_GRAYTEXT;

/* Register the window class, and if it fails to quit the program */
if (! RegisterClassEx (& amp; Wincl))
return 0;

/* The class is registered, let 's create The program */
HWND=CreateWindowEx (
0,/* Extended possibilites for variation */
SzClassName, Classname/* */
_T (" Code: : Blocks the Template Windows App "),/* the Title Text */
WS_POPUP,/* the default Windows */
200,/* Windows decides the position */
200,/* where the window ends up on the screen */
640,/* The designed width */
480,/* and height in pixels */
HWND_DESKTOP,/* The window to The desktop window is a child - */
NULL, No menu/* */
HThisInstance,/* Program Instance handler */
NULL Window Creation/* No data */
);

/* Make the window visible on the screen */
ShowWindow (HWND, nCmdShow);

/* Run the message loop, It will Run until GetMessage () returns 0 */
While (GetMessage (& amp; Messages, NULL, 0, 0))
{
/* Translate the virtual - key messages into character messages */
TranslateMessage (& amp; Messages);
/* the Send message to WindowProcedure */
DispatchMessage (& amp; Messages);
}

/* The program return - The value is 0 - The value that PostQuitMessage () gave, */
Return messages. WParam;
}


/* This function is called by the Windows function DispatchMessage () */

LRESULT a CALLBACK WindowProcedure (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
POINT pt;
The RECT rcClient;

The switch (the message)/* handle the messages */
{

Case WM_NCHITTEST:

Pt. X=LOWORD (lParam);
Pt. Y=HIWORD (lParam);
ScreenToClient (HWND, & amp; Pt);
GetClientRect (HWND, & amp; RcClient);

If (pt. X{
Return HTTOPLEFT;
}
If (pt. X> RcClient. Right - 5 & amp; & Pt. Y{
Return HTTOPRIGHT;
}
If (pt. X RcClient. Bottom - 5)//* o??????
{
Return HTBOTTOMLEFT;
}
If (pt. X> RcClient. Right - 5 & amp; & Pt. Y> RcClient. Bottom - 5)//oo??????
{
Return HTBOTTOMRIGHT;
}
If (pt. Y{
Return HTCAPTION;
}
break;

Case WM_DESTROY:
The PostQuitMessage (0);/* the send a WM_QUIT to the message queue */
break;
Default:/* for the messages that we don 't deal with */
Return DefWindowProc (HWND, message, wParam, lParam);
}

return 0;
}

CodePudding user response:

VC6 under XP test no problem you describe

Try wincl. Style=CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;

CodePudding user response:

VC6 under XP test no problem you describe
Note until the cursor changes after zoom!
The other exit code below
Case WM_CHAR:
If ((TCHAR) wParam==0 x0d) PostQuitMessage (0);
break;

CodePudding user response:

reference 1st floor zgl7903 response:
test without you describe problem under VC6 XP

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related