milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. Delphi

Components

Details
Written by: Stanko Milosev
Category: Delphi
Published: 08 April 2009
Last Updated: 30 November -0001
Hits: 4877

If you are having problems after you installed components, like:

File not found *.dcu, or *.pas, try adding path to Tools->Options->Library - Win32 -> Library path

MAPI

Details
Written by: Stanko Milosev
Category: Delphi
Published: 07 April 2009
Last Updated: 18 July 2011
Hits: 6205

Now, little bit about MAPI.

According to wikipedia MAPI is designed to be independent of the protocol, it is usually used with MAPI/RPC, the proprietary protocol that Microsoft Outlook uses to communicate with Microsoft Exchange. So, I read this like MAPI is a protocol.

To use MAPI you will need MS Outlook MS Exchange or MS Exchange client, which you can download from here, installed on machine.

There are two kind of MAPI, simple MAPI and extended MAPI.

According to Microsoft most of functions of simple MAPI are deprecated, so I focus here on extended MAPI.

Again, according to Microsoft exended MAPI can be difficult to learn.

For Delphi you can use Easier Extended MAPI, like it is described here, but that was also too difficult to learn, too much time I will need, so I found RapWare Easy MAPI components, which completely satisfy me.I don't think that I need to write too much about them, since they have very good examples about everything.

Maps

Details
Written by: Stanko Milosev
Category: Delphi
Published: 12 March 2009
Last Updated: 30 November -0001
Hits: 5038
Maps, small example of using different maps. Exe you can download from here, source from here.

Code snippet

Details
Written by: Stanko Milosev
Category: Delphi
Published: 13 February 2009
Last Updated: 18 July 2011
Hits: 6256

One note to my self, this is piece of code which I was using for starting application from command prompt and getting an information, was that succesfull or not.

function CaptureConsoleOutput(DosApp : string; var strLog : String): Boolean;
const
  ReadBuffer = 1048576;  // 1 MB Buffer
var
  Security: TSecurityAttributes;
  ReadPipe,WritePipe: THandle;
  start: TStartUpInfo;
  ProcessInfo: TProcessInformation;
  Buffer: Pchar;
  TotalBytesRead,
  BytesRead: DWORD;
  Apprunning,n,
  BytesLeftThisMessage,
  TotalBytesAvail : integer;
  xCode: Cardinal;
  bolOk: Boolean;
begin
  bolOk := False;

  with Security do
  begin
    nlength := SizeOf(TSecurityAttributes);
    binherithandle := true;
    lpsecuritydescriptor := nil;
  end;

  if CreatePipe (ReadPipe, WritePipe, @Security, 0) then
  begin
  // Redirect In- and Output through STARTUPINFO structure

  Buffer := AllocMem(ReadBuffer + 1);
  FillChar(Start,Sizeof(Start),#0);
  start.cb := SizeOf(start);
  start.hStdOutput := WritePipe;
  start.hStdInput := ReadPipe;
  start.dwFlags := STARTF_USESTDHANDLES + STARTF_USESHOWWINDOW;
  start.wShowWindow := SW_HIDE;
  start.hStdError := WritePipe;

  // Create a Console Child Process with redirected input and output

  if CreateProcess(nil, PChar(DosApp),
  @Security,@Security,
true, CREATE_NO_WINDOW or NORMAL_PRIORITY_CLASS,
nil, nil,
  start, ProcessInfo) then
  begin
  n:=0;
  TotalBytesRead:=0;
  repeat
  // Increase counter to prevent an endless loop if the process is dead
  Inc(n,1);

  // wait for end of child process
  Apprunning := WaitForSingleObject(ProcessInfo.hProcess,100);
  Application.ProcessMessages;

  // it is important to read from time to time the output information
  // so that the pipe is not blocked by an overflow. New information
  // can be written from the console app to the pipe only if there is
  // enough buffer space.

  if not PeekNamedPipe(ReadPipe  ,@Buffer[TotalBytesRead],
  ReadBuffer, @BytesRead,
 @TotalBytesAvail,@BytesLeftThisMessage) then break
  else if BytesRead > 0 then
  ReadFile(ReadPipe,Buffer[TotalBytesRead],BytesRead,BytesRead,nil);
  TotalBytesRead:=TotalBytesRead+BytesRead;
  until (Apprunning <> WAIT_TIMEOUT) or (n > 150);
  GetExitCodeProcess(ProcessInfo.hProcess,xCode);
  if xCode=0 then
  bolOk := True
  else
  bolOk := False;

  Buffer[TotalBytesRead]:= #0;
  OemToChar(Buffer,Buffer);
  strLog := strLog + StrPas(Buffer);
  end;
  FreeMem(Buffer);

  CloseHandle(ProcessInfo.hProcess);
  CloseHandle(ProcessInfo.hThread);
  CloseHandle(ReadPipe);
  CloseHandle(WritePipe);
  Result := bolOk;
  end;
end;

  1. CnPack
  2. Skype
  3. How to check if Application is waiting for user modal answer
  4. Human readable XML

Subcategories

dbExpress

Web

Delphi

MSMQ

Oracle

Page 7 of 11

  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11