this function that i found on the Net allow your delphi code to access at environment variables of your Windows systems : function GetEnvVarValue(const VarName: string): string; var BufSize: Integer; // buffer size required for value begin // Get required buffer size (inc. terminal #0) BufSize := GetEnvironmentVariable( PChar(VarName), nil, 0); if BufSize > 0…
Leggi tutto
[lang_it] Immaginate di essere un agente commerciale che necessita di avere sempre con sé il proprio listino aggiornato e, con esso, immagini e schede tecniche dei propri prodotti. Immaginate di essere un magazziniere o un negoziante che ha la necessità di aggiornare l’inventario degli articoli presenti in magazzino, di censire una fornitura di nuovi pezzi…
Leggi tutto
function SendEMail(Handle: THandle; Mail: TStrings): Cardinal; type TAttachAccessArray = array [0..0] of TMapiFileDesc; PAttachAccessArray = ^TAttachAccessArray; var MapiMessage: TMapiMessage; Receip: TMapiRecipDesc; Attachments: PAttachAccessArray; AttachCount: Integer; i1: integer; FileName: string; dwRet: Cardinal; MAPI_Session: Cardinal; WndList: Pointer; begin dwRet := MapiLogon(Handle, PChar(”), PChar(”), MAPI_LOGON_UI or MAPI_NEW_SESSION, 0, @MAPI_Session); if (dwRet SUCCESS_SUCCESS) then begin MessageBox(Handle, PChar(‘Error while trying…
Leggi tutto
Piccolo esempio base, per l’invio di una mail utilizzando la classe Indy TidMessage : documentazione originale : {http://www.dragonsoftru.com/articles/indy-email.html#part_3_4} function TDmMail.SendHtmlMessage(AddrFrom, AddrTo, Subject, Body, AttachFiles: String): Boolean; Var Idm : TIdMessage; TSFiles : TStringList; IdA : TIdAttachment; I : Integer; lTextPart : TIdText; lImagePart : TIdAttachment; begin IdSMTP.Connect(4000); IdSMTP.Username := ‘ivo il tardivo’; Idm := TIdMessage.Create(Self);…
Leggi tutto
Capita di creare applicazioni che fanno un uso intensivo della memoria, per poter calibrare alcuni processi all’interno dell’applicazione potrebbe essere conveniente conoscere l’impegno di memoria di quest’ultima, per fare ciò riporto di seguito un piccolo esempio : Leggere la quantità di memoria occupata dalla ns applicazione da codice {$R *.dfm} uses psAPI; function GetProcessMemorySize(var _nMemSize:…
Leggi tutto
La procedura standard che si occupa di eseguire questo compito è : sp_changeobjectowner Sintassi : sp_changeobjectowner [ @objname = ] ‘object’ , [ @newowner = ] ‘owner’