Google
 

Tuesday, April 1, 2008

Are we connected to the Internet ?

procedure TForm1.Button1Click(Sender: TObject) ;



function FuncAvail(_dllname, _funcname: string;

var _p: pointer): boolean;

{return True if _funcname exists in _dllname}

var _lib: tHandle;

begin

Result := false;

if LoadLibrary(PChar(_dllname)) = 0 then exit;

_lib := GetModuleHandle(PChar(_dllname)) ;

if _lib <> 0 then begin

_p := GetProcAddress(_lib, PChar(_funcname)) ;

if _p <> NIL then Result := true;

end;

end;



{

Call SHELL32.DLL for Win < Win98

otherwise call URL.dll

}

{button code:}

var

InetIsOffline : function(dwFlags: DWORD):

BOOL; stdcall;

begin

if FuncAvail('URL.DLL', 'InetIsOffline',

@InetIsOffline) then

if InetIsOffLine(0) = true

then ShowMessage('Not connected')

else ShowMessage('Connected!') ;

end;


Wednesday, February 27, 2008

Listbox With Multiple Columns



Delphi's TListBox control displays a collection of items in a
scrollable list. By design, a listbox displays its items in one column.

If you want to display several items in one row, thus have multiple
columns in a list box you need to set the TabWidth property and add
items to theListBox in a specific way.


begin


___ListBox1.Items.Add('First'^I'Second'^I'Third') ;
___ListBox1.Items.Add('C1R1'^I'C2R1'^I'C3R1') ;
___ListBox1.Items.Add('C1R2'^I'C2R2'^I'C3R2') ;
___ListBox1.Items.Add('C1R3'^I'C2R3'^I'C3R3') ;
___ListBox1.Items.Add('C1R4'^I'C2R4'^I'C3R4') ;
___ListBox1.Items.Add('C1R5'^I'C2R5'^I'C3R5') ;
___ListBox1.Items.Add('C1R6'^I'C2R6'^I'C3R6') ;
___ListBox1.Items.Add('C1R7'^I'C2R7'^I'C3R7') ;
___ListBox1.Items.Add('C1R8'^I'C2R8'^I'C3R8') ;


___ListBox1.Items.Add('C1R9'^I'C2R9'^I'C3R9') ;

end;

Thursday, February 21, 2008

Make an Application window full screen

Set the Borderstyle of your main form to bsNone and then use
SystemParametersInfo message to get the SPI_GETWORKAREA value then use
SetBounds to make your Window the correct size.




~~~~~~~~~~~~~~~~~~~~~~~~~

procedure TSomeForm.FormShow(Sender: TObject) ;

var

r : TRect;

begin

Borderstyle := bsNone;

SystemParametersInfo

(SPI_GETWORKAREA, 0, @r,0) ;

SetBounds

(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top) ;

end;

~~~~~~~~~~~~~~~~~~~~~~~~~