Rev 19 | Rev 24 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 19 | Rev 20 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | type |
31 | type |
32 | TGetModuleFileNameExFunc = function (inProcess: THandle; inModule: THandle; Filename: PWideChar; size: DWord): DWord; stdcall; |
32 | TGetModuleFileNameExFunc = function (inProcess: THandle; inModule: THandle; Filename: PWideChar; size: DWord): DWord; stdcall; |
33 | var |
33 | var |
34 | funcGetModuleFileNameEx: TGetModuleFileNameExFunc; |
34 | funcGetModuleFileNameEx: TGetModuleFileNameExFunc; |
35 | begin |
35 | begin |
36 | if psAPIHandle <> 0 then |
36 | if hPsApiDll <> 0 then |
37 | begin |
37 | begin |
38 | @funcGetModuleFileNameEx := GetProcAddress(psAPIHandle, 'GetModuleFileNameExW'); |
38 | @funcGetModuleFileNameEx := GetProcAddress(hPsApiDll, 'GetModuleFileNameExW'); |
39 | if Assigned(funcGetModuleFileNameEx) then |
39 | if Assigned(funcGetModuleFileNameEx) then |
40 | result := funcGetModuleFileNameEx(inProcess, inModule, Filename, size) |
40 | result := funcGetModuleFileNameEx(inProcess, inModule, Filename, size) |
41 | else |
41 | else |
42 | result := -1; |
42 | result := -1; |
43 | end |
43 | end |
Line 70... | Line 70... | ||
70 | var |
70 | var |
71 | Title: array[0..255] of Char; |
71 | Title: array[0..255] of Char; |
72 | const |
72 | const |
73 | TargetWinWidth = 640; |
73 | TargetWinWidth = 640; |
74 | TargetWinHeight = 480; |
74 | TargetWinHeight = 480; |
- | 75 | resourcestring |
|
- | 76 | AyDosTitle = 'Aysalia DOS'; |
|
- | 77 | AyDos1Title = 'Aysalia DOS I'; |
|
- | 78 | AyDos2Title = 'Aysalia DOS II'; |
|
75 | begin |
79 | begin |
76 | ZeroMemory(@Title, sizeof(Title)); |
80 | ZeroMemory(@Title, sizeof(Title)); |
77 | GetWindowText(hWnd, @Title, sizeof(Title)-1); |
81 | GetWindowText(hWnd, @Title, sizeof(Title)-1); |
78 | 82 | ||
79 | // Center window (once) |
83 | // Center window (once) |
Line 87... | Line 91... | ||
87 | bCeneredOnce := true; |
91 | bCeneredOnce := true; |
88 | end; |
92 | end; |
89 | 93 | ||
90 | // Change window title |
94 | // Change window title |
91 | if Pos('AYDOS1', Title) > 0 then |
95 | if Pos('AYDOS1', Title) > 0 then |
92 | SetWindowText(hWnd, 'Aysalia DOS I') |
96 | SetWindowText(hWnd, PChar(AyDos1Title)) |
93 | else if Pos('AYDOS2', Title) > 0 then |
97 | else if Pos('AYDOS2', Title) > 0 then |
94 | SetWindowText(hWnd, 'Aysalia DOS II') |
98 | SetWindowText(hWnd, PChar(AyDos2Title)) |
95 | else |
99 | else |
96 | SetWindowText(hWnd, 'Aysalia DOS'); |
100 | SetWindowText(hWnd, PChar(AyDosTitle)); |
97 | 101 | ||
98 | // Change window and taskbar icon |
102 | // Change window and taskbar icon |
99 | if hIcon > 0 then |
103 | if hIcon > 0 then |
100 | begin |
104 | begin |
101 | // Change both icons to the same icon handle. |
105 | // Change both icons to the same icon handle. |
Line 149... | Line 153... | ||
149 | end; |
153 | end; |
150 | end; |
154 | end; |
151 | end; |
155 | end; |
152 | 156 | ||
153 | function ShellExecuteWait(hWnd: HWND; Operation, FileName, Parameters, |
157 | function ShellExecuteWait(hWnd: HWND; Operation, FileName, Parameters, |
154 | Directory: PAnsiChar; ShowCmd: Integer): DWord; |
158 | Directory: PChar; ShowCmd: Integer): DWord; |
155 | var |
159 | var |
156 | Info: TShellExecuteInfo; |
160 | Info: TShellExecuteInfo; |
157 | pInfo: PShellExecuteInfo; |
161 | pInfo: PShellExecuteInfo; |
158 | begin |
162 | begin |
159 | pInfo := @Info; |
163 | pInfo := @Info; |
Line 182... | Line 186... | ||
182 | sFile: string; |
186 | sFile: string; |
183 | begin |
187 | begin |
184 | ShellExecuteWait(0, 'open', DOSBOX_EXE, '-noconsole -conf DOSBox.conf', |
188 | ShellExecuteWait(0, 'open', DOSBOX_EXE, '-noconsole -conf DOSBox.conf', |
185 | PChar(ExtractFilePath(ParamStr(0))), SW_NORMAL); |
189 | PChar(ExtractFilePath(ParamStr(0))), SW_NORMAL); |
186 | 190 | ||
187 | sFile := IncludeTrailingBackSlash(ExtractFilePath(ParamStr(0))) + 'stdout.txt'; |
191 | sFile := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))) + 'stdout.txt'; |
188 | if FileExists(sFile) then DeleteFile(PChar(sFile)); |
192 | if FileExists(sFile) then DeleteFile(PChar(sFile)); |
189 | 193 | ||
190 | sFile := IncludeTrailingBackSlash(ExtractFilePath(ParamStr(0))) + 'stderr.txt'; |
194 | sFile := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))) + 'stderr.txt'; |
191 | if FileExists(sFile) then DeleteFile(PChar(sFile)); |
195 | if FileExists(sFile) then DeleteFile(PChar(sFile)); |
192 | 196 | ||
193 | result := 0; |
197 | result := 0; |
194 | end; |
198 | end; |
195 | 199 |