00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "winutil.h"
00011
00012 void SetMouseCursor(LPCTSTR lpCursor)
00013 {
00014 HCURSOR hNewCrsr;
00015
00016 if (hNewCrsr = LoadCursor(NULL, lpCursor))
00017 SetCursor(hNewCrsr);
00018 }
00019
00020 void CenterWindow(HWND hParent, HWND hWnd)
00021 {
00022
00023 if (hParent && hWnd)
00024 {
00025 RECT or, ir;
00026 if (GetWindowRect(hParent, &or))
00027 {
00028 if (GetWindowRect(hWnd, &ir))
00029 {
00030 int x, y;
00031
00032 x = or.left + (or.right - or.left - (ir.right - ir.left)) / 2;
00033 y = or.top + (or.bottom - or.top - (ir.bottom - ir.top)) / 2;;
00034 SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
00035 }
00036 }
00037 }
00038 }
00039
00040 void RemoveButtonDefaultStyle(HWND hWnd)
00041 {
00042 SetWindowLong(hWnd, GWL_STYLE,
00043 ::GetWindowLong(hWnd, GWL_STYLE) & ~BS_DEFPUSHBUTTON);
00044 InvalidateRect(hWnd, NULL, TRUE);
00045 }
00046
00047 void AddButtonDefaultStyle(HWND hWnd)
00048 {
00049 SetWindowLong(hWnd, GWL_STYLE,
00050 ::GetWindowLong(hWnd, GWL_STYLE) | BS_DEFPUSHBUTTON);
00051 InvalidateRect(hWnd, NULL, TRUE);
00052 }