home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Mother of All Windows Books
/
CD-MOM.iso
/
cd_mom
/
newsletr
/
vbz
/
vbz1-3
/
dll_src.exe
/
VBZUTIL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-02-25
|
4KB
|
171 lines
library VBZUTIL;
{VBZ Utility Library by Jonathan Zuck}
{Version 1.0}
{$R VBZUTIL}
Uses WinProcs, WinTypes, VBAPI, CDKUTIL;
Var
Buff: array [0..40] of Byte;
Buff2: array [0..40] of Byte;
function CtlName (hctl:HCTL):HLSTR;export;
Begin
VBGetControlName (hctl, @Buff);
CtlName := VBCreateTempHlstr (@Buff,
lstrlen (PChar (@Buff)));
end;
procedure GetCtlArrMinMax (Ctl:HCTL; var Min:Integer; var Max:Integer);
Var
StdPropIndex, i:Integer;
CtlTemp:HCTL;
Begin
VBGetControlName (Ctl, @Buff);
StdPropIndex := GetStdPropIndex(Ctl, IPROP_STD_INDEX);
VBGetControlProperty (Ctl, StdPropIndex, @i);
Min := i;
Max := i;
CtlTemp := VBGetControl (Ctl, GC_FIRSTCONTROL);
while CtlTemp <> Nil do
begin
VBGetControlName (CtlTemp, @Buff2);
if lstrcmp (@Buff, @Buff2) = 0 then
begin
VBGetControlProperty (CtlTemp, StdPropIndex, @i);
if i < Min then Min := i;
if i > Max then Max := i;
end;
CtlTemp := VBGetControl (CtlTemp, GC_NEXTCONTROL);
end;
end;
function CtlLBound (Ctl:HCTL):Integer;export;
Var
Min, Max:Integer;
Begin
GetCtlArrMinMax (Ctl, Min, Max);
CtlLBound := Min;
end;
function CtlUBound (Ctl:HCTL):Integer;export;
Var
Min, Max:Integer;
Begin
GetCtlArrMinMax (Ctl, Min, Max);
CtlUBound := Max;
end;
function Str2Ctl (Ctl:HCTL;MyString:PChar):Integer;export;
Var
Max:Integer;
CtlTemp:HCTL;
Begin
Max := 0;
CtlTemp := VBGetControl (Ctl, GC_FIRSTCONTROL);
while CtlTemp <> Nil do
begin
VBGetControlName (CtlTemp, @Buff2);
if lstrcmp (MyString, @Buff2) = 0 then begin
Str2Ctl := Max - 1;
Exit;
end;
Inc (Max);
CtlTemp := VBGetControl (CtlTemp, GC_NEXTCONTROL);
end;
Str2Ctl := -1;
end;
function HWnd2Ctl (MyWnd:HWND):Integer;export;
Var
Max:Integer;
CtlTemp, MyCtl:HCTL;
Begin
Max := 0;
HWnd2Ctl := -1;
MyCtl := VBGetHWndControl (MyWnd);
if MyCtl = nil then Exit;
CtlTemp := VBGetControl (MyCtl, GC_FIRSTCONTROL);
while CtlTemp <> Nil do
begin
if CtlTemp = MyCtl then begin
HWnd2Ctl := Max - 1;
Exit;
end;
Inc (Max);
CtlTemp := VBGetControl (CtlTemp, GC_NEXTCONTROL);
end;
end;
function GetHInstance:Integer;export;
begin
GetHInstance := VBGetHInstance;
end;
function HIWORD (Hi, Lo:Integer):Integer;export;
Begin
HIWORD := Hi;
end;
function LOWORD (Hi, Lo:Integer):Integer;export;
Begin
LOWORD := Lo;
end;
function MakeLong(A, B: Word): LongInt;export;
begin
inline(
$5A/ { POP DX }
$58); { POP AX }
end;
function LP2Str (pb:Pointer; cbLen:Integer):HLSTR;export;
Begin
LP2Str := VBCreateTempHlStr (pb, cblen);
end;
function LPSTR2Str (pb:PChar):HLSTR;export;
Begin
LPSTR2Str := VBCreateTempHlStr (pb, lstrlen(pb));
end;
procedure ReCreateControlhWnd (Ctl:HCTL);export;
var
Temp:LongInt;
pModel:LPMODEL;
begin
pModel := VBGetControlModel (Ctl);
Temp := pModel^.flWndStyle;
pModel^.flWndStyle := GetWindowLong (VBGetControlHwnd(Ctl), GWL_STYLE);
VBRecreateControlHwnd (Ctl);
pModel := VBGetControlModel (Ctl);
pModel^.flWndStyle := Temp;
end;
function USHORT (VBInt:WORD):LongInt;export;
begin
USHORT := VBInt;
end;
Exports
CtlName resident,
CtlLBound resident,
CtlUBound resident,
Str2Ctl resident,
HWnd2Ctl resident,
GetHInstance resident,
HiWord resident,
LoWord resident,
MakeLong resident,
LP2Str resident,
LPSTR2Str resident,
ReCreateControlhWnd resident,
UShort resident;
Begin
End.