unit wutils32;
interface
uses Windows;
const
StdMBoxTitle: PChar = nil;
StdMBoxStyle: Word = MB_OK or MB_IconExclamation;
MB_Sound = $0080;
function MBox(WndParent:HWnd; ID:Word; var p):Integer;
function MBox1(WndParent:HWnd; ID:Word; S:PChar):Integer;
function wvsprintf(s,t:PChar; var v):Integer; stdcall;
function wsprintf0(s,t:PChar):Integer; cdecl;
function wsprintf1(s,t,v1:PChar):Integer; cdecl;
function wsprintf2(s,t,v1,v2:PChar):Integer; cdecl;
function wsprintf3(s,t,v1,v2,v3:PChar):Integer; cdecl;
function wsprintf4(s,t,v1,v2,v3,v4:PChar):Integer; cdecl;
function wsprintf5(s,t,v1,v2,v3,v4,v5:PChar):Integer; cdecl;
function wsprintf6(s,t,v1,v2,v3,v4,v5,v6:PChar):Integer; cdecl;
function wsprintf7(s,t,v1,v2,v3,v4,v5,v6,v7:PChar):Integer; cdecl;
function wsprintf8(s,t,v1,v2,v3,v4,v5,v6,v7,v8:PChar):Integer; cdecl;
type
TS255=array[0..255] of Char;
TS127=array[0..127] of Char;
TS63=array[0..63] of Char;
TS31=array[0..31] of Char;
TS15=array[0..15] of Char;
TS7=array[0..7] of Char;
TS3=array[0..3] of Char;
function lstrchr(s:PChar; c:Char):PChar; stdcall;
function min(I1,I2:Integer):Integer; {Integer=LongInt}
function max(I1,I2:Integer):Integer;
implementation
function MBox(WndParent:HWnd; ID:Word; var p):Integer;
var
S,S2: array[0..255]of Char; {2 Puffer; leider so erforderlich}
SPT,SPH: PChar; {Zeiger auf Text und Titel}
I,K: Integer;
TextType:Word;
begin
TextType:=StdMBoxStyle;
I:=LoadString(HInstance,ID,S,sizeof(S)); {I=Anzahl der Zeichen insgesamt}
SPT:=S;
if S[0]='$' then begin
Val(S,TextType,K);
SPT:=S+lStrLen(S)+1;
end;
SPH:=SPT+lStrLen(SPT)+1;
if SPH-S>I then SPH:=StdMBoxTitle;
wvsprintf(S2,SPT,P);
if TextType and MB_Sound <>0 then MessageBeep(TextType and $0070);
MBox:=MessageBox(WndParent,S2,SPH,TextType and not MB_Sound);
end;
function MBox1(WndParent:HWnd; ID:Word; S:PChar):Integer;
begin
MBox1:=MBox(WndParent,ID,S);
end;
function lstrchr; external 'msvcrt.dll' name 'strchr';
function wvsprintf; external 'user32.dll' name 'wvsprintfA';
function wsprintf0; external 'user32.dll' name 'wsprintfA';
function wsprintf1; external 'user32.dll' name 'wsprintfA';
function wsprintf2; external 'user32.dll' name 'wsprintfA';
function wsprintf3; external 'user32.dll' name 'wsprintfA';
function wsprintf4; external 'user32.dll' name 'wsprintfA';
function wsprintf5; external 'user32.dll' name 'wsprintfA';
function wsprintf6; external 'user32.dll' name 'wsprintfA';
function wsprintf7; external 'user32.dll' name 'wsprintfA';
function wsprintf8; external 'user32.dll' name 'wsprintfA';
function min(I1,I2:Integer):Integer;
begin if I1<I2 then Result:=I1 else Result:=I2; end;
function max(I1,I2:Integer):Integer;
begin if I1>I2 then Result:=I1 else Result:=I2; end;
end.
function lstrchr(s:PChar; c:Char):PChar;
begin
repeat
if s^=c then begin Result:=s; exit; end;
if s^=#0 then break;
Inc(s);
until false;
Result:=nil;
end;
function min(I1,I2:Integer):Integer; {Integer=LongInt}
inline($58/$59/$39/$C8/$7C/$01/$91);
{pop eax; pop ecx; cmp eax,ecx; jl $+3; xchg ecx,eax}
function max(I1,I2:Integer):Integer;
inline($58/$59/$39/$C8/$7F/$01/$91);
{pop eax; pop ecx; cmp eax,ecx; jg $+3; xchg ecx,eax}
Detected encoding: ASCII (7 bit) | 2
|