4 * Copyright 2002 Jaco Greeff
5 * Copyright 2003 Dimitrie O. Paun
6 * Copyright 2003 Mike Hearn
7 * Copyright 2010 Joel Holdsworth
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include <wine/debug.h>
37 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
39 static HICON logo
= NULL
;
40 static HFONT titleFont
= NULL
;
43 AboutDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
47 RECT rcClient
, rcRect
;
53 switch(((LPNMHDR
)lParam
)->code
)
56 /*save registration info to registry */
57 owner
= get_text(hDlg
, IDC_ABT_OWNER
);
58 org
= get_text(hDlg
, IDC_ABT_ORG
);
60 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows\\CurrentVersion",
61 "RegisteredOwner", owner
? owner
: "");
62 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows\\CurrentVersion",
63 "RegisteredOrganization", org
? org
: "");
64 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
65 "RegisteredOwner", owner
? owner
: "");
66 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
67 "RegisteredOrganization", org
? org
: "");
70 HeapFree(GetProcessHeap(), 0, owner
);
71 HeapFree(GetProcessHeap(), 0, org
);
76 if(wParam
== IDC_ABT_WEB_LINK
)
77 ShellExecuteA(NULL
, "open", PACKAGE_URL
, NULL
, NULL
, SW_SHOW
);
86 /* read owner and organization info from registry, load it into text box */
87 owner
= get_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
88 "RegisteredOwner", "");
89 org
= get_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
90 "RegisteredOrganization", "");
92 SetDlgItemText(hDlg
, IDC_ABT_OWNER
, owner
);
93 SetDlgItemText(hDlg
, IDC_ABT_ORG
, org
);
95 SendMessage(GetParent(hDlg
), PSM_UNCHANGED
, 0, 0);
97 HeapFree(GetProcessHeap(), 0, owner
);
98 HeapFree(GetProcessHeap(), 0, org
);
100 /* prepare the panel */
101 hWnd
= GetDlgItem(hDlg
, IDC_ABT_PANEL
);
104 GetClientRect(hDlg
, &rcClient
);
105 GetClientRect(hWnd
, &rcRect
);
106 MoveWindow(hWnd
, 0, 0, rcClient
.right
, rcRect
.bottom
, FALSE
);
108 logo
= LoadImageW((HINSTANCE
)GetWindowLongPtrW(hDlg
, GWLP_HINSTANCE
),
109 MAKEINTRESOURCEW(IDI_LOGO
), IMAGE_ICON
, 0, 0, LR_SHARED
);
112 /* prepare the title text */
113 hWnd
= GetDlgItem(hDlg
, IDC_ABT_TITLE_TEXT
);
116 titleFont
= CreateFont(
117 -MulDiv(24, GetDeviceCaps(hDC
, LOGPIXELSY
), 72),
118 0, 0, 0, 0, FALSE
, 0, 0, 0, 0, 0, 0, 0,
120 SendMessage(hWnd
, WM_SETFONT
, (WPARAM
)titleFont
, TRUE
);
123 /* prepare the web link */
124 hWnd
= GetDlgItem(hDlg
, IDC_ABT_WEB_LINK
);
126 SetWindowTextA(hWnd
, "<a href=\"" PACKAGE_URL
"\">" PACKAGE_URL
"</a>");
128 ReleaseDC(hDlg
, hDC
);
141 DeleteObject(titleFont
);
148 switch(HIWORD(wParam
))
151 /* enable apply button */
152 SendMessage(GetParent(hDlg
), PSM_CHANGED
, 0, 0);
158 if(wParam
== IDC_ABT_PANEL
)
160 LPDRAWITEMSTRUCT pDIS
= (LPDRAWITEMSTRUCT
)lParam
;
161 FillRect(pDIS
->hDC
, &pDIS
->rcItem
, (HBRUSH
) (COLOR_WINDOW
+1));
162 DrawIconEx(pDIS
->hDC
, 0, 0, logo
, 0, 0, 0, 0, DI_IMAGE
);
163 DrawEdge(pDIS
->hDC
, &pDIS
->rcItem
, EDGE_SUNKEN
, BF_BOTTOM
);
167 case WM_CTLCOLORSTATIC
:
168 switch(GetDlgCtrlID((HWND
)lParam
))
170 case IDC_ABT_TITLE_TEXT
:
171 /* set the title to a wine color */
172 SetTextColor((HDC
)wParam
, 0x0000007F);
173 case IDC_ABT_PANEL_TEXT
:
174 case IDC_ABT_LICENSE_TEXT
:
175 return (BOOL
)CreateSolidBrush(GetSysColor(COLOR_WINDOW
));