标签: fileopendialog

在 HTML 文件打开对话框中过滤文件

我正在使用 HTML 标签将文件上传到服务器:

<input type="file">
Run Code Online (Sandbox Code Playgroud)

当我单击浏览按钮时,它会显示一个文件打开对话框。我可以通过将扩展过滤器传递到该对话框来过滤文件吗?就像我们可以在 .Net 框架的文件打开对话框中传递以下内容:

Text files *.txt|.txt
Run Code Online (Sandbox Code Playgroud)

使用此过滤器我们只能打开.txt文件。其他不向用户显示的文件。这个对话框有选项吗?

html javascript fileopendialog

3
推荐指数
1
解决办法
4139
查看次数

如果由于C++中没有文件关联而导致ShellExecute失败,如何打开窗口的默认对话框?

只要文件具有正确的关联,我就可以使用Windows ShellExecute函数打开一个没有问题的文件.

如果不存在关联,我想使用默认的Windows对话框打开文件:

图片

这可能吗?如果是这样的话?

winapi shellexecute fileopendialog

2
推荐指数
1
解决办法
2105
查看次数

OpenDialog没有出现在Delphi MultiThreaded应用程序中

我试图在新线程中使用openDialog,但它做了如此奇怪的行为..

如果我把if opendialog.execute然后放在create构造函数中,如下所示:

constructor TChatMemberThread.Create(Name: string);
begin
  inherited Create(True);
  FName := Name;
  FreeOnTerminate := True;
  Opendialog := TOpenDialog.create(nil);
  if opendialog.execute then
    for 0 to opendialog.filescount do
      somecodeishere
    end;
end;
Run Code Online (Sandbox Code Playgroud)

opendialog正常打开但是当我把它放在线程的执行生成器中时它根本没有打开!!

我是线程的初学者,所以任何人都可以向我解释发生了什么?

提前致谢 .

[编辑]

unit Unit1;

interface

uses
  Classes,Dialogs,ComCtrls,SysUtils,DCPcrypt2, DCPmd5;

type
  TOpenThread = class(TThread)
  private
    { Private declarations }
    OpenDlG : TOpenDialog;
    LI : TListItem;
    Procedure Openit;
    Function MD5it(Const filename : string ):String;
  protected
    procedure Execute; override;
  Public
    Constructor Create;
    Destructor Destroy;Override;
  end;

implementation
uses Main;

{ TOpenThread }

Constructor …
Run Code Online (Sandbox Code Playgroud)

delphi multithreading delphi-2009 fileopendialog topendialog

2
推荐指数
1
解决办法
1744
查看次数

".RestoreDirectory"不起作用

在下面的代码我设置ofd1.RestoreDirectoryfalse不过,该对话框打开inital目录每次.有什么东西我不知道吗?

private void btnMeshFile_Click(object sender, EventArgs e)
{
    OpenFileDialog ofd1 = new OpenFileDialog();
    ofd1.Title = "Open";
    ofd1.InitialDirectory = @"c:\";
    ofd1.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
    ofd1.FilterIndex = 2;
    ofd1.RestoreDirectory = false;
    if (ofd1.ShowDialog() == DialogResult.OK)
    {
        string fileName = Path.GetFileName(ofd1.FileName);
        MeshDirectoryPath = Path.GetFullPath(ofd1.FileName).Replace(@"\", @"\\");
        txtMeshFile.Text = fileName;
    }
}
Run Code Online (Sandbox Code Playgroud)

c# fileopendialog

2
推荐指数
1
解决办法
2798
查看次数