
II. SOFTWARE GUIDES - 10. Driver488/W31 10E. C Languages
Personal488 User’s Manual, Rev. 3.0 II-231
int top;
{
POINT pt;
RECT swp;
RECT rParent;
int iwidth;
int iheight;
/* get the rectangles for the parent and the child */
GetWindowRect(hWnd, &swp);
GetClientRect(hWndMain, &rParent);
/* calculate the height and width for MoveWindow */
iwidth = swp.right - swp.left;
iheight = swp.bottom - swp.top;
/* find the center point and convert to screen coordinates */
pt.x = (rParent.right - rParent.left) / 2;
pt.y = (rParent.bottom - rParent.top) / 2;
ClientToScreen(hWndMain, &pt);
/* calculate the new x, y starting point */
pt.x = pt.x - (iwidth / 2);
pt.y = pt.y - (iheight / 2);
/* top will adjust the window position, up or down */
if (top)
pt.y = pt.y + top;
/* move the window */
MoveWindow(hWnd, pt.x, pt.y, iwidth, iheight, FALSE);
}
/*******************************************************************/
/* CwUnRegisterClasses Function */
/* */
/* Deletes any refrences to windows resources created for this */
/* application, frees memory, deletes instance, handles and does */
/* clean up prior to exiting the window */
/* */
/*******************************************************************/
void CwUnRegisterClasses(void)
{
WNDCLASS wndclass; /* struct to define a window class */
memset(&wndclass, 0x00, sizeof(WNDCLASS));
UnregisterClass(szAppName, hInst);
} /* End of CwUnRegisterClasses */
Header File (Example3.h)
/* QuickCase:W KNB Version 1.00 */
#include windows.h
include
g.h
#define IDM_FILE 1000
#define IDM_F_GO 1050
#define IDM_F_QUIT 1150
#define IDS_ERR_REGISTER_CLASS 1
#define IDS_ERR_CREATE_WINDOW 2
char szString[128]; /* variable to load resource strings */
char szAppName[20]; /* class name for the window */
HWND hInst;
HWND hWndMain;
Komentarze do niniejszej Instrukcji