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
35 static HICON logo
= NULL
;
36 static HFONT titleFont
= NULL
;
39 AboutDlgProc (HWND hDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
41 static const WCHAR openW
[] = {'o','p','e','n',0};
42 static const WCHAR tahomaW
[] = {'T','a','h','o','m','a',0};
43 const char * (CDECL
*wine_get_version
)(void);
46 RECT rcClient
, rcRect
;
52 switch(((LPNMHDR
)lParam
)->code
)
55 /*save registration info to registry */
56 owner
= get_text(hDlg
, IDC_ABT_OWNER
);
57 org
= get_text(hDlg
, IDC_ABT_ORG
);
59 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows\\CurrentVersion",
60 "RegisteredOwner", owner
? owner
: "");
61 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows\\CurrentVersion",
62 "RegisteredOrganization", org
? org
: "");
63 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
64 "RegisteredOwner", owner
? owner
: "");
65 set_reg_key(HKEY_LOCAL_MACHINE
, "Software\\Microsoft\\Windows NT\\CurrentVersion",
66 "RegisteredOrganization", org
? org
: "");
69 HeapFree(GetProcessHeap(), 0, owner
);
70 HeapFree(GetProcessHeap(), 0, org
);
75 if(wParam
== IDC_ABT_WEB_LINK
)
76 ShellExecuteW(NULL
, openW
, ((NMLINK
*)lParam
)->item
.szUrl
, 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 titleFont
= CreateFontW( -MulDiv(24, GetDeviceCaps(hDC
, LOGPIXELSY
), 72),
112 0, 0, 0, 0, FALSE
, 0, 0, 0, 0, 0, 0, 0, tahomaW
);
113 SendDlgItemMessageW(hDlg
, IDC_ABT_TITLE_TEXT
, WM_SETFONT
, (WPARAM
)titleFont
, TRUE
);
115 wine_get_version
= (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "wine_get_version" );
116 if (wine_get_version
) SetDlgItemTextA(hDlg
, IDC_ABT_PANEL_TEXT
, wine_get_version());
118 ReleaseDC(hDlg
, hDC
);
131 DeleteObject(titleFont
);
138 switch(HIWORD(wParam
))
141 /* enable apply button */
142 SendMessageW(GetParent(hDlg
), PSM_CHANGED
, 0, 0);
148 if(wParam
== IDC_ABT_PANEL
)
150 LPDRAWITEMSTRUCT pDIS
= (LPDRAWITEMSTRUCT
)lParam
;
151 FillRect(pDIS
->hDC
, &pDIS
->rcItem
, (HBRUSH
) (COLOR_WINDOW
+1));
152 DrawIconEx(pDIS
->hDC
, 0, 0, logo
, 0, 0, 0, 0, DI_IMAGE
);
153 DrawEdge(pDIS
->hDC
, &pDIS
->rcItem
, EDGE_SUNKEN
, BF_BOTTOM
);
157 case WM_CTLCOLORSTATIC
:
158 switch(GetDlgCtrlID((HWND
)lParam
))
160 case IDC_ABT_TITLE_TEXT
:
161 /* set the title to a wine color */
162 SetTextColor((HDC
)wParam
, 0x0000007F);
163 SetBkColor((HDC
)wParam
, GetSysColor(COLOR_WINDOW
));
164 return (INT_PTR
)GetSysColorBrush(COLOR_WINDOW
);
165 case IDC_ABT_PANEL_TEXT
:
166 case IDC_ABT_LICENSE_TEXT
:
167 case IDC_ABT_WEB_LINK
:
168 SetTextColor((HDC
)wParam
, GetSysColor(COLOR_WINDOWTEXT
));
169 SetBkColor((HDC
)wParam
, GetSysColor(COLOR_WINDOW
));
170 return (INT_PTR
)GetSysColorBrush(COLOR_WINDOW
);