Einzelnen Beitrag anzeigen

plautzer

Registriert seit: 23. Aug 2003
172 Beiträge
 
#4

Re: WinCRT32 Fehler?!

  Alt 10. Okt 2006, 15:17
Danke... es hat funktioniert.. jedoch sind jetzt wieder neue Fehlermeldungen hinzugekommen.

Wie machen vorwiegend pascal... da ich aber selber mit delphi arbeite, habe ich delphi 2005 drauf.

Gibt es da generell etwas zu beachten?


Hier ist die Win32Crt die der Prof nutzt... ich habe das mal mit dem alten inhalt, der win32crt.pas ersetzt:

Delphi-Quellcode:
{              A Special version of WinCrt, for use in Win32 only.
                      Copyright 1996-2001 ZieglerSoft

[url]WWW.ZieglerSoft.DK[/url]
[email]ZieglerSoft@ZieglerSoft.DK[/email]

}


Unit Win32Crt;

Interface

Uses SysUtils,Windows,Messages;

Var
  ScreenBuffer : PChar;
  WindowOrg : TPoint = (X: cw_UseDefault; Y: cw_UseDefault);
  WindowSize : TPoint = (X: cw_UseDefault; Y: cw_UseDefault);
  ScreenSize : TPoint = (X: 80; Y: 25);
  Cursor : TPoint = (X: 0; Y: 0);
  Origin : TPoint = (X: 0; Y: 0);
  AutoTracking : Boolean = True;
  CheckEOF : Boolean = False;
  CheckBreak : Boolean = True;
  ShowScroll : Boolean = True;
  ScrollScreen : Boolean = True;
  UseScrollKeys: Boolean = True;
  CanResize : Boolean = True;
  CrtWindow : HWnd = 0;
  WindowTitle : Array[0..79] of Char;
  InAktivTitle : Array[0..79] of Char;
  InactiveTitle: PChar='Inactive program: "%s" ';

Type
  Keyset = Set of Char; {Used to tell what keys we would allow in input
                         This is used by SmartInput / ScreenInput}

Var
  AllKeys : KeySet = [#000..#255]; {Allow all keys in input
                                      used by SmartInput / ScreenInput}

Type
  InputJobs = Record {Used by ScreenInput in an array where we have
                        one of theese records for each line we want to
                         input}

    X : Integer; {Where must the input-string start?}
    Y : Integer;
    X1: Integer; {Where must the 'Prompt' start?}
    Y1: Integer;
    L : Integer; {Length of string we want to edit}
    S : AnsiString; {The string we want to edit}
    P : AnsiString; {The 'prompt'}
    AK: keySet; {Accepted keys in this input. If not set,
                         then all keys can be used}

  End;


Procedure InitWinCrt;
Procedure DoneWinCrt;

Procedure WriteBuf(Buffer: PChar; Count: Word);
Procedure WriteChar(Ch: Char);

Function KeyPressed: Boolean;
Function ReadKey: Char;
Function ReadBuf(Buffer: PChar; Count: Word): Word;

Procedure GotoXY(X, Y: Integer);
Function WhereX: Integer;
Function WhereY: Integer;
Procedure ClrScr;
Procedure ClrEol;
 

Procedure CursorTo(X, Y: Integer);
Procedure ScrollTo(X, Y: Integer);
Procedure TrackCursor;

Procedure AssignCrt(var F: Text);

Procedure Delay(Msec:Word);
  {A delay-function that waits for at least Msec milliseconds}

Procedure TextOutPos(X,Y:Integer;What:String);
  {prints a string on the screen, at position X,Y, without moving the cursorpoint}

Procedure FillScreenChar(X,Y:Integer;Length:Integer;C:Char);
  {Prints a string of C chars, Length length at position X,Y}

