请问各位大虾如何在网页中弹出选择文件保存路径和输入保存文件名的窗体? ( 积分: 100 )

  • 主题发起人 主题发起人 大唐电信
  • 开始时间 开始时间

大唐电信

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位大虾如何在网页中弹出选择文件保存路径和输入保存文件名的窗体?[:(][:(][:(]
谢谢!!!!
 
请问各位大虾如何在网页中弹出选择文件保存路径和输入保存文件名的窗体?[:(][:(][:(]
谢谢!!!!
 
function GetCursorText(allStr: Tstrings): string;
var
mPoint: TPoint;
mText, CName: PChar;
Buf: Integer;
dtwnd: HWND;
str: string;
begin
Buf := 2856;
GetMem(mText, Buf);
GetMem(CName, buf);
try
GetCursorPos(mPoint);
dtwnd := WindowFromPoint(mPoint);
GetClassName(dtwnd, CName, Buf);
str := AnsiUpperCase(strPas(CName));
{ if (str = 'TEDIT')or(str = 'EDIT')or(str = 'COMBOBOX')OR(STR = 'TCOMBOBOX')
OR (str = 'TMEMO')or(str = 'TRICHEDIT')or(str = 'RICHEDIT20W')
OR (STR = '')
then
}
begin
SendMessage(DTWND, WM_GETTEXTLENGTH,0,0);
Buf := LongInt(mText);
SendMessage(DTWND, WM_GETTEXT, 2856, Buf);
// if Pos(StrPas(CName),Allstr.Text)=0 then
//Allstr.Add(StrPas(CName)+#13);
if Trim(StrPas(mText)) <> '' then
if Pos(StrPas(mText), Allstr.Text) = 0 then
Allstr.Add('ClassName: ' + Str + ' [=] Caption: ' + StrPas(MText));
Result := 'ClassName: ' + Str + ' [=] Caption: ' + StrPas(MText);
end;
finally
FreeMem(mText, Buf);
FreeMem(CName, Buf);
end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
GetCursorText(Memo1.Lines)
end;

ClassName: BUTTON [=] Caption: 取消
ClassName: #32770 [=] Caption: 文件下载
ClassName: COMBOBOX [=] Caption: WinRAR 压缩文件
ClassName: #32770 [=] Caption: 另存为
ClassName: COMBOBOX [=] Caption: 桌面
 
老大,你写些啥啊?我需要的是在网页中实现,不是在delphi的代码,但还是谢谢你的热心。请各位大虾帮帮忙。
 
我想用DELPHI做一个OCX控件不就可以了吗!
 
<input type=button value=saveas onclick=document.execCommand(&quot;saveAs&quot;)>
博客园-阿好.NET-IE功能汇总
<INPUT onclick=&quot;document.execCommand('Saveas',false,'c://test.htm')&quot;
type=button
value=另存为>
<INPUT onclick=&quot;document.execCommand('FontName',false,fn)&quot;
type=button
value=字体>
<br>
<INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1> <INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2> <INPUT onclick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性 name=Button3> <INPUT onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印 name=Button> <INPUT onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置 name=Button4> <BR><INPUT onclick=window.location.reload() type=button value=刷新 name=refresh> <INPUT onclick=&quot;window.external.ImportExportFavorites(true,'');&quot;
type=button value=导入收藏夹 name=Button5> <INPUT onclick=&quot;window.external.ImportExportFavorites(false,'');&quot;
type=button value=导出收藏夹 name=Button32> <INPUT onclick=&quot;window.external.AddFavorite(location.href,do
cument.title)&quot;
type=button value=加入收藏夹 name=Button22> <BR><INPUT onclick=&quot;window.external.ShowBrowserUI('OrganizeFavorites', null)&quot;
type=button value=整理收藏夹 name=Submit2> <INPUT onclick='window.location=&quot;view-source:&quot;
+ window.location.href' type=button value=查看源文件 name=Button7> <INPUT onclick=&quot;window.external.ShowBrowserUI('LanguageDialog', null)&quot;
type=button value=语言设置 name=Button6> <INPUT onclick=history.go(1) type=submit value=前进 name=Submit> <INPUT onclick=history.go(-1) type=submit value=后退 name=Submit2> <INPUT onclick=&quot;document.execCommand('Cut')&quot;
type=button value=剪切> <INPUT onclick=&quot;document.execCommand('Copy')&quot;
type=button value=拷贝> <INPUT onclick=&quot;document.execCommand('Paste')&quot;
type=button value=粘贴> <INPUT onclick=&quot;document.execCommand('Undo')&quot;
type=button value=撤消> <INPUT onclick=&quot;document.execCommand('Delete')&quot;
type=button value=删除> <INPUT onclick=&quot;document.execCommand('Bold')&quot;
type=button value=黑体> <INPUT onclick=&quot;document.execCommand('Italic')&quot;
type=button value=斜体> <INPUT onclick=&quot;document.execCommand('Underline')&quot;
type=button value=下划线> <INPUT onclick=&quot;document.execCommand('stop')&quot;
type=button value=停止> <INPUT onclick=&quot;document.execCommand('SaveAs')&quot;
type=button value=保存> <INPUT onclick=&quot;document.execCommand('Saveas',false,'c://test.htm')&quot;
type=button value=另存为> <INPUT onclick=&quot;document.execCommand('FontName',false,fn)&quot;
type=button value=字体> <INPUT onclick=&quot;document.execCommand('FontSize',false,fs)&quot;
type=button value=字体大小> <INPUT onclick=&quot;document.execCommand('refresh',false,0)&quot;
type=button value=刷新> <INPUT onclick=window.location.reload() type=button value=刷新> <INPUT onclick=history.go(1) type=button value=前进> <INPUT onclick=history.go(-1) type=button value=后退> <INPUT onclick=history.forward() type=button value=前进> <INPUT onclick=history.back() type=button value=后退> <INPUT onclick='window.external.ImportExportFavorites(true,&quot;http://localhost&quot;);' type=button value=导入收藏夹> <INPUT onclick='window.external.ImportExportFavorites(false,&quot;http://localhost&quot;);' type=button value=导出收藏夹> <INPUT onclick=&quot;window.external.ShowBrowserUI('OrganizeFavorites', null)&quot;
type=button value=整理收藏夹> <INPUT onclick=&quot;window.location = 'view-source:'+ window.location.href&quot;
type=button value=查看源文件> <INPUT onclick=&quot;window.external.ShowBrowserUI('LanguageDialog', null)&quot;
type=button value=语言设置> <INPUT onclick=&quot;window.external.AddFavorite('http://fason.nease.net/', 'Fason的小天地')&quot;
type=button value=加入收藏夹> <INPUT onclick=&quot;window.external.addChannel('http://fason.nease.net/')&quot;
type=button value=加入到频道> <INPUT onclick=&quot;this.style.behavior='url(#default#homepage)';this.setHomePage('http://fason.nease.net/')&quot;
type=button value=设成主页> </TD></TR></TBODY></TABLE></CENTER></DIV><BR>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;OBJECT id=WebBrowser height=0 width=0&amp;nbsp;<BR>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2&amp;gt;&amp;lt;/OBJECT&amp;gt;<BR>&amp;lt;INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1&amp;gt;
<BR>&amp;lt;INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2&amp;gt;
<BR>&amp;lt;INPUT onclick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性 name=Button3&amp;gt;
<BR>&amp;lt;INPUT onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印 name=Button&amp;gt;
<BR>&amp;lt;INPUT onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置 name=Button4&amp;gt;&amp;nbsp;<BR>&amp;lt;INPUT onclick=window.location.reload() type=button value=刷新 name=refresh&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.ImportExportFavorites(true,'');&quot;
type=button value=导入收藏夹 name=Button5&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.ImportExportFavorites(false,'');&quot;
type=button value=导出收藏夹 name=Button32&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.AddFavorite(location.href,do
cument.title)&quot;
type=button value=加入收藏夹 name=Button22&amp;gt;&amp;nbsp;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;window.external.ShowBrowserUI('OrganizeFavorites', null)&quot;
type=button value=整理收藏夹 name=Submit2&amp;gt;
<BR>&amp;lt;INPUT onclick='window.location=&quot;view-source:&quot;
+ window.location.href' type=button value=查看源文件 name=Button7&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.ShowBrowserUI('LanguageDialog', null)&quot;
type=button value=语言设置 name=Button6&amp;gt;&amp;nbsp;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Cut')&quot;
type=button value=剪切&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Copy')&quot;
type=button value=拷贝&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Paste')&quot;
type=button value=粘贴&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;document.execCommand('Undo')&quot;
type=button value=撤消&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Delete')&quot;
type=button value=删除&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;document.execCommand('Bold')&quot;
type=button value=黑体&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Italic')&quot;
type=button value=斜体&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Underline')&quot;
type=button value=下划线&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('stop')&quot;
type=button value=停止&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('SaveAs')&quot;
type=button value=保存&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=&quot;document.execCommand('Saveas',false,'c://test.htm')&quot;
type=button value=另存为&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;document.execCommand('FontName',false,fn)&quot;
type=button value=字体&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;document.execCommand('FontSize',false,fs)&quot;
type=button value=字体大小&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;document.execCommand('refresh',false,0)&quot;
type=button value=刷新&amp;gt;
<BR>&amp;lt;INPUT onclick=window.location.reload() type=button value=刷新&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=history.go(1) type=button value=前进&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=history.go(-1) type=button value=后退&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=history.forward() type=button value=前进&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick=history.back() type=button value=后退&amp;gt;<BR>&amp;nbsp;&amp;lt;INPUT onclick='window.external.ImportExportFavorites(true,&quot;http://localhost&quot;);' type=button value=导入收藏夹&amp;gt;
<BR>&amp;lt;INPUT onclick='window.external.ImportExportFavorites(false,&quot;http://localhost&quot;);' type=button value=导出收藏夹&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.ShowBrowserUI('OrganizeFavorites', null)&quot;
type=button value=整理收藏夹&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.location = 'view-source:'+ window.location.href&quot;
type=button value=查看源文件&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.ShowBrowserUI('LanguageDialog', null)&quot;
type=button value=语言设置&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.AddFavorite('http://www.cnblogs.com/hbzxf/', 阿好空间)&quot;
type=button value=加入收藏夹&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;window.external.addChannel('http://www.cnblogs.com/hbzxf/')&quot;
type=button value=加入到频道&amp;gt;
<BR>&amp;lt;INPUT onclick=&quot;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.cnblogs.com/hbzxf/')&quot;
type=button value=设成主页&amp;gt;
</div>
 
to jfyes
<input name=&quot;button&quot;
type=button onClick=&quot;document.execCommand('Saveas',false,'c://test.htm')&quot;
value=另存为>
大虾试了你的代码,,好象不对啊。你的代码会直接保存这个网页根据用户选择的保存路径和输入的保存文件名,,,而我只是要求用户选择的保存路径和输入的保存文件名,因为我后面会根据用户输入保存文件。
请各位大虾帮帮忙。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部