Hy,
when you have saved an file into an Blob (or you have saved the file on your HDD) and you will open it, you can use hyperlink. But hyperlink doesn't support all fileextensions and it will only open the regist. application or this fileextension (for exapmle Notepad for *.TXT) but when you need to open the file with an other Application, the user must have (will have) the chance to select the application he will use. For this case you can use "Standard functionality of windows". So i use the "Open with" Dialog. You must not reg. new DLLs!
Here an example: I've save the file into an Blob. Then i've save the Filename an the extension in semerate fields.
Variables:
Name DataType Subtype Length
FileDialog Codeunit Common Dialog Management
Root Text 1024
MSCShell Automation 'Windows Script Host Object Model'.WshShell
Rec.CALCFIELDS(Attachment);
IF Rec.Attachment.HASVALUE THEN BEGIN
Root := Rec."Attachment Description" + Rec."Attachment Extension";
CLEAR(FileDialog);
Root := FileDialog.OpenFile('Dateipfad...',Root,4,Rec."Attachment Extension" + '|*' + Rec."Attachment Extension",1);
IF (STRPOS(Root,':\') <> 0) THEN BEGIN
Rec.Attachment.EXPORT(Root,FALSE);
IF ISCLEAR(MSCShell) THEN
CREATE(MSCShell);
MSCShell.Run('rundll32.exe Shell32,OpenAs_RunDLL ' + Root);
CLEAR(MSCShell);
END;
END;
so, have fun with my codeexapmle.
Regards
Comments
Navision Consultant