Sign in Join
Wiki copytemporary

program Type/de: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: program Type/de

OldNewLine
1+Zurück zur Seite [[code examples/de|Code Beispiele]].
2+
3+Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
4+
5+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.
6+
7+``` pascal
8+uses
9+ Windows, ...;
10+
11+ ...
12+
13+function funGetEXEType(FileName: string): string;
14+const
15+ SCS_32BIT_BINARY = 0;
16+ SCS_DOS_BINARY = 1;
17+ SCS_WOW_BINARY = 2;
18+ SCS_PIF_BINARY = 3;
19+ SCS_POSIX_BINARY = 4;
20+ SCS_OS216_BINARY = 5;
21+ SCS_64BIT_BINARY = 6;
22+
23+var
24+ BinaryType: DWORD;
25+
26+begin
27+
28+ if GetBinaryType(PChar(FileName), Binarytype) then
29+ case BinaryType of
30+ SCS_DOS_BINARY: Result := 'DOS Programm';
31+ SCS_WOW_BINARY: Result := 'Win16 Programm';
32+ SCS_32BIT_BINARY: Result := 'Win32 Programm';
33+ SCS_64BIT_BINARY: Result := 'Win64 Programm';
34+ SCS_PIF_BINARY: Result := 'PIF Datei';
35+ SCS_POSIX_BINARY: Result := 'POSIX Programm (Unix)';
36+ SCS_OS216_BINARY: Result := 'OS/2 16 Bit Programm'
37+ else
38+ Result := 'unbekannter Programmtyp'
39+ end
40+ else
41+ Result := 'Die Datei ist kein Programm';
42+
43+end;
44+```
45+
46+Aufruf der Funktion:
47+
48+``` pascal
49+procedure TForm1.Button1Click(Sender: TObject);
50+begin
51+
52+ ...
53+
54+ Form1.Memo1.Lines.Add(funGetEXEType('c:\windows\notepad.exe'));
55+
56+ ...
57+
58+end;
59+```
60+
61+---
62+*From the Free Pascal wiki, page "program Type/de", as it stood on 2020-02-23 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history