ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEnMView mask open any file
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

masrnet2006

Saudi Arabia
59 Posts

Posted - Apr 07 2013 :  00:59:27  Show Profile  Reply
I want show any file in ImageEnMView to open with other
ex.
open file *. autocad with application autocad and file doc with Microsoft Office Word

w2m

USA
1990 Posts

Posted - Apr 07 2013 :  09:01:41  Show Profile  Reply
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
Go to Top of Page

masrnet2006

Saudi Arabia
59 Posts

Posted - Apr 07 2013 :  23:16:16  Show Profile  Reply
#1588;#1603;#1585;#1575; #1580;#1586;#1610;#1604;#1575;
thank you.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: