If you mean associate an image displayed in ImageENMView with a document then this will open the document on a double click.
You have to store the filename of the document somewhere, so for this example the document filename is stored in ImageTopText.
function ExecAssociatedApp(const FileName: string): Boolean;
// Executes the application associated with the given file name. Returns true if
// application is started successfully and false if not
begin
Result := ShellAPI.ShellExecute(0, nil, PChar(FileName), nil, nil, Windows.SW_SHOW) > 32;
end;
procedure TMainForm.Open1Click(Sender: TObject);
var
iFilename: string;
begin
iFilename := ImageEnMView1.MIO.ExecuteOpenDialog('','',false,0,'');
if iFilename <> '' then
begin
Caption := iFilename;
ImageEnMView1.MIO.LoadFromFile(Caption);
ImageEnMView1.SelectedImage:=0;
// Store the path to the associated document here
ImageEnMView1.ImageTopText[ImageEnMView1.SelectedImage].Caption := 'C:\Users\Bill\Documents\Example.doc;
ImageEnMView1ImageSelect(self, 0);
end;
end;
procedure TMainForm.ImageEnMView1DblClick(Sender: TObject);
var
iFilename: string;
begin
// This will open the image in the associated application
//iFilename := ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].FileName;
// This will open the associated document
iFilename := ImageEnMView1.ImageTopText[ImageEnMView1.SelectedImage].Caption;
if not ExecAssociatedApp(iFilename) then
ShowMessage('Unable to execute ' + iFilename);
end;
William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html