AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Hostanwendung für gegebenen Dateityp bestimmen
Thema durchsuchen
Ansicht
Themen-Optionen

Hostanwendung für gegebenen Dateityp bestimmen

Ein Thema von ToZie · begonnen am 15. Jun 2008 · letzter Beitrag vom 15. Jun 2008
Antwort Antwort
ToZie

Registriert seit: 17. Feb 2004
43 Beiträge
 
Delphi 10.3 Rio
 
#1

Hostanwendung für gegebenen Dateityp bestimmen

  Alt 15. Jun 2008, 18:11
Huhu,

ich habe das Problem Dateien ohne Endung (aber bekanntem Dateityp - hier TIFF) mit der jeweils für diesen Dateityp konfigurierten Hostanwendung öffnen zu müssen. Leider stehe ich dabei etwas auf dem Schlauch, vielleicht kann mir ja hier jemand rasch weiterhelfen.

Vielen Dank

Torsten
  Mit Zitat antworten Zitat
Benutzerbild von sirius
sirius

Registriert seit: 3. Jan 2007
Ort: Dresden
3.443 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: Hostanwendung für gegebenen Dateityp bestimmen

  Alt 15. Jun 2008, 19:17
Da musst du dir die Specification deiner einzelnen Formate ansehen. Meist sind in den ersten Bytes jeder Datei noch irgendwleche Kennungen hinterlegt. In deinem genannten Fall liegt die Spec bei Adobe. [url=http://partners.adobe.com/public/developer/tiff/index.html]
Zitat:
A TIFF file begins with an 8-byte image file header, containing the following
information:
Bytes 0-1:
The byte order used within the file. Legal values are:
“II” (4949.H)
“MM” (4D4D.H)
In the “II” format, byte order is always from the least significant byte to the most
significant byte, for both 16-bit and 32-bit integers This is called little-endian byte
order. In the “MM” format, byte order is always from most significant to least
significant, for both 16-bit and 32-bit integers. This is called big-endian byte
order.
Bytes 2-3
An arbitrary but carefully chosen number (42) that further identifies the file as a
TIFF file.

The byte order depends on the value of Bytes 0-1.
Bytes 4-7
The offset (in bytes) of the first IFD. The directory may be at any location in the
file after the header but must begin on a word boundary. In particular, an Image
File Directory may follow the image data it describes. Readers must follow the
pointers wherever they may lead.
The term byte offset is always used in this document to refer to a location with
respect to the beginning of the TIFF file. The first byte of the file has an offset of
0.
Also du musst eine 42 an Byte 2-3 finden und vorher in Byte 0 und 1 schauen, ob es Big oder Little Endian ist.
Dieser Beitrag ist für Jugendliche unter 18 Jahren nicht geeignet.
  Mit Zitat antworten Zitat
ToZie

Registriert seit: 17. Feb 2004
43 Beiträge
 
Delphi 10.3 Rio
 
#3

Re: Hostanwendung für gegebenen Dateityp bestimmen

  Alt 15. Jun 2008, 19:37
ich kenne den Dateityp - ich möchte feststellen welche Hostanwendung für ihn konfiguriert ist.
  Mit Zitat antworten Zitat
paritycheck

Registriert seit: 8. Feb 2005
51 Beiträge
 
Delphi 2009 Professional
 
#4

Re: Hostanwendung für gegebenen Dateityp bestimmen

  Alt 15. Jun 2008, 21:05
Könnte damit klappen
Delphi-Quellcode:
function FindExecutableA(lpFile: PChar; lpDirectory: PChar; lpResult: PChar): Cardinal; stdcall; external 'shell32.dllname 'FindExecutableA';

function GetExeFromDocument(const Document: String; const Directory: String): String;
var
  ret: array[0..MAX_PATH-1] of char;
  lpFile,
  lpDirectory: PChar;
begin
  result:= '';
  ZeroMemory(@ret, MAX_PATH);
  lpFile:= PChar(Document);
  lpDirectory:= PChar(Directory);
  if FindExecutableA(lpFile, lpDirectory, @ret[0]) > 32 then
     Result:= ret;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Showmessage(GetExeFromDocument('a.txt', 'D:\Temp'));
end;
  Mit Zitat antworten Zitat
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#5

Re: Hostanwendung für gegebenen Dateityp bestimmen

  Alt 15. Jun 2008, 21:14
*bielefeld*
  Mit Zitat antworten Zitat
ToZie

Registriert seit: 17. Feb 2004
43 Beiträge
 
Delphi 10.3 Rio
 
#6

Re: Hostanwendung für gegebenen Dateityp bestimmen

  Alt 15. Jun 2008, 23:18
Vielen Dank paritycheck, das funktioniert tadellos.

Torsten
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:25 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz