Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
0c702d14
Commit
0c702d14
authored
15 years ago
by
Michael Stefaniuc
Committed by
Alexandre Julliard
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
notepad: Use the explicit SendMessageW form.
parent
df5d82dd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
programs/notepad/dialog.c
+21
-21
21 additions, 21 deletions
programs/notepad/dialog.c
programs/notepad/main.c
+13
-13
13 additions, 13 deletions
programs/notepad/main.c
with
34 additions
and
34 deletions
programs/notepad/dialog.c
+
21
−
21
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
);
SendMessage
W
(
Globals
.
hEdit
,
EM_SETSEL
,
GetWindowTextLength
(
Globals
.
hEdit
),
-
1
);
SendMessage
W
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
lfW
);
DIALOG_EditTimeDate
();
SendMessage
(
Globals
.
hEdit
,
EM_REPLACESEL
,
TRUE
,
(
LPARAM
)
lfW
);
SendMessage
W
(
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
);
}
...
...
This diff is collapsed.
Click to expand it.
programs/notepad/main.c
+
13
−
13
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
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment