Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • Twitter
  • facebook
  • reddit
  • email

LMDFileSaveDialog customization?

Hi, Is there any way to add a text box into the subj?
I've tried to follow to some MS instructions, but have got a failure - the text edit box is added, but I can't get its text back, so it's just useless.
I'm doing the next:

In OnExecute:
procedure TFMain.SD1Execute(Sender: TObject);
var
  c : IFileDialogCustomize;
  r : HResult;
  pc : PChar;
begin
  if Supports(SD1.Dialog, IFileDialogCustomize, c) then
  begin
    c.StartVisualGroup(SVDLG_GRP, 'Комментарий');
    c.AddEditBox(SVDLG_CMT, 'some text');
    c.EndVisualGroup;
  end;
end;

In OnFileOK:

procedure TFMain.SD1FileOkClick(Sender: TObject; var CanClose: Boolean);
var
  c  : IFileDialogCustomize;
  pc : PChar;
  r  : HRESULT;
begin
  if Supports(SD1.Dialog, IFileDialogCustomize, c) then
  begin
    pc := nil;
    r := c.GetEditBoxText(SVDLG_CMT, pc);  <<<<< nil is returned here, though r = S_OK
    if (r = S_OK) and Assigned(pc) then
    begin
      SvDlgComment := pc;
      CoTaskMemFree(pc);
    end;
  end;
end;

I'm using Win 7 x64 with Delphi XE7

Is there a solution?
Thanks

Comments

  • 2 Comments sorted by Votes Date Added
  • I've tried standard VCL control (TFileSaveDialog from Vista Dialogs pane) and it worked OK. Then I've just copypasted the interface declaration from ShlObj.pas unit to your intfLMDFileDialog.pas and.. it works!

    Obviously you have an incorrect interface declaration.

    What it would be really great, is to find some hack to enlarge the edit control horizontally, but this is yet unrelated question.
  • Thanks for report. I'll fix interface declaration.
Sign In or Register to comment.