Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
85c03a5a
Commit
85c03a5a
authored
Mar 23, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/ipaddress: Store current IP address text as a window text for IP Address control.
parent
b7d7d589
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
1 deletion
+117
-1
ipaddress.c
dlls/comctl32/ipaddress.c
+26
-0
Makefile.in
dlls/comctl32/tests/Makefile.in
+1
-0
ipaddress.c
dlls/comctl32/tests/ipaddress.c
+89
-0
commctrl.h
include/commctrl.h
+1
-1
No files found.
dlls/comctl32/ipaddress.c
View file @
85c03a5a
...
...
@@ -77,6 +77,29 @@ static const WCHAR IP_SUBCLASS_PROP[] =
static
LRESULT
CALLBACK
IPADDRESS_SubclassProc
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
);
static
void
IPADDRESS_UpdateText
(
const
IPADDRESS_INFO
*
infoPtr
)
{
static
const
WCHAR
zero
[
2
]
=
{
'0'
,
0
};
static
const
WCHAR
dot
[
2
]
=
{
'.'
,
0
};
WCHAR
field
[
4
];
WCHAR
ip
[
16
];
INT
i
;
ip
[
0
]
=
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
GetWindowTextW
(
infoPtr
->
Part
[
i
].
EditHwnd
,
field
,
4
))
strcatW
(
ip
,
field
);
else
/* empty edit treated as zero */
strcatW
(
ip
,
zero
);
if
(
i
!=
3
)
strcatW
(
ip
,
dot
);
}
SetWindowTextW
(
infoPtr
->
Self
,
ip
);
}
static
LRESULT
IPADDRESS_Notify
(
const
IPADDRESS_INFO
*
infoPtr
,
UINT
command
)
{
HWND
hwnd
=
infoPtr
->
Self
;
...
...
@@ -219,6 +242,8 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
EnableWindow
(
part
->
EditHwnd
,
infoPtr
->
Enabled
);
}
IPADDRESS_UpdateText
(
infoPtr
);
return
0
;
}
...
...
@@ -561,6 +586,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case
WM_COMMAND
:
switch
(
wParam
>>
16
)
{
case
EN_CHANGE
:
IPADDRESS_UpdateText
(
infoPtr
);
IPADDRESS_Notify
(
infoPtr
,
EN_CHANGE
);
break
;
case
EN_KILLFOCUS
:
...
...
dlls/comctl32/tests/Makefile.in
View file @
85c03a5a
...
...
@@ -11,6 +11,7 @@ CTESTS = \
dpa.c
\
header.c
\
imagelist.c
\
ipaddress.c
\
listview.c
\
misc.c
\
monthcal.c
\
...
...
dlls/comctl32/tests/ipaddress.c
0 → 100644
View file @
85c03a5a
/* Unit test suite for IP Address control.
*
* Copyright 2009 Nikolay Sivov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windows.h>
#include <commctrl.h>
#include <assert.h>
#include "wine/test.h"
#define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got)
static
HWND
create_ipaddress_control
(
void
)
{
HWND
handle
;
handle
=
CreateWindowEx
(
0
,
WC_IPADDRESS
,
NULL
,
WS_BORDER
|
WS_VISIBLE
,
0
,
0
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
assert
(
handle
);
return
handle
;
}
static
void
test_get_set_text
(
void
)
{
HWND
hwnd
;
CHAR
ip
[
16
];
INT
r
;
hwnd
=
create_ipaddress_control
();
/* check text just after creation */
r
=
GetWindowText
(
hwnd
,
ip
,
sizeof
(
ip
)
/
sizeof
(
CHAR
));
expect
(
7
,
r
);
ok
(
strcmp
(
ip
,
"0.0.0.0"
)
==
0
,
"Expected null IP address, got %s
\n
"
,
ip
);
SendMessage
(
hwnd
,
IPM_SETADDRESS
,
0
,
MAKEIPADDRESS
(
127
,
0
,
0
,
1
));
r
=
GetWindowText
(
hwnd
,
ip
,
sizeof
(
ip
)
/
sizeof
(
CHAR
));
expect
(
9
,
r
);
ok
(
strcmp
(
ip
,
"127.0.0.1"
)
==
0
,
"Expected 127.0.0.1, got %s
\n
"
,
ip
);
DestroyWindow
(
hwnd
);
}
static
int
init
(
void
)
{
HMODULE
hComctl32
;
BOOL
(
WINAPI
*
pInitCommonControlsEx
)(
const
INITCOMMONCONTROLSEX
*
);
INITCOMMONCONTROLSEX
iccex
;
hComctl32
=
GetModuleHandleA
(
"comctl32.dll"
);
pInitCommonControlsEx
=
(
void
*
)
GetProcAddress
(
hComctl32
,
"InitCommonControlsEx"
);
if
(
!
pInitCommonControlsEx
)
{
skip
(
"InitCommonControlsEx() is missing. Skipping the tests
\n
"
);
return
0
;
}
iccex
.
dwSize
=
sizeof
(
iccex
);
iccex
.
dwICC
=
ICC_USEREX_CLASSES
;
pInitCommonControlsEx
(
&
iccex
);
return
1
;
}
START_TEST
(
ipaddress
)
{
if
(
!
init
())
return
;
test_get_set_text
();
}
include/commctrl.h
View file @
85c03a5a
...
...
@@ -4459,7 +4459,7 @@ typedef struct tagNMIPADDRESS
#define MAKEIPRANGE(low,high) \
((LPARAM)(WORD)(((BYTE)(high)<<8)+(BYTE)(low)))
#define MAKEIPADDRESS(b1,b2,b3,b4) \
((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<
<
16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
#define FIRST_IPADDRESS(x) (((x)>>24)&0xff)
#define SECOND_IPADDRESS(x) (((x)>>16)&0xff)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment