Rev 186 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 186 | Rev 194 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | 2 | ||
3 | #include "../common.h" |
3 | #include "../common.h" |
- | 4 | ||
- | 5 | #ifndef NO_REGISTRATION |
|
4 | 6 | ||
5 | 7 | ||
6 | // dialog template |
8 | // dialog template |
7 | #define THIS_DIALOG DIALOG_REGISTER |
9 | #define THIS_DIALOG DIALOG_REGISTER |
8 | 10 | ||
Line 91... | Line 93... | ||
91 | wParam_hiword = HIWORD (wParam); |
93 | wParam_hiword = HIWORD (wParam); |
92 | wParam_loword = LOWORD (wParam); |
94 | wParam_loword = LOWORD (wParam); |
93 | 95 | ||
94 | // have we just fired up this window ? |
96 | // have we just fired up this window ? |
95 | if (message == WM_INITDIALOG) |
97 | if (message == WM_INITDIALOG) |
96 | { |
98 | { |
97 | hThisDialogWnd = hWnd; // save the dialog handle |
99 | hThisDialogWnd = hWnd; // save the dialog handle |
98 | 100 | ||
99 | // center the window |
101 | // center the window |
100 | CenterWindow (hWnd, hMainWnd); |
102 | CenterWindow (hWnd, hMainWnd); |
101 | 103 | ||
Line 103... | Line 105... | ||
103 | SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); |
105 | SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); |
104 | SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); |
106 | SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); |
105 | 107 | ||
106 | // set window title and control texts |
108 | // set window title and control texts |
107 | SetWindowText (hWnd, LOCALIZE (L"Registration_Title")); |
109 | SetWindowText (hWnd, LOCALIZE (L"Registration_Title")); |
108 | 110 | ||
109 | // set the static texts |
111 | // set the static texts |
110 | Static_SetText (GetDlgItem (hWnd, STATICTEXT_REGISTRATION_QUESTION), LOCALIZE (L"Registration_Question")); |
112 | Static_SetText (GetDlgItem (hWnd, STATICTEXT_REGISTRATION_QUESTION), LOCALIZE (L"Registration_Question")); |
111 | Static_SetText (GetDlgItem (hWnd, STATICTEXT_REGISTRATION_INSTRUCTIONS), LOCALIZE (L"Registration_Instructions")); |
113 | Static_SetText (GetDlgItem (hWnd, STATICTEXT_REGISTRATION_INSTRUCTIONS), LOCALIZE (L"Registration_Instructions")); |
112 | // set email address font |
114 | // set email address font |
113 | SendMessage (GetDlgItem (hWnd, EDITBOX_REGISTRATION_EMAILADDRESS), WM_SETFONT, (WPARAM) GetStockObject (SYSTEM_FONT), 0); |
115 | SendMessage (GetDlgItem (hWnd, EDITBOX_REGISTRATION_EMAILADDRESS), WM_SETFONT, (WPARAM) GetStockObject (SYSTEM_FONT), 0); |
Line 137... | Line 139... | ||
137 | SetFocus (GetDlgItem (hWnd, EDITBOX_REGISTRATION_EMAILADDRESS)); // focus on the email address field |
139 | SetFocus (GetDlgItem (hWnd, EDITBOX_REGISTRATION_EMAILADDRESS)); // focus on the email address field |
138 | was_donatebutton_clicked = false; // once is enough |
140 | was_donatebutton_clicked = false; // once is enough |
139 | return (true); // prevent window close this time |
141 | return (true); // prevent window close this time |
140 | } |
142 | } |
141 | else |
143 | else |
142 | EndDialog (hWnd, 0); // close the dialog box |
144 | EndDialog (hWnd, 0); // close the dialog box |
143 | 145 | ||
144 | hThisDialogWnd = NULL; // this window is about to no longer have a handle, so remember it |
146 | hThisDialogWnd = NULL; // this window is about to no longer have a handle, so remember it |
145 | } |
147 | } |
146 | 148 | ||
147 | // else did we take action on one of the controls ? |
149 | // else did we take action on one of the controls ? |
Line 272... | Line 274... | ||
272 | return (0); // couldn't create socket, return an error condition |
274 | return (0); // couldn't create socket, return an error condition |
273 | } |
275 | } |
274 | 276 | ||
275 | // connect to the distributor's webserver using that socket |
277 | // connect to the distributor's webserver using that socket |
276 | if (connect (s, (struct sockaddr *) &service, sizeof (service)) == -1) |
278 | if (connect (s, (struct sockaddr *) &service, sizeof (service)) == -1) |
277 | { |
279 | { |
278 | closesocket (s); |
280 | closesocket (s); |
279 | if (failure_reason != NULL) |
281 | if (failure_reason != NULL) |
280 | *failure_reason = LOCALIZE (L"Registration_NetworkFailure"); |
282 | *failure_reason = LOCALIZE (L"Registration_NetworkFailure"); |
281 | return (0); // unable to connect to webserver, return an error condition |
283 | return (0); // unable to connect to webserver, return an error condition |
282 | } |
284 | } |
283 | 285 | ||
Line 365... | Line 367... | ||
365 | return (false); // server returned an error, return an error condition |
367 | return (false); // server returned an error, return an error condition |
366 | 368 | ||
367 | #undef REGISTRATION_SCRIPT |
369 | #undef REGISTRATION_SCRIPT |
368 | #undef REGISTRATION_HOST |
370 | #undef REGISTRATION_HOST |
369 | } |
371 | } |
- | 372 | ||
- | 373 | #endif // !NO_REGISTRATION |