Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Aufruf einer PDF Datei


Best Answer Spitfyr , 08 March 2016 - 15:27

Habe es gefunden:

mit

nvReturn = SHELL32.FindExecutableA( psPDFFile, psPath, psReader);
geht es nun!

Go to the full post


3 replies to this topic

Spitfyr

Spitfyr
  • Full Members
  • 162 posts

Posted 03 March 2016 - 15:16

Hallo,

ich möchte aus dem Setup heraus (entweder per Script oder CA) direkt eine PDF Datei anzeigen.

 

Das habe ich bisher nur geschafft, wenn ich vorher mühsam den Pfad auf einen PDF Reader ermittle und diesen

z.B. wie folgt aufrufe:

LaunchAppAndWait("C:\Programm\adobe\adobe.exe", "C:\test\info.pdf",NOWAIT); //Aufruf aus dem Script heraus.

Per CustomActction (CA)  muss ich das dann auch so ähnlich machen.

 

Da es aber diverse PDF-Reader gibt ist das Ermitteln des aktuellen Reader sehr umständlich und unter Windows 10

wird eine PDF vom Browser EDGE angezeigt. Man benötigt gar keinen Reader mehr.

 

 

Gibt es nun eine Möglichkeit das man "einfach die PDF Datei aufrufen kann (shellExecute etc.) und man sich um nichts weiter kümmern muss?

 

Dieser Aufruf z.B. schlägt bei mir fehl: LaunchAppAndWait("C:\test\info.pdf", "",NOWAIT);

 

Grüße

  Spitfyr

 



ANo

ANo
  • Full Members
  • 179 posts

Posted 08 March 2016 - 12:19

Hallo Spitfyr,

für die Ermittlung des HTML-Brwosers benutzen wir etwa folgendes.

 

Vielleicht hilft das weiter - für PDFs.

Grüße

André

 

// Load shell32.DLL into memory.
GEN_LoadDLL( "Shell32.DLL", nRefCountDLL );

 

// Find the application associated with html file.

psHTMFile = &sHTMFile;
sPath = "";
psPath = &sPath;
nResult = Shell32.FindExecutableW(psHTMFile, psPath, sBrowser);
if (nResult > 32) then
  sMsg  = "   Find browser: " + sBrowser;
  LOG_SysEnv( hInstall, sMsg );
else
  sBrowser = "";
  sMsg  = "   Could not find browser!";
  LOG_SysEnv( hInstall, sMsg );
endif;

GEN_Set_Property(hInstall, "POL_BROWSER", sBrowser);

 

// Removes the Shell32.dll from memory.
GEN_UnloadDLL( "Shell32.DLL", nRefCountDLL );



Spitfyr

Spitfyr
  • Full Members
  • 162 posts

Posted 08 March 2016 - 15:23

Hallo André,

nach so einer Funktion habe ich gesucht.

Leider liefert die Funktion als Return-Wert immer eine 2 (The specified file was not found, https://msdn.microso...9(v=vs.85).aspx )

 

Ich rufe die Funktion wie folgt auf:

 

//  POINTER psPDFFile, psPath, psReader;
//  STRING  sPDFFile, sPath, sReader ;

 

sPDFFile = "D:\\km\\1.pdf";
psPDFFile = &sPDFFile;

if (FindFile("d:\\km","1.pdf",szTmp) = 0 ) then
  MessageBox("Gefunden: " + "d:\\km" ^ "1.pdf",INFORMATION);  //Prüfung ob die Datei auf vom Installer gefunden wird.
endif;

sReader = " ";

//Initialiserung mit MAX_PATH

for iCount = 0 to MAX_PATH
  sReader = sReader + " ";
endfor;
psReader = &sReader;

sPath = "";
psPath =  &sPath;

nvReturn = SHELL32.FindExecutableW( psPDFFile, psPath, psReader);

SprintfBox(SEVERE,"FindExecute","return: \"%d\"\n\"%s\"\n\"%s\"",nvReturn,psPDFFile,psReader);
***ENDE

 

Ein Aufruf mit sReader (wie bei dir) klappt nicht, weil die Funktion eine NUMBER erwartet

Was übergebt ihr denn als sHTMFile?

 

viele Grüße

Dietmar



Spitfyr

Spitfyr
  • Full Members
  • 162 posts

Posted 08 March 2016 - 15:27   Best Answer

Habe es gefunden:

mit

nvReturn = SHELL32.FindExecutableA( psPDFFile, psPath, psReader);
geht es nun!