Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenipaddress.c
Go to the documentation of this file.
00001 /* 00002 * IP Address control 00003 * 00004 * Copyright 2002 Dimitrie O. Paun 00005 * Copyright 1999 Chris Morgan<cmorgan@wpi.edu> 00006 * Copyright 1999 James Abbatiello<abbeyj@wpi.edu> 00007 * Copyright 1998, 1999 Eric Kohl 00008 * Copyright 1998 Alex Priem <alexp@sci.kun.nl> 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00023 * 00024 * NOTE 00025 * 00026 * This code was audited for completeness against the documented features 00027 * of Comctl32.dll version 6.0 on Sep. 9, 2002, by Dimitrie O. Paun. 00028 * 00029 * Unless otherwise noted, we believe this code to be complete, as per 00030 * the specification mentioned above. 00031 * If you discover missing features, or bugs, please note them below. 00032 * 00033 */ 00034 00035 #include <ctype.h> 00036 #include <stdlib.h> 00037 #include <stdarg.h> 00038 #include <stdio.h> 00039 #include <string.h> 00040 00041 #include "windef.h" 00042 #include "winbase.h" 00043 #include "wingdi.h" 00044 #include "winuser.h" 00045 #include "winnls.h" 00046 #include "commctrl.h" 00047 #include "comctl32.h" 00048 #include "wine/unicode.h" 00049 #include "wine/debug.h" 00050 00051 WINE_DEFAULT_DEBUG_CHANNEL(ipaddress); 00052 00053 typedef struct 00054 { 00055 HWND EditHwnd; 00056 INT LowerLimit; 00057 INT UpperLimit; 00058 WNDPROC OrigProc; 00059 } IPPART_INFO; 00060 00061 typedef struct 00062 { 00063 HWND Self; 00064 HWND Notify; 00065 BOOL Enabled; 00066 IPPART_INFO Part[4]; 00067 } IPADDRESS_INFO; 00068 00069 static const WCHAR IP_SUBCLASS_PROP[] = 00070 { 'C', 'C', 'I', 'P', '3', '2', 'S', 'u', 'b', 'c', 'l', 'a', 's', 's', 'I', 'n', 'f', 'o', 0 }; 00071 00072 #define POS_DEFAULT 0 00073 #define POS_LEFT 1 00074 #define POS_RIGHT 2 00075 #define POS_SELALL 3 00076 00077 static LRESULT CALLBACK 00078 IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 00079 00080 static void IPADDRESS_UpdateText (const IPADDRESS_INFO *infoPtr) 00081 { 00082 static const WCHAR zero[] = {'0', 0}; 00083 static const WCHAR dot[] = {'.', 0}; 00084 WCHAR field[4]; 00085 WCHAR ip[16]; 00086 INT i; 00087 00088 ip[0] = 0; 00089 00090 for (i = 0; i < 4; i++) { 00091 if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) 00092 strcatW(ip, field); 00093 else 00094 /* empty edit treated as zero */ 00095 strcatW(ip, zero); 00096 if (i != 3) 00097 strcatW(ip, dot); 00098 } 00099 00100 SetWindowTextW(infoPtr->Self, ip); 00101 } 00102 00103 static LRESULT IPADDRESS_Notify (const IPADDRESS_INFO *infoPtr, UINT command) 00104 { 00105 HWND hwnd = infoPtr->Self; 00106 00107 TRACE("(command=%x)\n", command); 00108 00109 return SendMessageW (infoPtr->Notify, WM_COMMAND, 00110 MAKEWPARAM (GetWindowLongPtrW (hwnd, GWLP_ID), command), (LPARAM)hwnd); 00111 } 00112 00113 static INT IPADDRESS_IPNotify (const IPADDRESS_INFO *infoPtr, INT field, INT value) 00114 { 00115 NMIPADDRESS nmip; 00116 00117 TRACE("(field=%x, value=%d)\n", field, value); 00118 00119 nmip.hdr.hwndFrom = infoPtr->Self; 00120 nmip.hdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); 00121 nmip.hdr.code = IPN_FIELDCHANGED; 00122 00123 nmip.iField = field; 00124 nmip.iValue = value; 00125 00126 SendMessageW (infoPtr->Notify, WM_NOTIFY, nmip.hdr.idFrom, (LPARAM)&nmip); 00127 00128 TRACE("<-- %d\n", nmip.iValue); 00129 00130 return nmip.iValue; 00131 } 00132 00133 00134 static int IPADDRESS_GetPartIndex(const IPADDRESS_INFO *infoPtr, HWND hwnd) 00135 { 00136 int i; 00137 00138 TRACE("(hwnd=%p)\n", hwnd); 00139 00140 for (i = 0; i < 4; i++) 00141 if (infoPtr->Part[i].EditHwnd == hwnd) return i; 00142 00143 ERR("We subclassed the wrong window! (hwnd=%p)\n", hwnd); 00144 return -1; 00145 } 00146 00147 00148 static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc) 00149 { 00150 static const WCHAR dotW[] = { '.', 0 }; 00151 RECT rect, rcPart; 00152 COLORREF bgCol, fgCol; 00153 int i; 00154 00155 TRACE("\n"); 00156 00157 GetClientRect (infoPtr->Self, &rect); 00158 00159 if (infoPtr->Enabled) { 00160 bgCol = comctl32_color.clrWindow; 00161 fgCol = comctl32_color.clrWindowText; 00162 } else { 00163 bgCol = comctl32_color.clr3dFace; 00164 fgCol = comctl32_color.clrGrayText; 00165 } 00166 00167 FillRect (hdc, &rect, (HBRUSH)(DWORD_PTR)(bgCol+1)); 00168 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); 00169 00170 SetBkColor (hdc, bgCol); 00171 SetTextColor(hdc, fgCol); 00172 00173 for (i = 0; i < 3; i++) { 00174 GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart); 00175 MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 ); 00176 rect.left = rcPart.right; 00177 GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart); 00178 MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 ); 00179 rect.right = rcPart.left; 00180 DrawTextW(hdc, dotW, 1, &rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM); 00181 } 00182 00183 return 0; 00184 } 00185 00186 00187 static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) 00188 { 00189 IPADDRESS_INFO *infoPtr; 00190 RECT rcClient, edit; 00191 int i, fieldsize; 00192 HFONT hFont, hSysFont; 00193 LOGFONTW logFont, logSysFont; 00194 00195 TRACE("\n"); 00196 00197 SetWindowLongW (hwnd, GWL_STYLE, 00198 GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER); 00199 00200 infoPtr = Alloc (sizeof(IPADDRESS_INFO)); 00201 if (!infoPtr) return -1; 00202 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); 00203 00204 GetClientRect (hwnd, &rcClient); 00205 00206 fieldsize = (rcClient.right - rcClient.left) / 4; 00207 00208 edit.top = rcClient.top + 2; 00209 edit.bottom = rcClient.bottom - 2; 00210 00211 infoPtr->Self = hwnd; 00212 infoPtr->Enabled = TRUE; 00213 infoPtr->Notify = lpCreate->hwndParent; 00214 00215 hSysFont = GetStockObject(ANSI_VAR_FONT); 00216 GetObjectW(hSysFont, sizeof(LOGFONTW), &logSysFont); 00217 SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); 00218 strcpyW(logFont.lfFaceName, logSysFont.lfFaceName); 00219 hFont = CreateFontIndirectW(&logFont); 00220 00221 for (i = 0; i < 4; i++) { 00222 IPPART_INFO* part = &infoPtr->Part[i]; 00223 00224 part->LowerLimit = 0; 00225 part->UpperLimit = 255; 00226 edit.left = rcClient.left + i*fieldsize + 6; 00227 edit.right = rcClient.left + (i+1)*fieldsize - 2; 00228 part->EditHwnd = 00229 CreateWindowW (WC_EDITW, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER, 00230 edit.left, edit.top, edit.right - edit.left, 00231 edit.bottom - edit.top, hwnd, (HMENU) 1, 00232 (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL); 00233 SendMessageW(part->EditHwnd, WM_SETFONT, (WPARAM) hFont, FALSE); 00234 SetPropW(part->EditHwnd, IP_SUBCLASS_PROP, hwnd); 00235 part->OrigProc = (WNDPROC) 00236 SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, 00237 (DWORD_PTR)IPADDRESS_SubclassProc); 00238 EnableWindow(part->EditHwnd, infoPtr->Enabled); 00239 } 00240 00241 IPADDRESS_UpdateText (infoPtr); 00242 00243 return 0; 00244 } 00245 00246 00247 static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr) 00248 { 00249 int i; 00250 00251 TRACE("\n"); 00252 00253 for (i = 0; i < 4; i++) { 00254 IPPART_INFO* part = &infoPtr->Part[i]; 00255 SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)part->OrigProc); 00256 } 00257 00258 SetWindowLongPtrW (infoPtr->Self, 0, 0); 00259 Free (infoPtr); 00260 return 0; 00261 } 00262 00263 00264 static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled) 00265 { 00266 int i; 00267 00268 infoPtr->Enabled = enabled; 00269 00270 for (i = 0; i < 4; i++) 00271 EnableWindow(infoPtr->Part[i].EditHwnd, enabled); 00272 00273 InvalidateRgn(infoPtr->Self, NULL, FALSE); 00274 return 0; 00275 } 00276 00277 00278 static LRESULT IPADDRESS_Paint (const IPADDRESS_INFO *infoPtr, HDC hdc) 00279 { 00280 PAINTSTRUCT ps; 00281 00282 TRACE("\n"); 00283 00284 if (hdc) return IPADDRESS_Draw (infoPtr, hdc); 00285 00286 hdc = BeginPaint (infoPtr->Self, &ps); 00287 IPADDRESS_Draw (infoPtr, hdc); 00288 EndPaint (infoPtr->Self, &ps); 00289 return 0; 00290 } 00291 00292 00293 static BOOL IPADDRESS_IsBlank (const IPADDRESS_INFO *infoPtr) 00294 { 00295 int i; 00296 00297 TRACE("\n"); 00298 00299 for (i = 0; i < 4; i++) 00300 if (GetWindowTextLengthW (infoPtr->Part[i].EditHwnd)) return FALSE; 00301 00302 return TRUE; 00303 } 00304 00305 00306 static int IPADDRESS_GetAddress (const IPADDRESS_INFO *infoPtr, LPDWORD ip_address) 00307 { 00308 WCHAR field[5]; 00309 int i, invalid = 0; 00310 DWORD ip_addr = 0; 00311 00312 TRACE("\n"); 00313 00314 for (i = 0; i < 4; i++) { 00315 ip_addr *= 256; 00316 if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4)) 00317 ip_addr += atolW(field); 00318 else 00319 invalid++; 00320 } 00321 *ip_address = ip_addr; 00322 00323 return 4 - invalid; 00324 } 00325 00326 00327 static BOOL IPADDRESS_SetRange (IPADDRESS_INFO *infoPtr, int index, WORD range) 00328 { 00329 TRACE("\n"); 00330 00331 if ( (index < 0) || (index > 3) ) return FALSE; 00332 00333 infoPtr->Part[index].LowerLimit = range & 0xFF; 00334 infoPtr->Part[index].UpperLimit = (range >> 8) & 0xFF; 00335 00336 return TRUE; 00337 } 00338 00339 00340 static void IPADDRESS_ClearAddress (const IPADDRESS_INFO *infoPtr) 00341 { 00342 static const WCHAR nil[] = { 0 }; 00343 int i; 00344 00345 TRACE("\n"); 00346 00347 for (i = 0; i < 4; i++) 00348 SetWindowTextW (infoPtr->Part[i].EditHwnd, nil); 00349 } 00350 00351 00352 static LRESULT IPADDRESS_SetAddress (const IPADDRESS_INFO *infoPtr, DWORD ip_address) 00353 { 00354 WCHAR buf[20]; 00355 static const WCHAR fmt[] = { '%', 'd', 0 }; 00356 int i; 00357 00358 TRACE("\n"); 00359 00360 for (i = 3; i >= 0; i--) { 00361 const IPPART_INFO* part = &infoPtr->Part[i]; 00362 int value = ip_address & 0xff; 00363 if ( (value >= part->LowerLimit) && (value <= part->UpperLimit) ) { 00364 wsprintfW (buf, fmt, value); 00365 SetWindowTextW (part->EditHwnd, buf); 00366 IPADDRESS_Notify (infoPtr, EN_CHANGE); 00367 } 00368 ip_address >>= 8; 00369 } 00370 00371 return TRUE; 00372 } 00373 00374 00375 static void IPADDRESS_SetFocusToField (const IPADDRESS_INFO *infoPtr, INT index) 00376 { 00377 TRACE("(index=%d)\n", index); 00378 00379 if (index > 3 || index < 0) index=0; 00380 00381 SetFocus (infoPtr->Part[index].EditHwnd); 00382 } 00383 00384 00385 static BOOL IPADDRESS_ConstrainField (const IPADDRESS_INFO *infoPtr, int currentfield) 00386 { 00387 static const WCHAR fmt[] = { '%', 'd', 0 }; 00388 const IPPART_INFO *part; 00389 int curValue, newValue; 00390 WCHAR field[10]; 00391 00392 TRACE("(currentfield=%d)\n", currentfield); 00393 00394 if (currentfield < 0 || currentfield > 3) return FALSE; 00395 00396 part = &infoPtr->Part[currentfield]; 00397 if (!GetWindowTextW (part->EditHwnd, field, 4)) return FALSE; 00398 00399 curValue = atoiW(field); 00400 TRACE(" curValue=%d\n", curValue); 00401 00402 newValue = IPADDRESS_IPNotify(infoPtr, currentfield, curValue); 00403 TRACE(" newValue=%d\n", newValue); 00404 00405 if (newValue < part->LowerLimit) newValue = part->LowerLimit; 00406 if (newValue > part->UpperLimit) newValue = part->UpperLimit; 00407 00408 if (newValue == curValue) return FALSE; 00409 00410 wsprintfW (field, fmt, newValue); 00411 TRACE(" field=%s\n", debugstr_w(field)); 00412 return SetWindowTextW (part->EditHwnd, field); 00413 } 00414 00415 00416 static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int sel) 00417 { 00418 TRACE("\n"); 00419 00420 if(cur >= -1 && cur < 4) { 00421 IPADDRESS_ConstrainField(infoPtr, cur); 00422 00423 if(cur < 3) { 00424 const IPPART_INFO *next = &infoPtr->Part[cur + 1]; 00425 int start = 0, end = 0; 00426 SetFocus (next->EditHwnd); 00427 if (sel != POS_DEFAULT) { 00428 if (sel == POS_RIGHT) 00429 start = end = GetWindowTextLengthW(next->EditHwnd); 00430 else if (sel == POS_SELALL) 00431 end = -1; 00432 SendMessageW(next->EditHwnd, EM_SETSEL, start, end); 00433 } 00434 return TRUE; 00435 } 00436 00437 } 00438 return FALSE; 00439 } 00440 00441 00442 /* 00443 * period: move and select the text in the next field to the right if 00444 * the current field is not empty(l!=0), we are not in the 00445 * left most position, and nothing is selected(startsel==endsel) 00446 * 00447 * spacebar: same behavior as period 00448 * 00449 * alpha characters: completely ignored 00450 * 00451 * digits: accepted when field text length < 2 ignored otherwise. 00452 * when 3 numbers have been entered into the field the value 00453 * of the field is checked, if the field value exceeds the 00454 * maximum value and is changed the field remains the current 00455 * field, otherwise focus moves to the field to the right 00456 * 00457 * tab: change focus from the current ipaddress control to the next 00458 * control in the tab order 00459 * 00460 * right arrow: move to the field on the right to the left most 00461 * position in that field if no text is selected, 00462 * we are in the right most position in the field, 00463 * we are not in the right most field 00464 * 00465 * left arrow: move to the field on the left to the right most 00466 * position in that field if no text is selected, 00467 * we are in the left most position in the current field 00468 * and we are not in the left most field 00469 * 00470 * backspace: delete the character to the left of the cursor position, 00471 * if none are present move to the field on the left if 00472 * we are not in the left most field and delete the right 00473 * most digit in that field while keeping the cursor 00474 * on the right side of the field 00475 */ 00476 LRESULT CALLBACK 00477 IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 00478 { 00479 HWND Self = GetPropW (hwnd, IP_SUBCLASS_PROP); 00480 IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (Self, 0); 00481 CHAR c = (CHAR)wParam; 00482 INT index, len = 0, startsel, endsel; 00483 IPPART_INFO *part; 00484 00485 TRACE("(hwnd=%p msg=0x%x wparam=0x%lx lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam); 00486 00487 if ( (index = IPADDRESS_GetPartIndex(infoPtr, hwnd)) < 0) return 0; 00488 part = &infoPtr->Part[index]; 00489 00490 if (uMsg == WM_CHAR || uMsg == WM_KEYDOWN) { 00491 len = GetWindowTextLengthW (hwnd); 00492 SendMessageW(hwnd, EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel); 00493 } 00494 switch (uMsg) { 00495 case WM_CHAR: 00496 if(isdigit(c)) { 00497 if(len == 2 && startsel==endsel && endsel==len) { 00498 /* process the digit press before we check the field */ 00499 int return_val = CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam); 00500 00501 /* if the field value was changed stay at the current field */ 00502 if(!IPADDRESS_ConstrainField(infoPtr, index)) 00503 IPADDRESS_GotoNextField (infoPtr, index, POS_DEFAULT); 00504 00505 return return_val; 00506 } else if (len == 3 && startsel==endsel && endsel==len) 00507 IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL); 00508 else if (len < 3 || startsel != endsel) break; 00509 } else if(c == '.' || c == ' ') { 00510 if(len && startsel==endsel && startsel != 0) { 00511 IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL); 00512 } 00513 } else if (c == VK_BACK) break; 00514 return 0; 00515 00516 case WM_KEYDOWN: 00517 switch(c) { 00518 case VK_RIGHT: 00519 if(startsel==endsel && startsel==len) { 00520 IPADDRESS_GotoNextField(infoPtr, index, POS_LEFT); 00521 return 0; 00522 } 00523 break; 00524 case VK_LEFT: 00525 if(startsel==0 && startsel==endsel && index > 0) { 00526 IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT); 00527 return 0; 00528 } 00529 break; 00530 case VK_BACK: 00531 if(startsel==endsel && startsel==0 && index > 0) { 00532 IPPART_INFO *prev = &infoPtr->Part[index-1]; 00533 WCHAR val[10]; 00534 00535 if(GetWindowTextW(prev->EditHwnd, val, 5)) { 00536 val[lstrlenW(val) - 1] = 0; 00537 SetWindowTextW(prev->EditHwnd, val); 00538 } 00539 00540 IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT); 00541 return 0; 00542 } 00543 break; 00544 } 00545 break; 00546 case WM_KILLFOCUS: 00547 if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0) 00548 IPADDRESS_Notify(infoPtr, EN_KILLFOCUS); 00549 break; 00550 case WM_SETFOCUS: 00551 if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0) 00552 IPADDRESS_Notify(infoPtr, EN_SETFOCUS); 00553 break; 00554 } 00555 return CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam); 00556 } 00557 00558 00559 static LRESULT WINAPI 00560 IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 00561 { 00562 IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0); 00563 00564 TRACE("(hwnd=%p msg=0x%x wparam=0x%lx lparam=0x%lx)\n", hwnd, uMsg, wParam, lParam); 00565 00566 if (!infoPtr && (uMsg != WM_CREATE)) 00567 return DefWindowProcW (hwnd, uMsg, wParam, lParam); 00568 00569 switch (uMsg) 00570 { 00571 case WM_CREATE: 00572 return IPADDRESS_Create (hwnd, (LPCREATESTRUCTA)lParam); 00573 00574 case WM_DESTROY: 00575 return IPADDRESS_Destroy (infoPtr); 00576 00577 case WM_ENABLE: 00578 return IPADDRESS_Enable (infoPtr, (BOOL)wParam); 00579 00580 case WM_PAINT: 00581 return IPADDRESS_Paint (infoPtr, (HDC)wParam); 00582 00583 case WM_COMMAND: 00584 switch(wParam >> 16) { 00585 case EN_CHANGE: 00586 IPADDRESS_UpdateText(infoPtr); 00587 IPADDRESS_Notify(infoPtr, EN_CHANGE); 00588 break; 00589 case EN_KILLFOCUS: 00590 IPADDRESS_ConstrainField(infoPtr, IPADDRESS_GetPartIndex(infoPtr, (HWND)lParam)); 00591 break; 00592 } 00593 break; 00594 00595 case WM_SYSCOLORCHANGE: 00596 COMCTL32_RefreshSysColors(); 00597 return 0; 00598 00599 case IPM_CLEARADDRESS: 00600 IPADDRESS_ClearAddress (infoPtr); 00601 break; 00602 00603 case IPM_SETADDRESS: 00604 return IPADDRESS_SetAddress (infoPtr, (DWORD)lParam); 00605 00606 case IPM_GETADDRESS: 00607 return IPADDRESS_GetAddress (infoPtr, (LPDWORD)lParam); 00608 00609 case IPM_SETRANGE: 00610 return IPADDRESS_SetRange (infoPtr, (int)wParam, (WORD)lParam); 00611 00612 case IPM_SETFOCUS: 00613 IPADDRESS_SetFocusToField (infoPtr, (int)wParam); 00614 break; 00615 00616 case IPM_ISBLANK: 00617 return IPADDRESS_IsBlank (infoPtr); 00618 00619 default: 00620 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) 00621 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); 00622 return DefWindowProcW (hwnd, uMsg, wParam, lParam); 00623 } 00624 return 0; 00625 } 00626 00627 00628 void IPADDRESS_Register (void) 00629 { 00630 WNDCLASSW wndClass; 00631 00632 ZeroMemory (&wndClass, sizeof(WNDCLASSW)); 00633 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; 00634 wndClass.lpfnWndProc = IPADDRESS_WindowProc; 00635 wndClass.cbClsExtra = 0; 00636 wndClass.cbWndExtra = sizeof(IPADDRESS_INFO *); 00637 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_IBEAM); 00638 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); 00639 wndClass.lpszClassName = WC_IPADDRESSW; 00640 00641 RegisterClassW (&wndClass); 00642 } 00643 00644 00645 void IPADDRESS_Unregister (void) 00646 { 00647 UnregisterClassW (WC_IPADDRESSW, NULL); 00648 } Generated on Sat May 26 2012 04:21:35 for ReactOS by
1.7.6.1
|