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
0c702d14
Commit
0c702d14
authored
May 05, 2009
by
Michael Stefaniuc
Committed by
Alexandre Julliard
May 05, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notepad: Use the explicit SendMessageW form.
parent
df5d82dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
dialog.c
programs/notepad/dialog.c
+21
-21
main.c
programs/notepad/main.c
+13
-13
No files found.
programs/notepad/dialog.c
View file @
0c702d14
...
...
@@ -160,7 +160,7 @@ static VOID DoSaveFile(VOID)
if
(
!
WriteFile
(
hFile
,
pTemp
,
size
,
&
dwNumWrite
,
NULL
))
ShowLastError
();
else
SendMessage
(
Globals
.
hEdit
,
EM_SETMODIFY
,
FALSE
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETMODIFY
,
FALSE
,
0
);
SetEndOfFile
(
hFile
);
CloseHandle
(
hFile
);
...
...
@@ -177,7 +177,7 @@ BOOL DoCloseFile(void)
int
nResult
;
static
const
WCHAR
empty_strW
[]
=
{
0
};
if
(
SendMessage
(
Globals
.
hEdit
,
EM_GETMODIFY
,
0
,
0
))
if
(
SendMessage
W
(
Globals
.
hEdit
,
EM_GETMODIFY
,
0
,
0
))
{
/* prompt user to save changes */
nResult
=
AlertFileNotSaved
(
Globals
.
szFileName
);
...
...
@@ -255,18 +255,18 @@ void DoOpenFile(LPCWSTR szFileName)
HeapFree
(
GetProcessHeap
(),
0
,
pTemp
);
SendMessage
(
Globals
.
hEdit
,
EM_SETMODIFY
,
FALSE
,
0
);
SendMessage
(
Globals
.
hEdit
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETMODIFY
,
FALSE
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
SetFocus
(
Globals
.
hEdit
);
/* If the file starts with .LOG, add a time/date at the end and set cursor after */
if
(
GetWindowTextW
(
Globals
.
hEdit
,
log
,
sizeof
(
log
)
/
sizeof
(
log
[
0
]))
&&
!
lstrcmp
(
log
,
dotlog
))
{
static
const
WCHAR
lfW
[]
=
{
'\r'
,
'\n'
,
0
};
SendMessage
(
Globals
.
hEdit
,
EM_SETSEL
,
GetWindowTextLength
(
Globals
.
hEdit
),
-
1
);
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
lfW
);
SendMessageW
(
Globals
.
hEdit
,
EM_SETSEL
,
GetWindowTextLength
(
Globals
.
hEdit
),
-
1
);
SendMessageW
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
lfW
);
DIALOG_EditTimeDate
();
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
lfW
);
SendMessageW
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
lfW
);
}
SetFileName
(
szFileName
);
...
...
@@ -280,7 +280,7 @@ VOID DIALOG_FileNew(VOID)
/* Close any files and prompt to save changes */
if
(
DoCloseFile
())
{
SetWindowText
(
Globals
.
hEdit
,
empty_strW
);
SendMessage
(
Globals
.
hEdit
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_EMPTYUNDOBUFFER
,
0
,
0
);
SetFocus
(
Globals
.
hEdit
);
}
}
...
...
@@ -618,32 +618,32 @@ VOID DIALOG_FileExit(VOID)
VOID
DIALOG_EditUndo
(
VOID
)
{
SendMessage
(
Globals
.
hEdit
,
EM_UNDO
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_UNDO
,
0
,
0
);
}
VOID
DIALOG_EditCut
(
VOID
)
{
SendMessage
(
Globals
.
hEdit
,
WM_CUT
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
WM_CUT
,
0
,
0
);
}
VOID
DIALOG_EditCopy
(
VOID
)
{
SendMessage
(
Globals
.
hEdit
,
WM_COPY
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
WM_COPY
,
0
,
0
);
}
VOID
DIALOG_EditPaste
(
VOID
)
{
SendMessage
(
Globals
.
hEdit
,
WM_PASTE
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
WM_PASTE
,
0
,
0
);
}
VOID
DIALOG_EditDelete
(
VOID
)
{
SendMessage
(
Globals
.
hEdit
,
WM_CLEAR
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
WM_CLEAR
,
0
,
0
);
}
VOID
DIALOG_EditSelectAll
(
VOID
)
{
SendMessage
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
(
LPARAM
)
-
1
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
-
1
);
}
VOID
DIALOG_EditTimeDate
(
VOID
)
...
...
@@ -655,12 +655,12 @@ VOID DIALOG_EditTimeDate(VOID)
GetLocalTime
(
&
st
);
GetTimeFormat
(
LOCALE_USER_DEFAULT
,
TIME_NOSECONDS
,
&
st
,
NULL
,
szDate
,
MAX_STRING_LEN
);
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
szDate
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
szDate
);
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
spaceW
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
spaceW
);
GetDateFormat
(
LOCALE_USER_DEFAULT
,
0
,
&
st
,
NULL
,
szDate
,
MAX_STRING_LEN
);
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
szDate
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
szDate
);
}
VOID
DIALOG_EditWrap
(
VOID
)
...
...
@@ -681,16 +681,16 @@ VOID DIALOG_EditWrap(VOID)
return
;
}
GetWindowText
(
Globals
.
hEdit
,
pTemp
,
size
);
modify
=
SendMessage
(
Globals
.
hEdit
,
EM_GETMODIFY
,
0
,
0
);
modify
=
SendMessage
W
(
Globals
.
hEdit
,
EM_GETMODIFY
,
0
,
0
);
DestroyWindow
(
Globals
.
hEdit
);
GetClientRect
(
Globals
.
hMainWnd
,
&
rc
);
if
(
Globals
.
bWrapLongLines
)
dwStyle
|=
WS_HSCROLL
|
ES_AUTOHSCROLL
;
Globals
.
hEdit
=
CreateWindowEx
(
WS_EX_CLIENTEDGE
,
editW
,
NULL
,
dwStyle
,
0
,
0
,
rc
.
right
,
rc
.
bottom
,
Globals
.
hMainWnd
,
NULL
,
Globals
.
hInstance
,
NULL
);
SendMessage
(
Globals
.
hEdit
,
WM_SETFONT
,
(
WPARAM
)
Globals
.
hFont
,
(
LPARAM
)
FALSE
);
SendMessage
W
(
Globals
.
hEdit
,
WM_SETFONT
,
(
WPARAM
)
Globals
.
hFont
,
FALSE
);
SetWindowTextW
(
Globals
.
hEdit
,
pTemp
);
SendMessage
(
Globals
.
hEdit
,
EM_SETMODIFY
,
(
WPARAM
)
modify
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETMODIFY
,
modify
,
0
);
SetFocus
(
Globals
.
hEdit
);
HeapFree
(
GetProcessHeap
(),
0
,
pTemp
);
...
...
@@ -716,7 +716,7 @@ VOID DIALOG_SelectFont(VOID)
Globals
.
hFont
=
CreateFontIndirect
(
&
lf
);
Globals
.
lfFont
=
lf
;
SendMessage
(
Globals
.
hEdit
,
WM_SETFONT
,
(
WPARAM
)
Globals
.
hFont
,
(
LPARAM
)
TRUE
);
SendMessage
W
(
Globals
.
hEdit
,
WM_SETFONT
,
(
WPARAM
)
Globals
.
hFont
,
TRUE
);
if
(
currfont
!=
NULL
)
DeleteObject
(
currfont
);
}
...
...
programs/notepad/main.c
View file @
0c702d14
...
...
@@ -343,10 +343,10 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
int
enable
;
EnableMenuItem
(
menu
,
CMD_UNDO
,
SendMessage
(
Globals
.
hEdit
,
EM_CANUNDO
,
0
,
0
)
?
MF_ENABLED
:
MF_GRAYED
);
SendMessage
W
(
Globals
.
hEdit
,
EM_CANUNDO
,
0
,
0
)
?
MF_ENABLED
:
MF_GRAYED
);
EnableMenuItem
(
menu
,
CMD_PASTE
,
IsClipboardFormatAvailable
(
CF_TEXT
)
?
MF_ENABLED
:
MF_GRAYED
);
enable
=
SendMessage
(
Globals
.
hEdit
,
EM_GETSEL
,
0
,
0
);
enable
=
SendMessage
W
(
Globals
.
hEdit
,
EM_GETSEL
,
0
,
0
);
enable
=
(
HIWORD
(
enable
)
==
LOWORD
(
enable
))
?
MF_GRAYED
:
MF_ENABLED
;
EnableMenuItem
(
menu
,
CMD_CUT
,
enable
);
EnableMenuItem
(
menu
,
CMD_COPY
,
enable
);
...
...
@@ -385,7 +385,7 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
SendMessage
(
Globals
.
hEdit
,
EM_GETSEL
,
0
,
(
LPARAM
)
&
pos
);
SendMessage
W
(
Globals
.
hEdit
,
EM_GETSEL
,
0
,
(
LPARAM
)
&
pos
);
switch
(
fr
->
Flags
&
(
FR_DOWN
|
FR_MATCHCASE
))
{
case
0
:
...
...
@@ -412,7 +412,7 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
return
;
}
SendMessage
(
Globals
.
hEdit
,
EM_SETSEL
,
found
-
content
,
found
-
content
+
len
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETSEL
,
found
-
content
,
found
-
content
+
len
);
}
void
NOTEPAD_DoReplace
(
FINDREPLACE
*
fr
)
...
...
@@ -428,16 +428,16 @@ void NOTEPAD_DoReplace(FINDREPLACE *fr)
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
SendMessage
(
Globals
.
hEdit
,
EM_GETSEL
,
(
WPARAM
)
&
pos_start
,
(
LPARAM
)
&
pos
);
SendMessage
W
(
Globals
.
hEdit
,
EM_GETSEL
,
(
WPARAM
)
&
pos_start
,
(
LPARAM
)
&
pos
);
switch
(
fr
->
Flags
&
(
FR_DOWN
|
FR_MATCHCASE
))
{
case
FR_DOWN
:
if
(
pos
-
pos_start
==
len
&&
StrCmpNI
(
fr
->
lpstrFindWhat
,
content
+
pos_start
,
len
)
==
0
)
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
fr
->
lpstrReplaceWith
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
fr
->
lpstrReplaceWith
);
break
;
case
FR_DOWN
|
FR_MATCHCASE
:
if
(
pos
-
pos_start
==
len
&&
StrCmpN
(
fr
->
lpstrFindWhat
,
content
+
pos_start
,
len
)
==
0
)
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
fr
->
lpstrReplaceWith
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
fr
->
lpstrReplaceWith
);
break
;
default:
/* shouldn't happen */
return
;
...
...
@@ -455,14 +455,14 @@ void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
int
fileLen
;
DWORD
pos
;
SendMessage
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
while
(
TRUE
){
fileLen
=
GetWindowTextLength
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
TCHAR
));
if
(
!
content
)
return
;
GetWindowText
(
Globals
.
hEdit
,
content
,
fileLen
);
SendMessage
(
Globals
.
hEdit
,
EM_GETSEL
,
0
,
(
LPARAM
)
&
pos
);
SendMessage
W
(
Globals
.
hEdit
,
EM_GETSEL
,
0
,
(
LPARAM
)
&
pos
);
switch
(
fr
->
Flags
&
(
FR_DOWN
|
FR_MATCHCASE
))
{
case
FR_DOWN
:
...
...
@@ -478,11 +478,11 @@ void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
if
(
found
==
NULL
)
{
SendMessage
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETSEL
,
0
,
0
);
return
;
}
SendMessage
(
Globals
.
hEdit
,
EM_SETSEL
,
found
-
content
,
found
-
content
+
len
);
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
fr
->
lpstrReplaceWith
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETSEL
,
found
-
content
,
found
-
content
+
len
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
fr
->
lpstrReplaceWith
);
}
}
...
...
@@ -535,7 +535,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
NULL
,
Globals
.
hInstance
,
NULL
);
Globals
.
hFont
=
CreateFontIndirect
(
&
Globals
.
lfFont
);
SendMessage
(
Globals
.
hEdit
,
WM_SETFONT
,
(
WPARAM
)
Globals
.
hFont
,
(
LPARAM
)
FALSE
);
SendMessage
W
(
Globals
.
hEdit
,
WM_SETFONT
,
(
WPARAM
)
Globals
.
hFont
,
FALSE
);
break
;
}
...
...
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