Seths.pas by Seth Taylor
Types:
TLongArray: Manages a dynamic array of LongInt's for you
TByteArray: Manages a dynamic array of Byte's for you
TPointerArray: Manages a dynamic array of Pointer's for you
//To see how to manage these arrays look at the code examples
Procedures/Functions:
IIF: Similar to VB function IIF, an If statement in the form of a function
APISetParent: Just the SetParent API declared for you
StringToInt: Converts Strings to LongInt's without errors if the string is invalid
APIGetWindowText: Does all the annoying code for you
SethGetWindowRegion: Creates a window region based off a bitmap you provide, this one is fairly optimized
BufferString, UnBufferString: Usefull for sending data over a socket
Example:
private sub TCPOnRead(Sender: TObject; Socket: TCustomWinSocket);
var
str1, str2: string;
begin
str2 := socket.ReceiveText;
repeat
str1 := UnBufferString(str2).Str;
str2 := UnBufferString(str2).Extra;
DecodedRead( str1, Socket );
until str2 = '';
end;
private sub DecodedRead( strText: string; Socket: TCustomWinSocket);
begin
//Perform actions on recieved data here
//All of these sends can now be debuffered and read in seperate events
Socket.SendText( BufferString( "I got your send once" ) );
Socket.SendText( BufferString( "but" ) );
Socket.SendText( BufferString( "only once" ) );
end; //It's useful to add this code to a component that decends from TClientSocket and TServerSocket
All this code was made by Seth Taylor. Enjoy :-)