Difference between revisions of "program Type/de"
From Free Pascal wiki
Jump to navigationJump to searchm |
m (Fixed syntax highlighting; removed categories included in template) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{program Type}} | {{program Type}} | ||
− | + | ||
− | + | ||
− | Dieser Artikel beschäftigt sich mit der Windowsprogrammierung. | + | Zurück zur Seite [[code examples/de|Code Beispiele]]. |
− | Die Funktion prüft, um welchen Programmtyp es sich handelt. Es hängt u. a. vom Programmtyp ab, ob das Betriebssystem das Programm ausführen kann. | + | |
− | + | ||
− | <syntaxhighlight> | + | Dieser Artikel beschäftigt sich mit der Windowsprogrammierung. |
+ | |||
+ | Die Funktion prüft, um welchen Programmtyp es sich handelt. Es hängt u. a. vom Programmtyp ab, ob das Betriebssystem das Programm ausführen kann. | ||
+ | |||
+ | <syntaxhighlight lang=pascal> | ||
uses | uses | ||
Windows, ...; | Windows, ...; | ||
Line 43: | Line 47: | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | Aufruf der Funktion: | + | Aufruf der Funktion: |
− | <syntaxhighlight> | + | |
+ | <syntaxhighlight lang=pascal> | ||
procedure TForm1.Button1Click(Sender: TObject); | procedure TForm1.Button1Click(Sender: TObject); | ||
begin | begin | ||
Line 57: | Line 62: | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− |
Latest revision as of 10:18, 23 February 2020
│
Deutsch (de) │
Zurück zur Seite Code Beispiele.
Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
Die Funktion prüft, um welchen Programmtyp es sich handelt. Es hängt u. a. vom Programmtyp ab, ob das Betriebssystem das Programm ausführen kann.
uses
Windows, ...;
...
function funGetEXEType(FileName: string): string;
const
SCS_32BIT_BINARY = 0;
SCS_DOS_BINARY = 1;
SCS_WOW_BINARY = 2;
SCS_PIF_BINARY = 3;
SCS_POSIX_BINARY = 4;
SCS_OS216_BINARY = 5;
SCS_64BIT_BINARY = 6;
var
BinaryType: DWORD;
begin
if GetBinaryType(PChar(FileName), Binarytype) then
case BinaryType of
SCS_DOS_BINARY: Result := 'DOS Programm';
SCS_WOW_BINARY: Result := 'Win16 Programm';
SCS_32BIT_BINARY: Result := 'Win32 Programm';
SCS_64BIT_BINARY: Result := 'Win64 Programm';
SCS_PIF_BINARY: Result := 'PIF Datei';
SCS_POSIX_BINARY: Result := 'POSIX Programm (Unix)';
SCS_OS216_BINARY: Result := 'OS/2 16 Bit Programm'
else
Result := 'unbekannter Programmtyp'
end
else
Result := 'Die Datei ist kein Programm';
end;
Aufruf der Funktion:
procedure TForm1.Button1Click(Sender: TObject);
begin
...
Form1.Memo1.Lines.Add(funGetEXEType('c:\windows\notepad.exe'));
...
end;