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
37 static HICON logo
= NULL
;
38 static HFONT titleFont
= NULL
;
41 AboutDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
45 RECT rcClient
, rcRect
;
51 switch(((LPNMHDR
)lParam
)->code
)
54 /*save registration info to registry */
55 owner
= get_text(hDlg
, IDC_ABT_OWNER
);
56 org
= get_text(hDlg
, IDC_ABT_ORG
);
58 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows\\CurrentVersion",
59 "RegisteredOwner", owner
? owner
: "");
60 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows\\CurrentVersion",
61 "RegisteredOrganization", org
? org
: "");
62 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
63 "RegisteredOwner", owner
? owner
: "");
64 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
65 "RegisteredOrganization", org
? org
: "");
68 HeapFree(GetProcessHeap(), 0, owner
);
69 HeapFree(GetProcessHeap(), 0, org
);
74 if(wParam
== IDC_ABT_WEB_LINK
)
75 ShellExecuteA(NULL
, "open", PACKAGE_URL
, NULL
, NULL
, SW_SHOW
);
84 /* read owner and organization info from registry, load it into text box */
85 owner
= get_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
86 "RegisteredOwner", "");
87 org
= get_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
88 "RegisteredOrganization", "");
90 SetDlgItemTextA(hDlg
, IDC_ABT_OWNER
, owner
);
91 SetDlgItemTextA(hDlg
, IDC_ABT_ORG
, org
);
93 SendMessageW(GetParent(hDlg
), PSM_UNCHANGED
, 0, 0);
95 HeapFree(GetProcessHeap(), 0, owner
);
96 HeapFree(GetProcessHeap(), 0, org
);
98 /* prepare the panel */
99 hWnd
= GetDlgItem(hDlg
, IDC_ABT_PANEL
);
102 GetClientRect(hDlg
, &rcClient
);
103 GetClientRect(hWnd
, &rcRect
);
104 MoveWindow(hWnd
, 0, 0, rcClient
.right
, rcRect
.bottom
, FALSE
);
106 logo
= LoadImageW((HINSTANCE
)GetWindowLongPtrW(hDlg
, GWLP_HINSTANCE
),
107 MAKEINTRESOURCEW(IDI_LOGO
), IMAGE_ICON
, 0, 0, LR_SHARED
);
110 /* prepare the title text */
111 hWnd
= GetDlgItem(hDlg
, IDC_ABT_TITLE_TEXT
);
114 static const WCHAR tahomaW
[] = {'T','a','h','o','m','a',0};
115 titleFont
= CreateFontW(
116 -MulDiv(24, GetDeviceCaps(hDC
, LOGPIXELSY
), 72),
117 0, 0, 0, 0, FALSE
, 0, 0, 0, 0, 0, 0, 0, tahomaW
);
118 SendMessageW(hWnd
, WM_SETFONT
, (WPARAM
)titleFont
, TRUE
);
119 SetWindowTextA(hWnd
, PACKAGE_NAME
);
121 SetDlgItemTextA(hDlg
, IDC_ABT_PANEL_TEXT
, PACKAGE_VERSION
);
123 /* prepare the web link */
124 SetDlgItemTextA(hDlg
, IDC_ABT_WEB_LINK
, "<a href=\"" PACKAGE_URL
"\">" PACKAGE_URL
"</a>");
126 ReleaseDC(hDlg
, hDC
);
139 DeleteObject(titleFont
);
146 switch(HIWORD(wParam
))
149 /* enable apply button */
150 SendMessageW(GetParent(hDlg
), PSM_CHANGED
, 0, 0);
156 if(wParam
== IDC_ABT_PANEL
)
158 LPDRAWITEMSTRUCT pDIS
= (LPDRAWITEMSTRUCT
)lParam
;
159 FillRect(pDIS
->hDC
, &pDIS
->rcItem
, (HBRUSH
) (COLOR_WINDOW
+1));
160 DrawIconEx(pDIS
->hDC
, 0, 0, logo
, 0, 0, 0, 0, DI_IMAGE
);
161 DrawEdge(pDIS
->hDC
, &pDIS
->rcItem
, EDGE_SUNKEN
, BF_BOTTOM
);
165 case WM_CTLCOLORSTATIC
:
166 switch(GetDlgCtrlID((HWND
)lParam
))
168 case IDC_ABT_TITLE_TEXT
:
169 /* set the title to a wine color */
170 SetTextColor((HDC
)wParam
, 0x0000007F);
171 case IDC_ABT_PANEL_TEXT
:
172 case IDC_ABT_LICENSE_TEXT
:
173 case IDC_ABT_WEB_LINK
:
174 return (INT_PTR
)CreateSolidBrush(GetSysColor(COLOR_WINDOW
));