source: trunk/src/comctl32/ipaddress.c@ 2013

Last change on this file since 2013 was 1431, checked in by sandervl, 26 years ago

RegisterClass even if atom exists

File size: 18.6 KB
Line 
1/* $Id: ipaddress.c,v 1.8 1999-10-24 22:49:44 sandervl Exp $ */
2/*
3 * IP Address control
4 *
5 * Copyright 1999 Chris Morgan<cmorgan@wpi.edu> and
6 * James Abbatiello<abbeyj@wpi.edu>
7 * Copyright 1998, 1999 Eric Kohl
8 * Copyright 1998 Alex Priem <alexp@sci.kun.nl>
9 * Copyright 1999 Achim Hasenmueller
10 *
11 * NOTES
12 *
13 * TODO:
14 * -Check ranges when changing field-focus.
15 * -Check all notifications/behavior.
16 * -Optimization: include lpipsi in IPADDRESS_INFO.
17 * -CurrentFocus: field that has focus at moment of processing.
18 * -connect Rect32 rcClient.
19 * -handle right and left arrows correctly. Boring.
20 * -split GotoNextField in CheckField and GotoNextField.
21 * -check ipaddress.cpp for missing features.
22 * -refresh: draw '.' instead of setpixel.
23 * -handle VK_ESCAPE.
24 */
25
26#include <ctype.h>
27#include <stdlib.h>
28#include <stdio.h>
29
30#include "winbase.h"
31#include "commctrl.h"
32#include "ipaddress.h"
33//#include "heap.h"
34
35
36#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongA (hwnd, 0))
37
38
39static BOOL
40IPADDRESS_SendNotify (HWND hwnd, UINT command);
41static BOOL
42IPADDRESS_SendIPAddressNotify (HWND hwnd, UINT field, BYTE newValue);
43
44
45/* property name of tooltip window handle */
46#define IP_SUBCLASS_PROP "CCIP32SubclassInfo"
47
48
49static LRESULT CALLBACK
50IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
51
52
53
54
55static VOID
56IPADDRESS_Refresh (HWND hwnd, HDC hdc)
57{
58 RECT rcClient;
59 HBRUSH hbr;
60 COLORREF clr=GetSysColor (COLOR_3DDKSHADOW);
61 int i,x,fieldsize;
62
63 GetClientRect (hwnd, &rcClient);
64 hbr = CreateSolidBrush (RGB(255,255,255));
65 DrawEdge (hdc, &rcClient, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
66 FillRect (hdc, &rcClient, hbr);
67 DeleteObject (hbr);
68
69 x=rcClient.left;
70 fieldsize=(rcClient.right-rcClient.left) /4;
71
72 for (i=0; i<3; i++) { /* Should draw text "." here */
73 x+=fieldsize;
74 SetPixel (hdc, x, 13, clr);
75 SetPixel (hdc, x, 14, clr);
76 SetPixel (hdc, x+1, 13, clr);
77 SetPixel (hdc, x+1, 14, clr);
78 }
79}
80
81
82static LRESULT
83IPADDRESS_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
84{
85 IPADDRESS_INFO *infoPtr;
86 RECT rcClient, edit;
87 int i,fieldsize;
88 LPIP_SUBCLASS_INFO lpipsi;
89
90
91 infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO));
92 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
93
94 GetClientRect (hwnd, &rcClient);
95
96 fieldsize=(rcClient.right-rcClient.left) /4;
97
98 edit.top =rcClient.top+2;
99 edit.bottom=rcClient.bottom-2;
100
101 lpipsi=(LPIP_SUBCLASS_INFO) GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
102 if (lpipsi == NULL) {
103 lpipsi= (LPIP_SUBCLASS_INFO) COMCTL32_Alloc (sizeof(IP_SUBCLASS_INFO));
104 lpipsi->hwnd = hwnd;
105 lpipsi->uRefCount++;
106 SetPropA ((HWND)hwnd, IP_SUBCLASS_PROP, (HANDLE)lpipsi);
107/* infoPtr->lpipsi= lpipsi; */
108// } else
109 }
110// WARN (ipaddress,"IP-create called twice\n");
111
112 for (i=0; i<=3; i++)
113 {
114 infoPtr->LowerLimit[i]=0;
115 infoPtr->UpperLimit[i]=255;
116 edit.left=rcClient.left+i*fieldsize+6;
117 edit.right=rcClient.left+(i+1)*fieldsize-2;
118 lpipsi->hwndIP[i]= CreateWindowA ("edit", NULL,
119 WS_CHILD | WS_VISIBLE | ES_CENTER,
120 edit.left, edit.top, edit.right-edit.left, edit.bottom-edit.top,
121 hwnd, (HMENU) 1, GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
122 lpipsi->wpOrigProc[i]= (WNDPROC)
123 SetWindowLongA (lpipsi->hwndIP[i],GWL_WNDPROC, (LONG)
124 IPADDRESS_SubclassProc);
125 SetPropA ((HWND)lpipsi->hwndIP[i], IP_SUBCLASS_PROP, (HANDLE)lpipsi);
126 }
127
128 lpipsi->infoPtr= infoPtr;
129
130 return 0;
131}
132
133
134static LRESULT
135IPADDRESS_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
136{
137 int i;
138 IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
139 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
140 GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
141
142 for (i=0; i<=3; i++) {
143 SetWindowLongA ((HWND)lpipsi->hwndIP[i], GWL_WNDPROC,
144 (LONG)lpipsi->wpOrigProc[i]);
145 }
146
147 COMCTL32_Free (infoPtr);
148 return 0;
149}
150
151
152static LRESULT
153IPADDRESS_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
154{
155 HDC hdc;
156
157// TRACE (ipaddress,"\n");
158 hdc = GetDC (hwnd);
159 IPADDRESS_Refresh (hwnd, hdc);
160 ReleaseDC (hwnd, hdc);
161
162 IPADDRESS_SendIPAddressNotify (hwnd, 0, 0); /* FIXME: should use -1 */
163 IPADDRESS_SendNotify (hwnd, EN_KILLFOCUS);
164 InvalidateRect (hwnd, NULL, TRUE);
165
166 return 0;
167}
168
169
170static LRESULT
171IPADDRESS_Paint (HWND hwnd, WPARAM wParam)
172{
173 HDC hdc;
174 PAINTSTRUCT ps;
175
176 hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
177 IPADDRESS_Refresh (hwnd, hdc);
178 if(!wParam)
179 EndPaint (hwnd, &ps);
180 return 0;
181}
182
183
184static LRESULT
185IPADDRESS_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
186{
187 HDC hdc;
188
189// TRACE (ipaddress,"\n");
190
191 hdc = GetDC (hwnd);
192 IPADDRESS_Refresh (hwnd, hdc);
193 ReleaseDC (hwnd, hdc);
194
195 return 0;
196}
197
198
199static LRESULT
200IPADDRESS_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
201{
202 /* IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); */
203// TRACE (ipaddress,"\n");
204 return 0;
205}
206
207
208static BOOL
209IPADDRESS_SendNotify (HWND hwnd, UINT command)
210
211{
212// TRACE (ipaddress, "%x\n",command);
213 return (BOOL)SendMessageA (GetParent (hwnd), WM_COMMAND,
214 MAKEWPARAM (GetWindowLongA (hwnd, GWL_ID),command), (LPARAM)hwnd);
215}
216
217
218static BOOL
219IPADDRESS_SendIPAddressNotify (HWND hwnd, UINT field, BYTE newValue)
220{
221 NMIPADDRESS nmip;
222
223// TRACE (ipaddress, "%x %x\n",field,newValue);
224 nmip.hdr.hwndFrom = hwnd;
225 nmip.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
226 nmip.hdr.code = IPN_FIELDCHANGED;
227
228 nmip.iField=field;
229 nmip.iValue=newValue;
230
231 return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY,
232 (WPARAM)nmip.hdr.idFrom, (LPARAM)&nmip);
233}
234
235
236
237
238static LRESULT
239IPADDRESS_ClearAddress (HWND hwnd, WPARAM wParam, LPARAM lParam)
240{
241 int i;
242 HDC hdc;
243 char buf[1];
244 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
245 GetPropA ((HWND)hwnd,IP_SUBCLASS_PROP);
246
247// TRACE (ipaddress,"\n");
248
249 buf[0]=0;
250 for (i=0; i<=3; i++)
251 SetWindowTextA (lpipsi->hwndIP[i],buf);
252
253 hdc = GetDC (hwnd);
254 IPADDRESS_Refresh (hwnd, hdc);
255 ReleaseDC (hwnd, hdc);
256
257 return 0;
258}
259
260static LRESULT
261IPADDRESS_IsBlank (HWND hwnd, WPARAM wParam, LPARAM lParam)
262{
263 int i;
264 char buf[20];
265 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
266 GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
267
268// TRACE (ipaddress,"\n");
269
270 for (i=0; i<=3; i++) {
271 GetWindowTextA (lpipsi->hwndIP[i],buf,5);
272 if (buf[0])
273 return 0;
274 }
275
276 return 1;
277}
278
279static LRESULT
280IPADDRESS_GetAddress (HWND hwnd, WPARAM wParam, LPARAM lParam)
281{
282 char field[20];
283 int i,valid,fieldvalue;
284 DWORD ip_addr;
285 IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
286 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
287 GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
288
289// TRACE (ipaddress,"\n");
290
291 valid=0;
292 ip_addr=0;
293 for (i=0; i<=3; i++) {
294 GetWindowTextA (lpipsi->hwndIP[i],field,4);
295 ip_addr*=256;
296 if (field[0]) {
297 field[3]=0;
298 fieldvalue=atoi(field);
299 if (fieldvalue<infoPtr->LowerLimit[i])
300 fieldvalue=infoPtr->LowerLimit[i];
301 if (fieldvalue>infoPtr->UpperLimit[i])
302 fieldvalue=infoPtr->UpperLimit[i];
303 ip_addr+=fieldvalue;
304 valid++;
305 }
306 }
307
308 *(LPDWORD) lParam=ip_addr;
309
310 return valid;
311}
312
313
314static LRESULT
315IPADDRESS_SetRange (HWND hwnd, WPARAM wParam, LPARAM lParam)
316{
317 IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
318 INT index;
319
320// TRACE (ipaddress,"\n");
321
322 index=(INT) wParam;
323 if ((index<0) || (index>3)) return 0;
324
325 infoPtr->LowerLimit[index]=lParam & 0xff;
326 infoPtr->UpperLimit[index]=(lParam >>8) & 0xff;
327 return 1;
328}
329
330static LRESULT
331IPADDRESS_SetAddress (HWND hwnd, WPARAM wParam, LPARAM lParam)
332{
333 IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd);
334 HDC hdc;
335 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO)
336 GetPropA ((HWND)hwnd, IP_SUBCLASS_PROP);
337 int i,ip_address,value;
338 char buf[20];
339
340// TRACE (ipaddress,"\n");
341 ip_address=(DWORD) lParam;
342
343 for (i=3; i>=0; i--) {
344 value=ip_address & 0xff;
345 if ((value>=infoPtr->LowerLimit[i]) && (value<=infoPtr->UpperLimit[i]))
346 {
347 sprintf (buf,"%d",value);
348 SetWindowTextA (lpipsi->hwndIP[i],buf);
349 IPADDRESS_SendNotify (hwnd, EN_CHANGE);
350 }
351 ip_address/=256;
352 }
353
354 hdc = GetDC (hwnd); /* & send notifications */
355 IPADDRESS_Refresh (hwnd, hdc);
356 ReleaseDC (hwnd, hdc);
357
358 return TRUE;
359}
360
361
362
363
364static LRESULT
365IPADDRESS_SetFocusToField (HWND hwnd, WPARAM wParam, LPARAM lParam)
366{
367 /* IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr (hwnd); */
368 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) GetPropA ((HWND)hwnd,
369 IP_SUBCLASS_PROP);
370 INT index;
371
372 index=(INT) wParam;
373// TRACE (ipaddress," %d\n", index);
374 if ((index<0) || (index>3)) return 0;
375
376 SetFocus (lpipsi->hwndIP[index]);
377
378 return 1;
379}
380
381
382static LRESULT
383IPADDRESS_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
384{
385// TRACE (ipaddress, "\n");
386
387 SetFocus (hwnd);
388 IPADDRESS_SendNotify (hwnd, EN_SETFOCUS);
389 IPADDRESS_SetFocusToField (hwnd, 0, 0);
390
391 return TRUE;
392}
393
394static INT
395IPADDRESS_CheckField (LPIP_SUBCLASS_INFO lpipsi, int currentfield)
396{
397 int newField,fieldvalue;
398 char field[20];
399 IPADDRESS_INFO *infoPtr=lpipsi->infoPtr;
400
401 if(currentfield >= 0 && currentfield < 4)
402 {
403// TRACE("\n");
404 GetWindowTextA (lpipsi->hwndIP[currentfield],field,4);
405 if (field[0])
406 {
407 field[3]=0;
408 newField=-1;
409 fieldvalue=atoi(field);
410
411 if (fieldvalue < infoPtr->LowerLimit[currentfield])
412 newField=infoPtr->LowerLimit[currentfield];
413
414 if (fieldvalue > infoPtr->UpperLimit[currentfield])
415 newField=infoPtr->UpperLimit[currentfield];
416
417 if (newField >= 0)
418 {
419 sprintf (field,"%d",newField);
420 SetWindowTextA (lpipsi->hwndIP[currentfield], field);
421 return TRUE;
422 }
423 }
424 }
425 return FALSE;
426}
427
428
429static INT
430IPADDRESS_GotoNextField (LPIP_SUBCLASS_INFO lpipsi, int currentfield)
431{
432 if(currentfield >= -1 && currentfield < 4)
433 {
434 IPADDRESS_CheckField(lpipsi, currentfield); /* check the fields value */
435
436 if(currentfield < 3)
437 {
438 SetFocus (lpipsi->hwndIP[currentfield+1]);
439 return TRUE;
440 }
441 }
442 return FALSE;
443}
444
445
446/* period: move and select the text in the next field to the right if */
447/* the current field is not empty(l!=0), we are not in the */
448/* left most position, and nothing is selected(startsel==endsel) */
449
450/* spacebar: same behavior as period */
451
452/* alpha characters: completely ignored */
453
454/* digits: accepted when field text length < 2 ignored otherwise. */
455/* when 3 numbers have been entered into the field the value */
456/* of the field is checked, if the field value exceeds the */
457/* maximum value and is changed the field remains the current */
458/* field, otherwise focus moves to the field to the right */
459
460/* tab: change focus from the current ipaddress control to the next */
461/* control in the tab order */
462
463/* right arrow: move to the field on the right to the left most */
464/* position in that field if no text is selected, */
465/* we are in the right most position in the field, */
466/* we are not in the right most field */
467
468/* left arrow: move to the field on the left to the right most */
469/* position in that field if no text is selected, */
470/* we are in the left most position in the current field */
471/* and we are not in the left most field */
472
473/* backspace: delete the character to the left of the cursor position, */
474/* if none are present move to the field on the left if */
475/* we are not in the left most field and delete the right */
476/* most digit in that field while keeping the cursor */
477/* on the right side of the field */
478
479
480
481LRESULT CALLBACK
482IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
483{
484 IPADDRESS_INFO *infoPtr;
485 LPIP_SUBCLASS_INFO lpipsi=(LPIP_SUBCLASS_INFO) GetPropA ((HWND)hwnd,IP_SUBCLASS_PROP);
486 CHAR c = (CHAR)wParam;
487 INT i, l, index, startsel, endsel;
488
489 infoPtr = lpipsi->infoPtr;
490 index=0; /* FIXME */
491 for (i=0; i<=3; i++)
492 if (lpipsi->hwndIP[i]==hwnd) index=i;
493
494 switch (uMsg) {
495 case WM_CHAR:
496 if(isdigit(c)) /* process all digits */
497 {
498 int return_val;
499 SendMessageA(lpipsi->hwndIP[index], EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
500 l = GetWindowTextLengthA (lpipsi->hwndIP[index]);
501 if(l==2 && startsel==endsel) /* field is full after this key is processed */
502 {
503 /* process the digit press before we check the field */
504 return_val = CallWindowProcA (lpipsi->wpOrigProc[index], hwnd, uMsg, wParam, lParam);
505
506 /* if the field value was changed stay at the current field */
507 if(!IPADDRESS_CheckField(lpipsi, index))
508 IPADDRESS_GotoNextField (lpipsi,index);
509
510 return return_val;
511 }
512
513 if(l > 2) /* field is full, stop key messages */
514 {
515 lParam = 0;
516 wParam = 0;
517 }
518 break;
519 }
520
521 if(c == '.') /* VK_PERIOD */
522 {
523 l = GetWindowTextLengthA(lpipsi->hwndIP[index]);
524 SendMessageA(lpipsi->hwndIP[index], EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
525 if(l != 0 && startsel==endsel && startsel != 0)
526 {
527 IPADDRESS_GotoNextField(lpipsi, index);
528 SendMessageA(lpipsi->hwndIP[index+1], EM_SETSEL, (WPARAM)0, (LPARAM)3);
529 }
530 }
531
532 /* stop all other characters */
533 wParam = 0;
534 lParam = 0;
535 break;
536
537 case WM_KEYDOWN:
538 if(c == VK_SPACE)
539 {
540 l = GetWindowTextLengthA(lpipsi->hwndIP[index]);
541 SendMessageA(lpipsi->hwndIP[index], EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
542 if(l != 0 && startsel==endsel && startsel != 0)
543 {
544 IPADDRESS_GotoNextField(lpipsi, index);
545 SendMessageA(lpipsi->hwndIP[index+1], EM_SETSEL, (WPARAM)0, (LPARAM)3);
546 }
547 }
548
549 if(c == VK_RIGHT)
550 {
551 SendMessageA(lpipsi->hwndIP[index], EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
552 l = GetWindowTextLengthA (lpipsi->hwndIP[index]);
553
554 if(startsel==endsel && startsel==l)
555 {
556 IPADDRESS_GotoNextField(lpipsi, index);
557 SendMessageA(lpipsi->hwndIP[index+1], EM_SETSEL, (WPARAM)0,(LPARAM)0);
558 }
559 }
560
561 if(c == VK_LEFT)
562 {
563 SendMessageA(lpipsi->hwndIP[index], EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
564 if(startsel==0 && startsel==endsel && index > 0)
565 {
566 IPADDRESS_GotoNextField(lpipsi, index - 2);
567 l = GetWindowTextLengthA(lpipsi->hwndIP[index-1]);
568 SendMessageA(lpipsi->hwndIP[index-1], EM_SETSEL, (WPARAM)l,(LPARAM)l);
569 }
570 }
571
572 if(c == VK_BACK) /* VK_BACKSPACE */
573 {
574 CHAR buf[4];
575
576 SendMessageA(lpipsi->hwndIP[index], EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
577 l = GetWindowTextLengthA (lpipsi->hwndIP[index]);
578 if(startsel==endsel && startsel==0 && index > 0)
579 {
580 l = GetWindowTextLengthA(lpipsi->hwndIP[index-1]);
581 if(l!=0)
582 {
583 GetWindowTextA (lpipsi->hwndIP[index-1],buf,4);
584 buf[l-1] = '\0';
585 SetWindowTextA(lpipsi->hwndIP[index-1], buf);
586 SendMessageA(lpipsi->hwndIP[index-1], EM_SETSEL, (WPARAM)l,(LPARAM)l);
587 }
588 IPADDRESS_GotoNextField(lpipsi, index - 2);
589 }
590 }
591 break;
592
593 default:
594 break;
595 }
596 return CallWindowProcA (lpipsi->wpOrigProc[index], hwnd, uMsg, wParam, lParam);
597}
598
599static LRESULT WINAPI
600IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
601{
602 switch (uMsg)
603 {
604 case IPM_CLEARADDRESS:
605 return IPADDRESS_ClearAddress (hwnd, wParam, lParam);
606
607 case IPM_SETADDRESS:
608 return IPADDRESS_SetAddress (hwnd, wParam, lParam);
609
610 case IPM_GETADDRESS:
611 return IPADDRESS_GetAddress (hwnd, wParam, lParam);
612
613 case IPM_SETRANGE:
614 return IPADDRESS_SetRange (hwnd, wParam, lParam);
615
616 case IPM_SETFOCUS:
617 return IPADDRESS_SetFocusToField (hwnd, wParam, lParam);
618
619 case IPM_ISBLANK:
620 return IPADDRESS_IsBlank (hwnd, wParam, lParam);
621
622 case WM_CREATE:
623 return IPADDRESS_Create (hwnd, wParam, lParam);
624
625 case WM_DESTROY:
626 return IPADDRESS_Destroy (hwnd, wParam, lParam);
627
628 case WM_GETDLGCODE:
629 return DLGC_WANTARROWS | DLGC_WANTCHARS;
630
631 case WM_KILLFOCUS:
632 return IPADDRESS_KillFocus (hwnd, wParam, lParam);
633
634 case WM_LBUTTONDOWN:
635 return IPADDRESS_LButtonDown (hwnd, wParam, lParam);
636
637 case WM_PAINT:
638 return IPADDRESS_Paint (hwnd, wParam);
639
640 case WM_SETFOCUS:
641 return IPADDRESS_SetFocus (hwnd, wParam, lParam);
642
643 case WM_SIZE:
644 return IPADDRESS_Size (hwnd, wParam, lParam);
645
646 default:
647// if (uMsg >= WM_USER)
648// ERR (ipaddress, "unknown msg %04x wp=%08x lp=%08lx\n",
649// uMsg, wParam, lParam);
650 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
651 }
652 return 0;
653}
654
655
656void
657IPADDRESS_Register (void)
658{
659 WNDCLASSA wndClass;
660
661//SvL: Don't check this now
662// if (GlobalFindAtomA (WC_IPADDRESSA)) return;
663
664 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
665 wndClass.style = CS_GLOBALCLASS;
666 wndClass.lpfnWndProc = (WNDPROC)IPADDRESS_WindowProc;
667 wndClass.cbClsExtra = 0;
668 wndClass.cbWndExtra = sizeof(IPADDRESS_INFO *);
669 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
670 wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
671 wndClass.lpszClassName = WC_IPADDRESSA;
672
673 RegisterClassA (&wndClass);
674}
675
676VOID
677IPADDRESS_Unregister (VOID)
678{
679 if (GlobalFindAtomA (WC_IPADDRESSA))
680 UnregisterClassA (WC_IPADDRESSA, (HINSTANCE)NULL);
681}
682
Note: See TracBrowser for help on using the repository browser.