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
36bf6e1a
Commit
36bf6e1a
authored
Apr 01, 2011
by
David Hedberg
Committed by
Alexandre Julliard
Apr 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Implement GetFileName and SetFileName for the item dialog.
parent
0a524a0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
10 deletions
+74
-10
itemdlg.c
dlls/comdlg32/itemdlg.c
+66
-4
itemdlg.c
dlls/comdlg32/tests/itemdlg.c
+8
-6
No files found.
dlls/comdlg32/itemdlg.c
View file @
36bf6e1a
...
...
@@ -80,9 +80,52 @@ typedef struct FileDialogImpl {
HWND
dlg_hwnd
;
IExplorerBrowser
*
peb
;
DWORD
ebevents_cookie
;
LPWSTR
set_filename
;
}
FileDialogImpl
;
/**************************************************************************
* Helper functions.
*/
static
UINT
get_file_name
(
FileDialogImpl
*
This
,
LPWSTR
*
str
)
{
HWND
hwnd_edit
=
GetDlgItem
(
This
->
dlg_hwnd
,
IDC_FILENAME
);
UINT
len
;
if
(
!
hwnd_edit
)
{
if
(
This
->
set_filename
)
{
len
=
lstrlenW
(
This
->
set_filename
);
*
str
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
len
+
1
));
lstrcpyW
(
*
str
,
This
->
set_filename
);
return
len
;
}
return
FALSE
;
}
len
=
SendMessageW
(
hwnd_edit
,
WM_GETTEXTLENGTH
,
0
,
0
);
*
str
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
len
+
1
));
if
(
!*
str
)
return
FALSE
;
SendMessageW
(
hwnd_edit
,
WM_GETTEXT
,
len
+
1
,
(
LPARAM
)
*
str
);
return
len
;
}
static
BOOL
set_file_name
(
FileDialogImpl
*
This
,
LPCWSTR
str
)
{
HWND
hwnd_edit
=
GetDlgItem
(
This
->
dlg_hwnd
,
IDC_FILENAME
);
if
(
This
->
set_filename
)
LocalFree
(
This
->
set_filename
);
This
->
set_filename
=
StrDupW
(
str
);
return
SendMessageW
(
hwnd_edit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
str
);
}
/**************************************************************************
* Window related functions.
*/
static
SIZE
update_layout
(
FileDialogImpl
*
This
)
...
...
@@ -320,6 +363,10 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam)
else
ShowWindow
(
hitem
,
SW_HIDE
);
if
(
This
->
set_filename
&&
(
hitem
=
GetDlgItem
(
This
->
dlg_hwnd
,
IDC_FILENAME
))
)
SendMessageW
(
hitem
,
WM_SETTEXT
,
0
,
(
LPARAM
)
This
->
set_filename
);
init_explorerbrowser
(
This
);
update_layout
(
This
);
...
...
@@ -533,6 +580,8 @@ static ULONG WINAPI IFileDialog2_fnRelease(IFileDialog2 *iface)
if
(
This
->
psia_selection
)
IShellItemArray_Release
(
This
->
psia_selection
);
if
(
This
->
psia_results
)
IShellItemArray_Release
(
This
->
psia_results
);
LocalFree
(
This
->
set_filename
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -752,15 +801,26 @@ static HRESULT WINAPI IFileDialog2_fnGetCurrentSelection(IFileDialog2 *iface, IS
static
HRESULT
WINAPI
IFileDialog2_fnSetFileName
(
IFileDialog2
*
iface
,
LPCWSTR
pszName
)
{
FileDialogImpl
*
This
=
impl_from_IFileDialog2
(
iface
);
FIXME
(
"stub - %p (%p)
\n
"
,
This
,
pszName
);
return
E_NOTIMPL
;
TRACE
(
"%p (%p)
\n
"
,
iface
,
pszName
);
set_file_name
(
This
,
pszName
);
return
S_OK
;
}
static
HRESULT
WINAPI
IFileDialog2_fnGetFileName
(
IFileDialog2
*
iface
,
LPWSTR
*
pszName
)
{
FileDialogImpl
*
This
=
impl_from_IFileDialog2
(
iface
);
FIXME
(
"stub - %p (%p)
\n
"
,
This
,
pszName
);
return
E_NOTIMPL
;
TRACE
(
"%p (%p)
\n
"
,
iface
,
pszName
);
if
(
!
pszName
)
return
E_INVALIDARG
;
*
pszName
=
NULL
;
if
(
get_file_name
(
This
,
pszName
))
return
S_OK
;
else
return
E_FAIL
;
}
static
HRESULT
WINAPI
IFileDialog2_fnSetTitle
(
IFileDialog2
*
iface
,
LPCWSTR
pszTitle
)
...
...
@@ -1705,6 +1765,8 @@ static HRESULT FileDialog_constructor(IUnknown *pUnkOuter, REFIID riid, void **p
fdimpl
->
dlg_hwnd
=
NULL
;
fdimpl
->
peb
=
NULL
;
fdimpl
->
set_filename
=
NULL
;
/* FIXME: The default folder setting should be restored for the
* application if it was previously set. */
SHGetDesktopFolder
(
&
psf
);
...
...
dlls/comdlg32/tests/itemdlg.c
View file @
36bf6e1a
...
...
@@ -371,8 +371,6 @@ static void test_basics(void)
}
/* GetFileName */
todo_wine
{
hr
=
IFileOpenDialog_GetFileName
(
pfod
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x.
\n
"
,
hr
);
filename
=
(
void
*
)
0xdeadbeef
;
...
...
@@ -385,7 +383,6 @@ static void test_basics(void)
hr
=
IFileSaveDialog_GetFileName
(
pfsd
,
&
filename
);
ok
(
hr
==
E_FAIL
,
"got 0x%08x.
\n
"
,
hr
);
ok
(
filename
==
NULL
,
"got %p
\n
"
,
filename
);
}
/* GetFileTypeIndex */
hr
=
IFileOpenDialog_GetFileTypeIndex
(
pfod
,
NULL
);
...
...
@@ -546,14 +543,16 @@ static void test_basics(void)
}
/* SetFileName */
todo_wine
{
hr
=
IFileOpenDialog_SetFileName
(
pfod
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileName
(
pfod
,
null
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IFileOpenDialog_SetFileName
(
pfod
,
txt
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IFileOpenDialog_GetFileName
(
pfod
,
&
filename
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
filename
,
txt
),
"Strings do not match.
\n
"
);
CoTaskMemFree
(
filename
);
hr
=
IFileSaveDialog_SetFileName
(
pfsd
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
...
...
@@ -561,7 +560,10 @@ static void test_basics(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IFileSaveDialog_SetFileName
(
pfsd
,
txt
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
}
hr
=
IFileSaveDialog_GetFileName
(
pfsd
,
&
filename
);
ok
(
hr
==
S_OK
,
"Got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
filename
,
txt
),
"Strings do not match.
\n
"
);
CoTaskMemFree
(
filename
);
/* SetFileNameLabel */
todo_wine
...
...
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