Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Jul : IEShowSaveFileDialog - Translation issues
| Subject: | IEShowSaveFileDialog - Translation issues |
| Posted by: | "Christopher Burr" (cbu..@kcc.com) |
| Date: | Wed, 2 Jul 2008 10:30:26 |
Hoping someone can help me out. I can't seem to get the IEShowSaveFileDialog
function to work. It's either an error in my function translation or in the
way I'm calling it.
Here's the original C++ from iepmapi.h
STDAPI IEShowSaveFileDialog(
__in HWND hwnd,
__in LPCWSTR lpwstrInitialFileName,
__in_opt LPCWSTR lpwstrInitialDir,
__in_opt LPCWSTR lpwstrFilter,
__in_opt LPCWSTR lpwstrDefExt,
__in DWORD dwFilterIndex,
__in DWORD dwFlags,
__deref_out LPWSTR *lppwstrDestinationFilePath,
__out HANDLE *phState
);
Here's my translation of it:
function IEShowSaveFileDialog(WinHandle : HWND; strInitialFileName : LPWSTR;
strInitialDir : LPWSTR;
strFilter : LPCWSTR; strDefExt : LPCWSTR; dwFilterIndex : DWORD;
dwFlag : DWORD;
strDestinationFilePath : pointer; var hState : THandle) : HRESULT;
stdcall; external 'ieframe.dll';
And here's the function call I'm using to test it (this is in an ActiveX
control):
procedure showtest;
var
sDestFile : PWideChar;
hState : THandle;
res : HRESULT;
dwSaveFlags : DWORD;
begin
dwSaveFlags := OFN_DONTADDTORECENT or OFN_NOCHANGEDIR;
res := IEShowSaveFileDialog(Self.Handle,'test.txt',nil,'text
files|*.txt','txt',1,dwSaveFlags,sDestFile,hState);
end;
The result (res) is 80070057, which is Invalid Argument.
Thanks for reading,
Chris