Code source informatique

Code source pour développer une application, page 40

Depuis plus de 15 ans, le site Fobec.com vous accompagne dans vos developpements informatique. Au fil des années, nous avons construit une solide base de programmation grace à vos codes sources sur les langages Delphi, PHP puis JAVA. Aujourd'hui, les publications s'ouvrent au développement natif sous Android.
Un sujet vous tient à coeur ou un code source à partager ? Le site est ouvert à tous, n'hesitez pas à publier sur Fobec.com

Code source informatique

Différencier les 2 touches enter

procedure TForm1.WMKeyDown( var Message: TWMKeyDown); begin inherited; case Message.CharCode of VK_RETURN: // ENTER pressed if (Message.KeyData and $1000000 0) then // Test bit 24...

publié le 22/11/2001 dans par SwissDelphiCenter

Ouvrir la boite de dialogue formater

procedure TForm1.Button1Click(Sender: TObject); begin ShellExecute(Application.Handle,Pchar('Open'),Pchar('C:WindowsRundll32.exe'),Pchar(' ...

publié le 22/11/2001 dans par SwissDelphiCenter

Faire clignoter l'application dans la barre des tâches

procedure TForm1.Timer1Timer(Sender: TObject); begin if timer1.tag = 0 then begin flashwindow(application.handle, false); timer1.tag := 1; end else begin ...

publié le 22/11/2001 dans par SwissDelphiCenter

Geler l'affichage de l'écran

//GelerLockWindowUpdate(form1.Handle);//ActualiserLockWindowUpdate(0)

publié le 22/11/2001 dans par SwissDelphiCenter

Forcer une fenêtre à passer en premier plan

Windows 98/2000 doesn't want to foreground a window when some other window has the keyboard focus. ForceForegroundWindow is an enhanced SetForeGroundWindow function . function ...

publié le 22/11/2001 dans par SwissDelphiCenter

Savoir lorsque l'utilisateur change de CD

type TForm1 = class(TForm) private procedure WMDeviceChange( var Msg: TMessage); message WM_DEVICECHANGE; public end; {...}implementation{$R *.DFM} procedure ...

publié le 22/11/2001 dans par SwissDelphiCenter

Faire une mise à jour d'un fichier binaire

procedure TForm1.Button1Click(Sender: TObject); var f: file; l: longint; datei, altstring, neustring, s: string; begin altstring := 'Démarrage de Windows 95...'; neustring :=...

publié le 22/11/2001 dans par SwissDelphiCenter

Fixer la taille du fichier

function FIND_FILE_SIZE(sFileToExamine:string;bInKBytes:boolean):string;{for some reason both methods of finding file size returns a filesize that isslightly larger than what Windows File Explorer...

publié le 22/11/2001 dans par SwissDelphiCenter

Vérifier si un fichier peut être ouvert

Function FileCanBeOpened( Const fname: String ): Boolean;Var fhandle: Integer;Begin try fhandle := FileOpen( fname, fmOpenRead or fmShareExclusive ); If fhandle > 0 Then Begin Result := True; ...

publié le 22/11/2001 dans par SwissDelphiCenter

Fixer la date d'un fichier

Function SetFileDateTime(FileName : String; NewDateTime : TDateTime): Boolean; var FileHandle: Integer; FileTime: TFileTime; LFT: TFileTime; LST: TSystemTime; begin Result := False; Try ...

publié le 22/11/2001 dans par SwissDelphiCenter

Vérifier si un fichier existe

procedure TForm1.Button1Click(Sender:TObject); begin if FileExists('c:oot.ini') then begin ShowMessage('le fichier existe !'); end; end;

publié le 22/11/2001 dans par SwissDelphiCenter

Vérifier s'il s'agit d'un fichier Ascii

Function isAscii(NomeFile: String): Boolean; const Sett=2048; var i: Integer; F: file; a: Boolean; TotSize, IncSize, ReadSize: Integer; c: Array[0..Sett] of byte; begin If...

publié le 22/11/2001 dans par SwissDelphiCenter

Afficher un nom de fichier long, par ex. 'c:...pfaddatei.txt'

uses FileCtrl; procedure TForm1.Button1Click(Sender: TObject); begin if Opendialog1.Execute then begin Label1.Caption:=MinimizeName(Opendialog1.FileName, Label1.Canvas,Label1.Width); ...

publié le 22/11/2001 dans par SwissDelphiCenter

Lire la date de modification d'un fichier

function GetMod if yDate(FileName:String):TDateTime; var h: THandle; Struct: TOFSTRUCT; lastwrite: integer; t: TDateTime; begin h:=OpenFile(PChar(FileName), Struct, OF_SHARE_DENY_NONE); try if...

publié le 22/11/2001 dans par SwissDelphiCenter

Convertir un TFileTime en TDateTime

function FileTimeToDateTime(FileTime: TFileTime): TDateTime; var Mod if iedTime: TFileTime; SystemTime: TSystemTime; begin try FileTimeToLocalFileTime(FileTime, Mod if iedTime); ...

publié le 22/11/2001 dans par SwissDelphiCenter

Lancer un programme et attendre qu'il soit chargé

procedure TForm1.Button1Click(Sender: TObject); var StartupInfo: TStartupinfo; ProcessInfo: TProcessInformation; begin FillChar(Startupinfo,Sizeof(TStartupinfo),0); ...

publié le 22/11/2001 dans par SwissDelphiCenter

Programmer un Timer multimédia

uses mmsystem; var fid:Integer; procedure TimeCallBack(TimerID, Msg:Uint; dwUser, dw1, dw2: DWord); pascal; begin //Do something here //This procedure will executed each 10 ms ...

publié le 22/11/2001 dans par SwissDelphiCenter

Enregistrer un StringGrid au format excel

function SaveAsExcelFile(StringGrid: TStringGrid; FileName: string): boolean; const xlWBATWorksheet = -4167; var Row, Col: integer; GridPrevFile: string; XLApp, Sheet: OLEVariant; begin ...

publié le 22/11/2001 dans par SwissDelphiCenter

Piloter Internet Explorer par OLE

uses comobj; procedure OpenIE(aURL: string); var IE : Variant; WinHanlde : HWnd; begin if (VarIsEmpty(IE) ) then begin IE := CreateOleObject('InternetExplorer.Application');...

publié le 22/11/2001 dans par SwissDelphiCenter

Piloter Excel par OLE

uses ComObj; procedure TForm1.Button1Click(Sender: TObject); var excel:Variant; begin try excel:=CreateOleObject('Excel.Application'); except ShowMessage('Excel konnte nicht...

publié le 22/11/2001 dans par SwissDelphiCenter

Menu code source
Résumé de la rubrique
Contenu
1063 articles
Rédaction
52 auteurs
Mise à jour
03/09/2022