Function SmartInput(X,Y:Integer; {Where do we start}
                    Len:Integer; {How long}
                    Var Value:AnsiString; {In- and output}
                    OkKeys : KeySet; {What keys are allowed}
                    TabAdvance:Boolean; {True=tab returns up/down}
                    AutoAdvance:Boolean {True=returns down when len}
                    ):Integer; {0=Enter,-1=esc else key}
  {This function reads a string from the keyboard, but will return
  the key used to exit the procedure, as in a normal ReadKey where
  this is the second char returned (the first was #0) i.e. this is
  the extended char i.e. for PgUp, PgDn, Up and down.
  If TabAdvance is true, then a tab-char will return the same char
  as Down, and Shift+Tab will return the same code as Up.
  If Autoadvance is true, then if the char just entered was the last
  that could fit into the string, then the function returns the same
   code as Down}


Function ScreenInput(Var TheJob:Array of InputJobs):boolean;
  {A function, that can be used to input a complete screen-full of
  information in one go. You make an array of InputJobs, that is
  filled with the wanted information, then calls this function to
  get the data read from the screen.
   If False, then user exited by pressing ESC, else ENTER}




Implementation
Jedoch ist er nicht wirklich damit zufrieden:

Delphi-Quellcode:
[Warning] Win32Crt.pas(13): W1005 Unit 'Borland.Vcl.Windowsis specific to a platform
[Warning] Win32Crt.pas(13): W1005 Unit 'Borland.Vcl.Messagesis specific to a platform
[Error] Win32Crt.pas(16): E2397 Unsafe pointer only allowed if compiling with {$UNSAFECODE ON}
[Warning] Win32Crt.pas(17): W1012 Constant expression violates subrange bounds
[Warning] Win32Crt.pas(17): W1012 Constant expression violates subrange bounds
[Warning] Win32Crt.pas(18): W1012 Constant expression violates subrange bounds
[Warning] Win32Crt.pas(18): W1012 Constant expression violates subrange bounds
[Error] Win32Crt.pas(32): E2397 Unsafe pointer only allowed if compiling with {$UNSAFECODE ON}
[Error] Win32Crt.pas(32): E2010 Incompatible types: 'PWideCharand 'string'
[Warning] Win32Crt.pas(35): W1050 WideChar reduced to byte char in set expressions
[Error] Win32Crt.pas(59): E2410 Unsafe pointer variables, parameters or consts only allowed in unsafe procedure
[Error] Win32Crt.pas(64): E2410 Unsafe pointer variables, parameters or consts only allowed in unsafe procedure
[Error] Win32Crt.pas(97): E2029 Declaration expected but end of file found
[Error] Win32Crt.pas(56): E2065 Unsatisfied forward or external declaration: 'InitWinCrt'
[Error] Win32Crt.pas(57): E2065 Unsatisfied forward or external declaration: 'DoneWinCrt'
[Error] Win32Crt.pas(59): E2065 Unsatisfied forward or external declaration: 'WriteBuf'
[Error] Win32Crt.pas(60): E2065 Unsatisfied forward or external declaration: 'WriteChar'
[Error] Win32Crt.pas(62): E2065 Unsatisfied forward or external declaration: 'KeyPressed'
[Error] Win32Crt.pas(63): E2065 Unsatisfied forward or external declaration: 'ReadKey'
[Error] Win32Crt.pas(64): E2065 Unsatisfied forward or external declaration: 'ReadBuf'
[Error] Win32Crt.pas(66): E2065 Unsatisfied forward or external declaration: 'GotoXY'
[Error] Win32Crt.pas(67): E2065 Unsatisfied forward or external declaration: 'WhereX'
[Error] Win32Crt.pas(68): E2065 Unsatisfied forward or external declaration: 'WhereY'
[Error] Win32Crt.pas(69): E2065 Unsatisfied forward or external declaration: 'ClrScr'
[Error] Win32Crt.pas(70): E2065 Unsatisfied forward or external declaration: 'ClrEol'
[Error] Win32Crt.pas(73): E2065 Unsatisfied forward or external declaration: 'CursorTo'
[Error] Win32Crt.pas(74): E2065 Unsatisfied forward or external declaration: 'ScrollTo'
[Error] Win32Crt.pas(75): E2065 Unsatisfied forward or external declaration: 'TrackCursor'
[Error] Win32Crt.pas(77): E2065 Unsatisfied forward or external declaration: 'AssignCrt'
[Error] Win32Crt.pas(79): E2065 Unsatisfied forward or external declaration: 'Delay'
[Error] Win32Crt.pas(82): E2065 Unsatisfied forward or external declaration: 'TextOutPos'
[Error] Win32Crt.pas(85): E2065 Unsatisfied forward or external declaration: 'FillScreenChar'
[Error] Win32Crt.pas(94): E2065 Unsatisfied forward or external declaration: 'SmartInput'
[Fatal Error] Template.dpr(12): F2063 Could not compile used unit 'Win32Crt.pas'
  Mit Zitat antworten Zitat