Archive for the ‘Delphi’ Category

delphi et VISTA…

pour ceux qui s’arrachent les cheveux: solution simple: DESACTIVER UAC
Points concernés: Impossible d’ecrire dans les repertoires: win, sys, program files (!), c:\
impossible d’ecrire dans la base de regsitre en LOCAL MACHINE
[xml]

       
               
                       
               
       
       

               
                       
                               
                       
               
       

[/xml]
        
 
enregistrez sous administrator.manifest
Creér ”administrator.rc” qui contient
1 24 “administrator.manifest”
(1 = numero de resource, 24 = type [...]

delphi stay on top, TOUJOURS !

begin 
  SetWindowPos(Handle, HWND_TOPMOST, Left, Top, Width, Height,
    SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
  //  Desktop
  SetWindowLong(Handle, GWL_HWNDPARENT, 0);
  // fenetre 
  SetWindowLong(Handle, GWL_EXSTYLE,
    GetWindowLong(Handle, GWL_EXSTYLE) or
    WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
end;

delphi extraction nom du fichier sans extension

Voici la commande pour extraire le nom du fichier sans extension
filename := ChangeFileExt(ExtractFileName(’PathFileNameHere’),”);
ex: c:\windows\system.ini ->system

Inno setup INF driver installation

 [Run]
 Filename: “{win}\rundll.exe”;
   Parameters: “setupx.dll,InstallHinfSection DefaultInstall 132
MYFILE.INF”
That won’t work on Windows NT/2000 (rundll.exe doesn’t exist). But this
should:
[Run]
Filename: “{win}\rundll.exe”; Parameters: “setupx.dll,InstallHinfSection
DefaultInstall 132 MYFILE.INF”; MinVersion: 1, 0
Filename: “{sys}\rundll32.exe”; Parameters: “setupapi,InstallHinfSection
DefaultInstall 132 MYFILE.INF”; MinVersion: 0, 1

INNO SETUP events

 http://www.vincenzo.net/isxkb/index.php?title=Test_events_example
voir aussi: http://www.vincenzo.net/isxkb/index.php?title=Special:Allpages
 
 
 
 

JPEG smooth resize with Graphics32

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,JPEG, StdCtrls,   ExtCtrls, GR32, GR32_Image, GR32_Transforms, GR32_Resamplers, GR32_System;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    function RescalePic(aFileName,destinationFile: String;x,y:integer): TBitmap;
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.RescalePic(aFileName,destinationFile: String;x,y:integer): TBitmap;
Var
  R: TKernelResampler;
  ASrcImage: TBitMap32;
  ADstImage: TBitMap32;
  ABmp: TBitMap;
  [...]

DSA (do not show again) dialog box with delphi

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,JvDSADialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;
const
  ctkMyMark: TDSACheckTextKind = 25;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
RegisterDSA(0, ‘Confirm2′, ‘MessageDlg confirmation’, DSARegStore, ctkAsk);
if DSAMessageDlg(
    0,
    ‘Simple confirmation box, standard title2, [...]

demarrage programme comme service DOS/DELPHI

Tout d’abord il faut telecharger les deux fichiers suivant : srvany.exe et instsrv.exe
http://www.inscripta.net/ressources/articles/smus/installation/installSmusAsNTService_vf.htm

Ensutie copiez-les dans le répertoire C:\windows\system32
instsrv Mon_Service srvany.exe
Dans le gestionnaire de services, vous verrez alors apparaître une nouvelle entrée du nom de Mon_Service.

Exécuter regedit

Développez l’arborescence HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mon_service\Parameters et ajoutez la valeur STRING
“Application” : chemin jusqu’à l’exécutable
Il ne reste plus qu’à lancer le service soit [...]