Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
f3425cfe
Commit
f3425cfe
authored
Feb 10, 2007
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wordpad: Open .wri files in wordpad.
parent
17cb1c82
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
2 deletions
+121
-2
wordpad.c
programs/wordpad/wordpad.c
+118
-2
wine.inf
tools/wine.inf
+3
-0
No files found.
programs/wordpad/wordpad.c
View file @
f3425cfe
...
...
@@ -41,7 +41,8 @@ static const WCHAR wszRichEditClass[] = {'R','I','C','H','E','D','I','T','2','0'
static
const
WCHAR
wszMainWndClass
[]
=
{
'W'
,
'O'
,
'R'
,
'D'
,
'P'
,
'A'
,
'D'
,
'T'
,
'O'
,
'P'
,
0
};
static
const
WCHAR
wszAppTitle
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'W'
,
'o'
,
'r'
,
'd'
,
'p'
,
'a'
,
'd'
,
0
};
static
HWND
hMainWnd
=
NULL
;
static
HWND
hMainWnd
;
static
HWND
hEditorWnd
;
static
void
AddButton
(
HWND
hwndToolBar
,
int
nImage
,
int
nCommand
)
{
...
...
@@ -71,9 +72,122 @@ static void AddSeparator(HWND hwndToolBar)
SendMessage
(
hwndToolBar
,
TB_ADDBUTTONS
,
1
,
(
LPARAM
)
&
button
);
}
static
LPSTR
stream_buffer
;
static
LONG
stream_buffer_size
;
static
DWORD
CALLBACK
stream_in
(
DWORD_PTR
cookie
,
LPBYTE
buffer
,
LONG
cb
,
LONG
*
pcb
)
{
LONG
size
=
min
(
stream_buffer_size
,
cb
);
memcpy
(
buffer
,
stream_buffer
,
size
);
stream_buffer_size
-=
size
;
stream_buffer
+=
size
;
*
pcb
=
size
;
return
0
;
}
static
void
DoOpenFile
(
LPCWSTR
szFileName
)
{
HANDLE
hFile
;
LPSTR
pTemp
;
DWORD
size
;
DWORD
dwNumRead
;
EDITSTREAM
es
;
hFile
=
CreateFileW
(
szFileName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
;
size
=
GetFileSize
(
hFile
,
NULL
);
if
(
size
==
INVALID_FILE_SIZE
)
{
CloseHandle
(
hFile
);
return
;
}
size
++
;
pTemp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
pTemp
)
{
CloseHandle
(
hFile
);
return
;
}
if
(
!
ReadFile
(
hFile
,
pTemp
,
size
,
&
dwNumRead
,
NULL
))
{
CloseHandle
(
hFile
);
HeapFree
(
GetProcessHeap
(),
0
,
pTemp
);
return
;
}
CloseHandle
(
hFile
);
pTemp
[
dwNumRead
]
=
0
;
memset
(
&
es
,
0
,
sizeof
(
es
));
es
.
pfnCallback
=
stream_in
;
stream_buffer
=
pTemp
;
stream_buffer_size
=
size
;
SendMessage
(
hEditorWnd
,
EM_STREAMIN
,
SF_RTF
,
(
LPARAM
)
&
es
);
HeapFree
(
GetProcessHeap
(),
0
,
pTemp
);
SetFocus
(
hEditorWnd
);
}
static
void
HandleCommandLine
(
LPWSTR
cmdline
)
{
WCHAR
delimiter
;
int
opt_print
=
0
;
/* skip white space */
while
(
*
cmdline
==
' '
)
cmdline
++
;
/* skip executable name */
delimiter
=
(
*
cmdline
==
'"'
?
'"'
:
' '
);
if
(
*
cmdline
==
delimiter
)
cmdline
++
;
while
(
*
cmdline
&&
*
cmdline
!=
delimiter
)
cmdline
++
;
if
(
*
cmdline
==
delimiter
)
cmdline
++
;
while
(
*
cmdline
==
' '
||
*
cmdline
==
'-'
||
*
cmdline
==
'/'
)
{
WCHAR
option
;
if
(
*
cmdline
++
==
' '
)
continue
;
option
=
*
cmdline
;
if
(
option
)
cmdline
++
;
while
(
*
cmdline
==
' '
)
cmdline
++
;
switch
(
option
)
{
case
'p'
:
case
'P'
:
opt_print
=
1
;
break
;
}
}
if
(
*
cmdline
)
{
/* file name is passed on the command line */
if
(
cmdline
[
0
]
==
'"'
)
{
cmdline
++
;
cmdline
[
lstrlenW
(
cmdline
)
-
1
]
=
0
;
}
DoOpenFile
(
cmdline
);
InvalidateRect
(
hMainWnd
,
NULL
,
FALSE
);
}
if
(
opt_print
)
MessageBox
(
hMainWnd
,
"Printing not implemented"
,
"WordPad"
,
MB_OK
);
}
static
LRESULT
OnCreate
(
HWND
hWnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HWND
h
EditorWnd
,
h
ToolBarWnd
,
hReBarWnd
;
HWND
hToolBarWnd
,
hReBarWnd
;
HINSTANCE
hInstance
=
(
HINSTANCE
)
GetWindowLongPtr
(
hWnd
,
GWLP_HINSTANCE
);
HANDLE
hDLL
;
TBADDBITMAP
ab
;
...
...
@@ -500,6 +614,8 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPSTR szCmdPar
CW_USEDEFAULT
,
CW_USEDEFAULT
,
680
,
260
,
NULL
,
NULL
,
hInstance
,
NULL
);
ShowWindow
(
hMainWnd
,
SW_SHOWMAXIMIZED
);
HandleCommandLine
(
GetCommandLineW
());
while
(
GetMessage
(
&
msg
,
0
,
0
,
0
))
{
if
(
TranslateAccelerator
(
hMainWnd
,
hAccel
,
&
msg
))
...
...
tools/wine.inf
View file @
f3425cfe
...
...
@@ -99,6 +99,7 @@ HKCR,.msi,,2,"Msi.Package"
HKCR,.tif,"Content Type",2,"image/tiff"
HKCR,.tiff,"Content Type",2,"image/tiff"
HKCR,.txt,,2,"txtfile"
HKCR,.wri,,2,"wrifile"
HKCR,.wav,"Content Type",2,"audio/wav"
HKCR,.xml,"Content Type",2,"text/xml"
HKCR,.xsl,"Content Type",2,"text/xsl"
...
...
@@ -123,6 +124,8 @@ HKCR,Msi.Package\shell\Repair\command,,2,"msiexec /f %1"
HKCR,Msi.Package\shell\Uninstall\command,,2,"msiexec /x %1"
HKCR,txtfile\shell\open\command,,2,"%11%\notepad.exe %1"
HKCR,txtfile\shell\print\command,,2,"%11%\notepad.exe /p %1"
HKCR,wrifile\shell\open\command,,2,"%11%\wordpad.exe %1"
HKCR,wrifile\shell\print\command,,2,"%11%\wordpad.exe /p %1"
HKCR,http\shell\open\command,,2,"winebrowser"
HKCR,https\shell\open\command,,2,"winebrowser"
HKCR,mailto\shell\open\command,,2,"winebrowser %1"
...
...
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