JumpList to all open forms on Delphi

on the OnCreate event of all my forms I add their names to a JumpList

var
  i: Integer;
begin
  if JumpList = nil then
    JumpList := TJumpList.Create(Application);
  JumpList.TaskList.Clear;
  for i := 0 to OpenForms.Count - 1 do
    JumpList.AddTask(OpenForms[i].Caption);
  JumpList.UpdateList;
  JumpList.Enabled := true;
end;

I want to show the form clicked when its called in the jumplist.

I know I'm supposed to read the message Windows sends with the new instance of the application but I can't find any documentation telling what type of message it sends.

Just need to know where I can find the message I want.

thanks

Upvotes: 1

Views: 691

Answers (1)

David Heffernan
David Heffernan

Reputation: 612934

When you call AddTask a TJumpListItem instance is returned. You should set the Arguments property of that instance.

Description

String with the command-line arguments for the executable of your item.

When the user selects your item, Windows calls the executable at Path and passes that executable the content of Arguments as arguments.

Then, when the user clicks on the jump list item, your executable is started and the arguments that you specified are passed to it. You need to read those command line arguments using ParamCount and ParamStr, and respond to them accordingly.

Because specifying arguments is such a critical part of creating a task, the AddTask method has an optional parameter to do so. So you can do it like this.

JumpList.AddTask(YourTasksFriendlyName, '', YourTasksArguments);

Note that the second parameter specifies the Path and passing '' means that you wish the calling executable's path to be used.

Or you can do it like this:

JumpListItem := JumpList.AddTask(YourTasksFriendlyName);
JumpListItem.Arguments := YourTasksArguments;

Upvotes: 3

Related Questions