Android smartphone
2010-06-27
Function WNetConnectionDialog() to map drive.
begin
ShowMessage('New connection successfully set.');
end;
Technical review basic map drive
Function GetNetworkDriveMappings(SList:TStrings):Integer;
Var
i:Char;
sPath:String;
dwMaxPathLen:DWord;
Begin
SList.Clear;
dwMaxPathLen:=MAX_PATH;
SetLength(sPath,MAX_PATH);
For I := 'A' to 'Z' Do
If WNetGetConnection( PChar(''+i+':'),PChar(sPath),dwMaxPathLen)=NO_ERROR Then
SList.Add(I+': '+sPath);
Result := SList.Count;
End;
2010-06-17
Scrollbar, hide main form, hide the titlebar, Combobox
2010-06-15
Get all videomodes supported by the system
procedure GetVideoModes(ModeList: TStringList);
{ proc to retrieve a list of acceptable video modes of the current video card. }
{ **********************************************
Usage:
procedure TForm1.FormCreate(Sender: TObject);
var
StrList: TStringList;
begin
StrList := TStringList.Create;
try
GetVideoModes(StrList);
Memo1.Lines := StrList;
finally
StrList.Clear;
StrList.Free;
end;
end;
{************************************************ }
var
i, j: integer;
MoreModes,
AddMode: boolean;
dm: TDeviceMode;
Mode: string;
begin
ModeList.Clear;
MoreModes := True;
Mode := '';
i := 0;
while MoreModes do
begin
MoreModes := EnumDisplaySettings(nil, i, dm);
Mode := IntToStr(dm.dmBitsPerPel) + ' Bits Per Pixel ' +
IntToStr(dm.dmPelsWidth) + ' x ' +
IntToStr(dm.dmPelsHeight);
AddMode := True;
{ Check to make sure this mode is not already in the list. }
for j := 0 to ModeList.Count-1 do
if Mode = ModeList[j] then
AddMode := False;
if AddMode then
ModeList.Add(Mode);
Inc(i);
end;
end;
[/quote]
2010-01-25
detect, which version of ADO is installed ?
Author: Simon Carter
With different versions of MDAC available it is sometimes
useful to know that your application won't fail because a userhasn't got the latest version installed.
The following function returns the ADO version installed,
you need to place ComObj in the uses clause to use this function. }
function GetADOVersion: Double;
var
ADO: Variant;
begin
try
ADO := CreateOLEObject('adodb.connection');
Result := StrToFloat(ADO.Version);
ADO := Null;
except
Result := 0.0;
end;
end;
// To use this function try something like:
procedure TForm1.Button1Click(Sender: TObject);
const
ADOVersionNeeded = 2.5;
begin
if GetADOVersion <>then
ShowMessage('Need to install MDAC version 2.7')
else
ShowMessage(Format('ADO Version %n, is OK', [GetADOVersion]));
end;
make an ADODB Connection using OLE-Automation ?
Author: Daniel Henrique Monteiro de Carvalho (Brasil)
{...}
uses
ComObj;
{...}
function OpenConnection(ConnectionString: AnsiString): integer;
var
ADODBConnection: OleVariant;
begin
ADODBConnection := CreateOleObject('ADODB.Connection');
ADODBConnection.CursorLocation := 3; // User client
ADODBConnection.ConnectionString := ConnectionString;
Result := 0;
try
ADODBConnection.Open;
except
Result := -1;
end;
end;
function DataBaseConnection_Test(bMessage: boolean): AnsiString;
var
asTimeout,
asUserName,
asPassword,
asDataSource,
ConnectionString: AnsiString;
iReturn: Integer;
OldCursor: TCursor;
begin
OldCursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
asTimeout := '150';
asUserName := 'NT_Server';
asPassword := 'SA';
asDataSource := 'SQL Server - My DataBase';
ConnectionString := 'Data Source = ' + asDataSource +
'User ID = ' + asUserName +
'Password = ' + asPassword +
'Mode = Read|Write;Connect Timeout = ' + asTimeout;
try
iReturn := OpenConnection(ConnectionString);
if (bMessage) then
begin
if (iReturn = 0) then
Application.MessageBox('Connection OK!', 'Information', MB_OK)
else if (iReturn = -1) then
Application.MessageBox('Connection Error!', 'Error', MB_ICONERROR
+ MB_OK);
end;
if (iReturn = 0) then
else if (iReturn = -1) then
Result := '';
finally
Screen.Cursor := OldCursor;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DataBaseConnection_Test(true);
end;
check, if the Borland Database Engine (BDE) is installed ?
Author: tom
Uses
Bde;
function BDEInstalled : boolean;
begin
result := (dbiInit(nil) = 0)
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if BDEInstalled then
ShowMessage('BDE is installed.')
else
ShowMessage('BDE is not installed.')
end;