Repository navigation
Expand file tree
/
Copy pathTectfp32.dpr
More file actions
160 lines (155 loc) · 5.51 KB
/
Copy pathTectfp32.dpr
File metadata and controls
160 lines (155 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
program TectFP32;
uses
Forms,
SysUtils,
Windows,
Dialogs,
IniFiles,
Messages,
Clipbrd,
Titlepic in 'Titlepic.pas' {Titpfm},
Angle in 'Angle.pas' {ThetaDialog},
bt_draw in 'bt_draw.pas' {btdraw},
Convert in 'Convert.pas' {ConvDlg1},
Edit in 'Edit.pas' {EditForm},
Draw in 'Draw.pas',
Tecmain in 'Tecmain.pas' {TecMainWin},
Fileops in 'fileops.pas',
Printdia in 'printdia.pas' {PrintDial},
Rosedlg in 'rosedlg.pas' {RoseDial},
Types in 'types.pas',
Exprtdia in 'Exprtdia.pas' {ExportForm},
ContDlg in 'ContDlg.pas' {ContDlgFrm},
Virtdip in 'Virtdip.pas' {VirtDipFrm},
Edit2 in 'Edit2.pas' {Edit2Frm},
LowHem in 'LowHem.pas' {LHWin},
Angtst in 'Angtst.pas',
Piplt in 'Piplt.pas',
Contour in 'Contour.pas',
Ptplot in 'Ptplot.pas',
Sigma in 'sigma.pas',
Fish in 'Fish.pas',
Bingha in 'bingha.pas',
Sortman in 'Sortman.pas' {SortManual},
rotate in 'rotate.pas' {RotForm},
About in 'About.pas' {AboutBox},
Settings in 'Settings.pas' {SetForm},
rose in 'rose.pas',
Inspect in 'Inspect.pas' {InspectorForm},
Options in 'Options.pas' {OptionDialog},
results in 'results.pas' {Resinsp},
FileType in 'FileType.pas' {FileTypeDlg},
Invers in 'Invers.pas',
NDA in 'Nda.pas',
MD5 in 'MD5.pas';
{$R tfp175.RES}
{$R *.RES}
{$H+}
var
CurrentTime: LongInt;
firstrun: boolean;
memory : TMEMORYSTATUS;
os : TOSVERSIONINFO;
systeminfo : TSystemInfo;
dw1,dw2,dw3,dw4: dword;
Username, strDummy: string;
TotPhysMem, TotPhysMem2,Processor,SectperClust,BytesperClust,TotNumofClust, WinPlatform: Integer;
s : string[255];
c : array[0..255] of byte absolute s;
i : Integer;
dummy: string;
f: Textfile;
keydummy: HKey;
bufsize: Integer;
puffer: PChar;
FirstTFPThread, fred, datatype: dword;
TestString: String;
begin
//******Startup handler begin*****************
TFPOpenMessage:=RegisterWindowMessage('WM_TFPOPENFILE');
HTFPMutex:=CreateMutex(nil, True, 'TectFP_1.5');
IF GetLastError= ERROR_ALREADY_EXISTS then
begin
HTFPMutex:=0;
if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar('SOFTWARE\GeoCompute\TectonicsFP\'+TFPRegEntryVersion),
0, KEY_READ, keydummy)=ERROR_SUCCESS then
begin
FirstTFPThread:=0;
RegQueryValueEx(Keydummy, 'FirstThreadId', nil, nil, nil, @BufSize); //get buffer size
RegQueryValueEx(Keydummy, 'FirstThreadId', nil, nil, PByte(@FirstTFPThread), @BufSize); //Retrieve first thread id from windows registry
Fred:=0;
RegQueryValueEx(Keydummy, 'TFPThreads', nil, @datatype, PByte(@Fred), @BufSize); //increment thread counter
inc(Fred);
RegCloseKey(KeyDummy);
end;
if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar('SOFTWARE\GeoCompute\TectonicsFP\'+TFPRegEntryVersion),
0, KEY_SET_VALUE, keydummy)=ERROR_SUCCESS then
begin
RegSetValueEx(Keydummy, 'TFPThreads', 0, REG_DWORD, @Fred, SizeOf(DWord)); //Set tfp thread counter to 1
RegFlushKey(KeyDummy);
RegCloseKey(KeyDummy);
end;
dummy:='';
if (FirstTFPThread<>0) and (TFPOpenMessage<>0) and (ParamCount>0) then //if a TectonicsFP-thread already exists then send data to this if paramstr not empty
begin
for i:=1 to ParamCount do
if ParamStr(i)<>'' then dummy:=dummy+ParamStr(i)+'*';
//application.messagebox(PChar(Dummy) , 'TectonicsFP', mb_ok);
if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar('SOFTWARE\GeoCompute\TectonicsFP\'+TFPRegEntryVersion),
0, KEY_SET_VALUE, keydummy)=ERROR_SUCCESS then
begin
RegSetValueEx(Keydummy, 'OpenFile', 0, REG_SZ, PChar(dummy), Length(dummy));
RegFlushKey(KeyDummy);
RegCloseKey(KeyDummy);
PostThreadMessage(FirstTFPThread, TFPOpenMessage, i-1, 0); //send open command to first TectonicsFP thread
If GetLastError<> ERROR_INVALID_THREAD_ID then Exit;
end;
end;
end //this is the first program running
else
if RegOpenKeyEx(HKEY_LOCAL_MACHINE, PChar('SOFTWARE\GeoCompute\TectonicsFP\'+TFPRegEntryVersion),
0, KEY_SET_VALUE, keydummy)=ERROR_SUCCESS then
begin
Fred:=GetCurrentThreadID;
RegSetValueEx(Keydummy, 'FirstThreadId', 0, REG_DWORD, @Fred, SizeOf(DWord)); //write thread id to registry
Fred:=1;
RegSetValueEx(Keydummy, 'TFPThreads', 0, REG_DWORD, @Fred, SizeOf(DWord)); //Set tfp thread counter to 1
RegFlushKey(KeyDummy);
RegCloseKey(KeyDummy);
end;
//*****startup handler end******************
Titpfm:=TTitpfm.Create(Application);
With Titpfm do
begin
TitleLabel.Caption:= capTitle+' '+offVer;
lblLicense.Caption:= capLicense;
Update;
Show;
end;
TFPVersion:=Copy(TFPSerialNumber,0,4);
TFPVersion:=Capver;
CurrentTime := GetTickCount div 1000;
TitPfm.Update;
//************************************************************************
Dummy:=TFPVersion;
Delete(Dummy, 8, 3);
Dummy:=Dummy+'STU';
Application.Initialize;
Application.Title := 'TectonicsFP';
Application.HelpFile := 'Tectfp32.hlp';
Application.CreateForm(TTecMainWin, TecMainWin);
TecMainWin.Caption:=CapTitle+' '+offVer;
CurrentTime:=CurrentTime + 2;
while ( (GetTickCount div 1000) < (CurrentTime) ) do
begin { nothing }
end;
i:=0;
Repeat
inc(i);
If ParamStr(i)<>'' then TecMainWin.CallMDIChild(Application, ParamStr(i));
until ParamStr(i)='';
Titpfm.Hide;
Titpfm.Free;
TecMainWin.Bringtofront;
Application.Run;
end.