What are WinTypes, WinProcs and SW_NORMAL?

2019-02-28 12:07发布

问题:

In the program below, whare are WinTypes, WinProcs and what is the purpose of SW_NORMAL?

program ex;
uses Wincrt,WinTypes, WinProcs;
var
  ch:string;

procedure exe (che:string);
begin
  writeln('ecrire ch');
  readln(che);
  if ch ='oui' then
  begin
    WinExec('cmd /k "C:\TPW\exercice\project\site.html"', SW_NORMAL);
  end;
end;

begin
  exe(ch);
end.

The code is in Turbo Pascal 1.5.

回答1:

Wintypes and winprocs are translated Windows 3.x headers that come with windows versions of Turbo Pascal and Delphi 1. In later Delphi versions these are aliased to the more "modern" (as in after 1995) win32 Windows unit.

SW_NORMAL is a parameter to winexec that has info about the window of the generate program.

You can look up Windows functions (even ancient ones like this) in MSDN, and this will give you a link for WinExec which links through to Showwindow for the various windows options and their explanation.

Your program is weird in the sense that it uses win 3.x apis to call a Windows NT+ "cmd.exe".