Hi all,
I was thinking to create a little application that calls the TTaskdialog. It might seem foolish doing it like this but the objective was to send the command + parameters from another program, then write the output to a file, file back into other program, done.
First test crashes with error:
Failed to create win32 control, error 1407
So it needs a windows something ??
This is my initial setup (I might be totally wrong too about this)
program msgdlg2;
{$mode objfpc}{$H+}
uses
Classes,
SysUtils,
Dialogs,
Interfaces,
Windows,
CustApp,
Messages,
Forms,
Controls,
Graphics;
type
{ TCreateMsgDlgApplication }
TCreateMsgDlgApplication = class(TCustomApplication)
public
procedure Run;
end;
{ TCreateMsgDlgApplication }
procedure TCreateMsgDlgApplication.Run;
var
TaskDialog: TTaskDialog;
Button: TTaskDialogBaseButtonItem;
begin
with TTaskDialog.Create(self) do
try
Title := 'Confirm removal';
Caption := 'Confirm';
Text := 'Remove selected item?';
CommonButtons := [];
with TTaskDialogButtonItem(Buttons.Add) do
begin
Caption := 'Remove';
ModalResult := mrYes;
end;
with TTaskDialogButtonItem(Buttons.Add) do
begin
Caption := 'Keep';
ModalResult := mrNo;
end;
MainIcon := tdiQuestion;
if Execute then
if ModalResult = mrYes then
ShowMessage('Item removed');
finally
Free;
end;
end;
var
AppDlg: TCreateMsgDlgApplication;
begin
AppDlg := TCreateMsgDlgApplication.Create(nil);
AppDlg.Run;
AppDlg.Free;
end.
Do I need to include something else or am I totally going in the wrong direction ?
Project in attached.