delphisvn updated to Subversion 1.5
Good news that the official release now finally includes DLLs on Windows.
There's only source code for now, a downloadable release will follow.
Labels: delphisvn, Subversion
Occasional babble mostly related to CodeGear Delphi
Labels: delphisvn, Subversion
byte[] file;
using (FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) {
file = new byte[fs.Length];
fs.Read (file, 0, file.Length);
fs.Close ();
}
Labels: Authenticode, Mono
SetToString, StringToSet functions in TypInfo unit take PPropInfo as parameter which means you can only use them with set types for which RTTI (a published property) exists.PTypeInfo instead so you can use them with set types in general, even without a published property declared for the type:
uses
SysUtils, TypInfo;
function GetOrdValue(Info: PTypeInfo; const SetParam): Integer;
begin
Result := 0;
case GetTypeData(Info)^.OrdType of
otSByte, otUByte:
Result := Byte(SetParam);
otSWord, otUWord:
Result := Word(SetParam);
otSLong, otULong:
Result := Integer(SetParam);
end;
end;
procedure SetOrdValue(Info: PTypeInfo; var SetParam; Value: Integer);
begin
case GetTypeData(Info)^.OrdType of
otSByte, otUByte:
Byte(SetParam) := Value;
otSWord, otUWord:
Word(SetParam) := Value;
otSLong, otULong:
Integer(SetParam) := Value;
end;
end;
function SetToString(Info: PTypeInfo; const SetParam; Brackets: Boolean): AnsiString;
var
S: TIntegerSet;
TypeInfo: PTypeInfo;
I: Integer;
begin
Result := '';
Integer(S) := GetOrdValue(Info, SetParam);
TypeInfo := GetTypeData(Info)^.CompType^;
for I := 0 to SizeOf(Integer) * 8 - 1 do
if I in S then
begin
if Result <> '' then
Result := Result + ',';
Result := Result + GetEnumName(TypeInfo, I);
end;
if Brackets then
Result := '[' + Result + ']';
end;
procedure StringToSet(Info: PTypeInfo; var SetParam; const Value: AnsiString);
var
P: PAnsiChar;
EnumInfo: PTypeInfo;
EnumName: AnsiString;
EnumValue, SetValue: Longint;
function NextWord(var P: PAnsiChar): AnsiString;
var
I: Integer;
begin
I := 0;
// scan til whitespace
while not (P[I] in [',', ' ', #0,']']) do
Inc(I);
SetString(Result, P, I);
// skip whitespace
while P[I] in [',', ' ',']'] do
Inc(I);
Inc(P, I);
end;
begin
SetOrdValue(Info, SetParam, 0);
if Value = '' then
Exit;
SetValue := 0;
P := PAnsiChar(Value);
// skip leading bracket and whitespace
while P^ in ['[',' '] do
Inc(P);
EnumInfo := GetTypeData(Info)^.CompType^;
EnumName := NextWord(P);
while EnumName <> '' do
begin
EnumValue := GetEnumValue(EnumInfo, EnumName);
if EnumValue < 0 then
begin
SetOrdValue(Info, SetParam, 0);
Exit;
end;
Include(TIntegerSet(SetValue), EnumValue);
EnumName := NextWord(P);
end;
SetOrdValue(Info, SetParam, SetValue);
end;
var
A: TAlignSet;
S: AnsiString;
begin
// set to string
A := [alClient, alLeft, alTop];
S := SetToString(TypeInfo(TAlignSet), A, True);
ShowMessage(Format('%s ($%x)', [S, Byte(A)]));
// string to set
S := '[alNone, alRight, alCustom]';
StringToSet(TypeInfo(TAlignSet), A, S);
ShowMessage(Format('%s ($%x)', [SetToString(TypeInfo(TAlignSet), A, True), Byte(A)]));
end;
const where they're not modified (originally, they were incorrectly declared as var). Thanks, Joe, for your comment!
TCustomProvider.Destroy there's some code which assumes that Owner is still assigned during destruction. This, however, is not the case if the provider is being destroyed implicitly because of ownership.UnregisterProvider since the remote data module (IAppserver implementor which exposes the providers) itself is being destroyed.HKEY_LOCAL_MACHINE.HKEY_CURRENT_USER, copy files into their "My Documents" folder, etc. This means that I cannot simply use manifest to request administrator privileges statically.TSharedMemoryConnection (a memory-mapped file transport) which I've written for the purpose.Labels: DataSnap

TCheckListBox: when themes are not used and you're using the Flat style, horizontal scrolling sometimes causes the checkboxes not to be redrawn properly.TCheckListBox.DrawCheck method. I was unable, so far, to find out the exact cause of the problem.Labels: QC, TCheckListBox, VCL

ATLBASE.H in this directory: $(BDS)\include\atl\

[HKEY_CURRENT_USER\Software\Borland\BDS\4.0\Type Library]
"ActiveXWizard"="True"
"InteropCheck"="True", also mentioned here.