popupAgreement.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. #include "./popupAgreement.h"
  2. #include "./loginNotifier.h"
  3. #include "./loginProvider.h"
  4. #include "./common.h"
  5. #include "../resource.h"
  6. #include "../api.h"
  7. #include "../../winamp/commandLink.h"
  8. #include <windows.h>
  9. #include <commctrl.h>
  10. #include <strsafe.h>
  11. #define LINK_TOS 0
  12. #define STATIC_AND 1
  13. #define LINK_PRIVACY 2
  14. #define IDC_AOL 11000
  15. #define IDC_AOL_TOS (IDC_AOL + LINK_TOS)
  16. #define IDC_AOL_AND (IDC_AOL + STATIC_AND)
  17. #define IDC_AOL_PRIVACY (IDC_AOL + LINK_PRIVACY)
  18. #define IDC_3DPARTY 11010
  19. #define IDC_3DPARTY_TOS (IDC_3DPARTY + LINK_TOS)
  20. #define IDC_3DPARTY_AND (IDC_3DPARTY + STATIC_AND)
  21. #define IDC_3DPARTY_PRIVACY (IDC_3DPARTY + LINK_PRIVACY)
  22. #define LINK_TARGET L"LinkTargetProp"
  23. typedef struct __PARTSIZE
  24. {
  25. HWND hwnd;
  26. LONG cx;
  27. LONG cy;
  28. } PARTSIZE;
  29. typedef struct __LINKSIZEINFO
  30. {
  31. PARTSIZE tos;
  32. PARTSIZE and;
  33. PARTSIZE privacy;
  34. LONG spaceWidth;
  35. RECT linkMargins;
  36. } LINKSIZEINFO;
  37. static HRESULT CALLBACK LoginPopupAgreement_CreateInstance(HWND hwnd, LPARAM param, LoginPopup **instance)
  38. {
  39. if (NULL == instance) return E_POINTER;
  40. if (NULL == hwnd) return E_INVALIDARG;
  41. *instance = new LoginPopupAgreement(hwnd);
  42. if (NULL == instance) return E_OUTOFMEMORY;
  43. return S_OK;
  44. }
  45. LoginPopupAgreement::LoginPopupAgreement(HWND hwnd)
  46. : LoginPopup(hwnd, -1, MAKEINTRESOURCE(IDS_POPUP_AGREEMENT_TITLE))
  47. {
  48. }
  49. LoginPopupAgreement::~LoginPopupAgreement()
  50. {
  51. }
  52. HWND LoginPopupAgreement::CreatePopup(HWND hParent, LoginProvider *provider)
  53. {
  54. if (NULL == provider)
  55. return NULL;
  56. return LoginPopup::CreatePopup(MAKEINTRESOURCE(IDD_POPUP_AGREEMENT), hParent, (LPARAM)provider, LoginPopupAgreement_CreateInstance);
  57. }
  58. void LoginPopupAgreement::UpdateLayout(BOOL fRedraw)
  59. {
  60. LoginPopup::UpdateLayout(fRedraw);
  61. RECT rect;
  62. if (FALSE == GetInfoRect(&rect)) return;
  63. const INT szButtons[] = { IDOK, IDCANCEL, };
  64. UINT flags = SWP_NOZORDER | SWP_NOACTIVATE;
  65. if (FALSE == fRedraw) flags |= SWP_NOREDRAW;
  66. HDWP hdwp = BeginDeferWindowPos(ARRAYSIZE(szButtons) + 1 + 2*3);
  67. if (NULL == hdwp) return;
  68. hdwp = LayoutButtons(hdwp, szButtons, ARRAYSIZE(szButtons), fRedraw, NULL);
  69. LONG top = rect.top;
  70. SIZE partSize;
  71. HWND hText = GetDlgItem(hwnd, IDC_TEXT);
  72. if (NULL != hText && FALSE != GetTextSize(hText, rect.right - rect.left, &partSize))
  73. {
  74. hdwp = DeferWindowPos(hdwp, hText, NULL, rect.left, top, partSize.cx, partSize.cy, flags);
  75. if (NULL == hdwp) return;
  76. top += partSize.cy;
  77. }
  78. top += marginLinkFirst;
  79. hdwp = LayoutProviderLinks(hdwp, IDC_AOL, NULL, rect.left + marginLinkLeft, top, flags, &partSize);
  80. if (NULL == hdwp) return;
  81. if (0 != partSize.cy)
  82. top += partSize.cy + marginLinkNext;
  83. hdwp = LayoutProviderLinks(hdwp, IDC_3DPARTY, NULL, rect.left + marginLinkLeft, top, flags, &partSize);
  84. if (NULL == hdwp) return;
  85. EndDeferWindowPos(hdwp);
  86. if (FALSE != fRedraw)
  87. {
  88. HWND hControl = GetDlgItem(hwnd, IDC_TEXT);
  89. if (NULL != hControl) InvalidateRect(hControl, NULL, FALSE);
  90. }
  91. }
  92. void LoginPopupAgreement::EndDialog(INT_PTR code)
  93. {
  94. NLPNRESULT result;
  95. result.exitCode = code;
  96. SendNotification(NLPN_RESULT, (NMHDR*)&result);
  97. LoginPopup::EndDialog(code);
  98. }
  99. void LoginPopupAgreement::UpdateMargins()
  100. {
  101. RECT rect;
  102. SetRect(&rect, 8, 8, 0, 2);
  103. MapDialogRect(hwnd, &rect);
  104. marginLinkLeft = rect.left;
  105. marginLinkFirst = rect.top;
  106. marginLinkNext = rect.bottom;
  107. LoginPopup::UpdateMargins();
  108. }
  109. static BOOL ProviderLinks_GetSizeInfo(HWND hwnd, INT groupId, LINKSIZEINFO *sizeInfo)
  110. {
  111. if(NULL == sizeInfo)
  112. return FALSE;
  113. HWND hControl;
  114. SIZE partSize;
  115. SetRectEmpty(&sizeInfo->linkMargins);
  116. hControl = GetDlgItem(hwnd, groupId + LINK_TOS);
  117. if (NULL == hControl ||
  118. 0 == (WS_VISIBLE & GetWindowStyle(hControl)) ||
  119. FALSE == CommandLink_GetIdealSize(hControl, &partSize))
  120. {
  121. ZeroMemory(&sizeInfo->tos, sizeof(PARTSIZE));
  122. }
  123. else
  124. {
  125. sizeInfo->tos.hwnd = hControl;
  126. sizeInfo->tos.cx = partSize.cx;
  127. sizeInfo->tos.cy = partSize.cy;
  128. CommandLink_GetMargins(hControl, &sizeInfo->linkMargins);
  129. }
  130. hControl = GetDlgItem(hwnd, groupId + LINK_PRIVACY);
  131. if (NULL == hControl ||
  132. 0 == (WS_VISIBLE & GetWindowStyle(hControl)) ||
  133. FALSE == CommandLink_GetIdealSize(hControl, &partSize))
  134. {
  135. ZeroMemory(&sizeInfo->privacy, sizeof(PARTSIZE));
  136. }
  137. else
  138. {
  139. sizeInfo->privacy.hwnd = hControl;
  140. sizeInfo->privacy.cx = partSize.cx;
  141. sizeInfo->privacy.cy = partSize.cy;
  142. if (IsRectEmpty(&sizeInfo->linkMargins))
  143. CommandLink_GetMargins(hControl, &sizeInfo->linkMargins);
  144. }
  145. if (NULL == sizeInfo->tos.hwnd && NULL == sizeInfo->privacy.hwnd)
  146. return FALSE;
  147. ZeroMemory(&sizeInfo->and, sizeof(PARTSIZE));
  148. sizeInfo->spaceWidth = 0;
  149. if (NULL != sizeInfo->tos.hwnd && NULL != sizeInfo->privacy.hwnd)
  150. {
  151. hControl = GetDlgItem(hwnd, groupId + STATIC_AND);
  152. if (NULL != hControl)
  153. {
  154. WCHAR szBuffer[64] = {0};
  155. INT cchLen = (INT)SendMessage(hControl, WM_GETTEXT, ARRAYSIZE(szBuffer), (LPARAM)szBuffer);
  156. if (cchLen > 0)
  157. {
  158. HDC hdc = GetDCEx(hControl, NULL, DCX_CACHE | DCX_WINDOW | DCX_NORESETATTRS);
  159. if (NULL != hdc)
  160. {
  161. HFONT font = (HFONT)SendMessage(hControl, WM_GETFONT, 0, 0L);
  162. HFONT fontOrig = (HFONT)SelectObject(hdc, font);
  163. if (FALSE != GetTextExtentPoint32W(hdc, szBuffer, cchLen, &partSize))
  164. {
  165. sizeInfo->and.hwnd = hControl;
  166. sizeInfo->and.cx = partSize.cx;
  167. sizeInfo->and.cy = partSize.cy;
  168. }
  169. if (FALSE != GetTextExtentPoint32W(hdc, L" ", 1, &partSize))
  170. {
  171. sizeInfo->spaceWidth = partSize.cx;
  172. }
  173. SelectObject(hdc, fontOrig);
  174. ReleaseDC(hControl, hdc);
  175. }
  176. }
  177. }
  178. }
  179. return TRUE;
  180. }
  181. HDWP LoginPopupAgreement::LayoutProviderLinks(HDWP hdwp, INT groupId, HWND hwndInsertAfter, INT x, INT y, UINT flags, SIZE *size)
  182. {
  183. if (NULL == hdwp)
  184. {
  185. if (NULL == size)
  186. return NULL;
  187. x = 0;
  188. y = 0;
  189. }
  190. LONG ox = x, cy = 0;
  191. LINKSIZEINFO sizeInfo;
  192. if (FALSE == ProviderLinks_GetSizeInfo(hwnd, groupId, &sizeInfo))
  193. return hdwp;
  194. if (NULL != sizeInfo.tos.hwnd)
  195. {
  196. if (NULL != hdwp)
  197. {
  198. hdwp = DeferWindowPos(hdwp, sizeInfo.tos.hwnd, hwndInsertAfter, x, y, sizeInfo.tos.cx, sizeInfo.tos.cy, flags);
  199. if (NULL == hdwp) return NULL;
  200. }
  201. x += sizeInfo.tos.cx;
  202. if (cy < sizeInfo.tos.cy) cy = sizeInfo.tos.cy;
  203. }
  204. if (NULL != sizeInfo.and.hwnd)
  205. {
  206. LONG top = y + ((sizeInfo.tos.cy - (sizeInfo.linkMargins.bottom + sizeInfo.linkMargins.top)) - sizeInfo.and.cy)/2;
  207. LONG space = (sizeInfo.spaceWidth - sizeInfo.linkMargins.right);
  208. if (space < 1) space = 1;
  209. x += space;
  210. if (NULL != hdwp)
  211. {
  212. hdwp = DeferWindowPos(hdwp, sizeInfo.and.hwnd, hwndInsertAfter, x, top, sizeInfo.and.cx, sizeInfo.and.cy, flags);
  213. if (NULL == hdwp) return NULL;
  214. }
  215. x += sizeInfo.and.cx;
  216. if (cy < sizeInfo.and.cy) cy = sizeInfo.and.cy;
  217. }
  218. if (NULL != sizeInfo.privacy.hwnd)
  219. {
  220. if (NULL != sizeInfo.and.hwnd)
  221. {
  222. LONG space = (sizeInfo.spaceWidth - sizeInfo.linkMargins.left);
  223. if (space < 1) space = 1;
  224. x += space;
  225. }
  226. if (NULL != hdwp)
  227. {
  228. hdwp = DeferWindowPos(hdwp, sizeInfo.privacy.hwnd, hwndInsertAfter, x, y, sizeInfo.privacy.cx, sizeInfo.privacy.cy, flags);
  229. if (NULL == hdwp) return NULL;
  230. }
  231. x += sizeInfo.privacy.cx;
  232. if (cy < sizeInfo.privacy.cy) cy = sizeInfo.privacy.cy;
  233. }
  234. if (NULL != size)
  235. {
  236. size->cx = (x - ox);
  237. size->cy = cy;
  238. }
  239. return (NULL == hdwp) ? (HDWP)(TRUE) : hdwp;
  240. }
  241. BOOL LoginPopupAgreement::CreateProviderLinks(LPCWSTR pszProvider, LPCWSTR pszTos, LPCWSTR pszPrivacy, INT groupId, HWND hwndInsertAfter)
  242. {
  243. WCHAR szTemplate[256] = {0}, szBuffer[256] = {0};
  244. UINT linkStyle = WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VISIBLE |
  245. CLS_DEFAULTCOLORS | CLS_HOTTRACK /*| CLS_ALWAYSUNDERLINE*/;
  246. HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0L);
  247. LPWSTR pszUrl;
  248. HWND hControl;
  249. INT createdCount = 0;
  250. INT failedCount = 0;
  251. if (NULL != pszTos && L'\0' != *pszTos)
  252. {
  253. WASABI_API_LNGSTRINGW_BUF(IDS_TOSLINK_TEMPLATE, szTemplate, ARRAYSIZE(szTemplate));
  254. StringCchPrintf(szBuffer, ARRAYSIZE(szBuffer), szTemplate, pszProvider);
  255. hControl = CommandLink_CreateWindow(0, szBuffer, linkStyle, 0, 0, 0, 0, hwnd, groupId + LINK_TOS);
  256. if (NULL != hControl)
  257. {
  258. pszUrl = LoginBox_CopyString(pszTos);
  259. if (NULL == pszUrl || FALSE == SetProp(hControl, LINK_TARGET, pszUrl))
  260. {
  261. LoginBox_FreeString(pszUrl);
  262. DestroyWindow(hControl);
  263. hControl = NULL;
  264. }
  265. }
  266. if (NULL != hControl)
  267. {
  268. SendMessage(hControl, WM_SETFONT, (WPARAM)font, 0L);
  269. SetWindowPos(hControl, hwndInsertAfter, 0, 0,0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW);
  270. hwndInsertAfter = hControl;
  271. createdCount++;
  272. }
  273. else failedCount++;
  274. }
  275. if (0 == failedCount && NULL != pszPrivacy && L'\0' != *pszPrivacy)
  276. {
  277. WASABI_API_LNGSTRINGW_BUF(IDS_PRIVACYLINK_TEMPLATE, szTemplate, ARRAYSIZE(szTemplate));
  278. StringCchPrintf(szBuffer, ARRAYSIZE(szBuffer), szTemplate, pszProvider);
  279. hControl = CommandLink_CreateWindow(0, szBuffer, linkStyle, 0, 0, 0, 0, hwnd, groupId + LINK_PRIVACY);
  280. if (NULL != hControl)
  281. {
  282. pszUrl = LoginBox_CopyString(pszPrivacy);
  283. if (NULL == pszUrl || FALSE == SetProp(hControl, LINK_TARGET, pszUrl))
  284. {
  285. LoginBox_FreeString(pszUrl);
  286. DestroyWindow(hControl);
  287. hControl = NULL;
  288. }
  289. }
  290. if (NULL != hControl)
  291. {
  292. SendMessage(hControl, WM_SETFONT, (WPARAM)font, 0L);
  293. SetWindowPos(hControl, hwndInsertAfter, 0, 0,0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW);
  294. hwndInsertAfter = hControl;
  295. createdCount++;
  296. }
  297. else failedCount++;
  298. }
  299. if (0 == failedCount && createdCount > 1)
  300. {
  301. WASABI_API_LNGSTRINGW_BUF(IDS_AND, szBuffer, ARRAYSIZE(szBuffer));
  302. hControl = CreateWindowEx(WS_EX_NOPARENTNOTIFY, L"Static", szBuffer, WS_CHILD | WS_VISIBLE | SS_LEFT,
  303. 0, 0, 0, 0, hwnd, (HMENU)(INT_PTR)(groupId + STATIC_AND), NULL, 0L);
  304. if (NULL != hControl)
  305. {
  306. SendMessage(hControl, WM_SETFONT, (WPARAM)font, 0L);
  307. SetWindowPos(hControl, hwndInsertAfter, 0, 0,0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW);
  308. hwndInsertAfter = hControl;
  309. createdCount++;
  310. }
  311. else
  312. failedCount++;
  313. }
  314. if (0 != failedCount)
  315. {
  316. hControl = GetDlgItem(hwnd, (groupId + LINK_TOS));
  317. if (NULL != hControl) DestroyWindow(hControl);
  318. hControl = GetDlgItem(hwnd, (groupId + LINK_PRIVACY));
  319. if (NULL != hControl) DestroyWindow(hControl);
  320. hControl = GetDlgItem(hwnd, (groupId + STATIC_AND));
  321. if (NULL != hControl) DestroyWindow(hControl);
  322. }
  323. return (0 == failedCount);
  324. }
  325. BOOL LoginPopupAgreement::OnInitDialog(HWND hFocus, LPARAM param)
  326. {
  327. LoginProvider *provider = (LoginProvider*)param;
  328. if (NULL != provider)
  329. {
  330. WCHAR szName[128] = {0}, szTos[4096] = {0}, szPrivacy[4096] = {0};
  331. if (FAILED(provider->GetTosLink(szTos, ARRAYSIZE(szTos))))
  332. szTos[0] = L'\0';
  333. if (FAILED(provider->GetPrivacyLink(szPrivacy, ARRAYSIZE(szPrivacy))))
  334. szPrivacy[0] = L'\0';
  335. if((L'\0' != szTos[0] || L'\0' != szPrivacy[0]) &&
  336. SUCCEEDED(provider->GetName(szName, ARRAYSIZE(szName))))
  337. {
  338. CreateProviderLinks(szName, szTos, szPrivacy, IDC_3DPARTY, NULL);
  339. }
  340. }
  341. CreateProviderLinks(L"AOL", L"https://new.aol.com/freeaolweb/resources/jsp/mem_tos.jsp",
  342. L"http://about.aol.com/aolnetwork/mem_policy", IDC_AOL, NULL);
  343. LoginPopup::OnInitDialog(hFocus, param);
  344. HWND hAgree = GetDlgItem(hwnd, IDOK);
  345. if (NULL != hAgree && (WS_VISIBLE == ((WS_VISIBLE | WS_DISABLED) & GetWindowStyle(hAgree))))
  346. {
  347. PostMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)hAgree, TRUE);
  348. return TRUE;
  349. }
  350. return FALSE;
  351. }
  352. void LoginPopupAgreement::OnDestroy()
  353. {
  354. INT szLinks[] = {IDC_AOL_TOS, IDC_AOL_PRIVACY, IDC_3DPARTY_TOS, IDC_3DPARTY_PRIVACY, };
  355. for (INT i = 0; i < ARRAYSIZE(szLinks); i++)
  356. {
  357. HWND hLink = GetDlgItem(hwnd, szLinks[i]);
  358. if (NULL != hLink) DestroyWindow(hLink);
  359. }
  360. }
  361. BOOL LoginPopupAgreement::OnUpdateWindowPos(const RECT* clientRect, RECT *rectOut)
  362. {
  363. if (NULL == clientRect || NULL == rectOut)
  364. return FALSE;
  365. SIZE maxSize;
  366. SIZE partSize;
  367. maxSize.cx = 0;
  368. maxSize.cy = 0;
  369. if (((HDWP)TRUE) == LayoutProviderLinks(NULL, IDC_AOL, NULL, 0, 0, 0, &partSize))
  370. {
  371. if (maxSize.cx < partSize.cx) maxSize.cx = partSize.cx;
  372. maxSize.cy += (partSize.cy + marginLinkFirst);
  373. }
  374. if (((HDWP)TRUE) == LayoutProviderLinks(NULL, IDC_3DPARTY, NULL, 0, 0, 0, &partSize))
  375. {
  376. if (maxSize.cx < partSize.cx) maxSize.cx = partSize.cx;
  377. maxSize.cy += (partSize.cy + ((0 == maxSize.cy) ? marginLinkFirst : marginLinkNext));
  378. }
  379. if (0 != maxSize.cx)
  380. maxSize.cx += marginLinkLeft;
  381. if (0 != maxSize.cy)
  382. maxSize.cy += marginLinkFirst;
  383. LONG maxWidth = clientRect->right - clientRect->left -
  384. (clientMargins.right + clientMargins.left) -
  385. (infoMargins.right + infoMargins.left);
  386. if (maxSize.cx > maxWidth)
  387. maxSize.cx = maxWidth;
  388. if (FALSE != GetTextSize(GetDlgItem(hwnd, IDC_TEXT), maxWidth, &partSize))
  389. {
  390. if (maxSize.cx < partSize.cx) maxSize.cx = partSize.cx;
  391. maxSize.cy += partSize.cy;
  392. }
  393. if (FALSE == CalculateWindowRect(maxSize.cx, maxSize.cy, NULL, 0, TRUE, rectOut))
  394. return FALSE;
  395. LONG ox = clientRect->left + ((clientRect->right - clientRect->left) - (rectOut->right - rectOut->left))/2;
  396. LONG oy = clientRect->top + ((clientRect->bottom - clientRect->top) - (rectOut->bottom - rectOut->top))/2;
  397. if (ox < clientRect->left) ox = clientRect->left;
  398. if (oy < clientRect->top) oy = clientRect->top;
  399. OffsetRect(rectOut, ox, oy);
  400. return TRUE;
  401. }
  402. HBRUSH LoginPopupAgreement::OnGetStaticColor(HDC hdc, HWND hControl)
  403. {
  404. HBRUSH hb = LoginPopup::OnGetStaticColor(hdc, hControl);
  405. INT controlId = (NULL != hControl) ? (INT)GetWindowLongPtr(hControl, GWLP_ID) : 0;
  406. switch(controlId)
  407. {
  408. case IDC_AOL_AND:
  409. case IDC_3DPARTY_AND:
  410. {
  411. HWND hLink = GetDlgItem(hwnd, (controlId - STATIC_AND));
  412. if (NULL != hLink)
  413. {
  414. // SetTextColor(hdc, CommandLink_GetTextColor(hLink));
  415. }
  416. }
  417. break;
  418. }
  419. return hb;
  420. }
  421. void LoginPopupAgreement::OnParentNotify(UINT eventId, UINT wParam, LPARAM lParam)
  422. {
  423. switch(eventId)
  424. {
  425. case WM_DESTROY:
  426. switch(wParam)
  427. {
  428. case IDC_AOL_TOS:
  429. case IDC_AOL_PRIVACY:
  430. case IDC_3DPARTY_TOS:
  431. case IDC_3DPARTY_PRIVACY:
  432. {
  433. LPWSTR url = (LPWSTR)GetProp((HWND)lParam, LINK_TARGET);
  434. RemoveProp((HWND)lParam, LINK_TARGET);
  435. LoginBox_FreeString(url);
  436. }
  437. break;
  438. }
  439. break;
  440. }
  441. LoginPopup::OnParentNotify(eventId, wParam, lParam);
  442. }
  443. void LoginPopupAgreement::OnLinkClicked(HWND hLink)
  444. {
  445. if (NULL == hLink)
  446. return;
  447. LPCWSTR pszTarget = (LPCWSTR)GetProp(hLink, LINK_TARGET);
  448. if (NULL != pszTarget && L'\0' != *pszTarget)
  449. {
  450. LoginBox_OpenUrl(hwnd, pszTarget, TRUE);
  451. }
  452. }
  453. LRESULT LoginPopupAgreement::OnNotify(UINT controlId, const NMHDR *pnmh)
  454. {
  455. switch(controlId)
  456. {
  457. case IDC_AOL_TOS:
  458. case IDC_AOL_PRIVACY:
  459. case IDC_3DPARTY_TOS:
  460. case IDC_3DPARTY_PRIVACY:
  461. switch(pnmh->code)
  462. {
  463. case NM_CLICK:
  464. OnLinkClicked(pnmh->hwndFrom);
  465. return 0;
  466. }
  467. break;
  468. }
  469. return LoginPopup::OnNotify(controlId, pnmh);
  470. }