Ads 468x60px

Smaller time frame always follow the bigger time frame. It's better wait be patience to enter in position than risk with BIG SL. Having strong trading discipline and taking losses when necessary is a sign of serious trading approach
Subscribe:

Labels

Saturday, August 11, 2012

EXPLORE YOUR DOCUMENTS, PROGRAMS AND URLS


If you like how Windows Explorer and File Manager lets you open documents just by double clicking on them, without openning the associated program first, here's how to achieve similar functionality from your Delphi program: 
 
program shellexe;

uses
  WinTypes, ShellAPI;

procedure OpenObject( sObjectPath : string );
begin
  ShellExecute( 0, Nil, PChar( sObjectPath ),
                 Nil, Nil, SW_NORMAL );
end;

begin
  OpenObject( 'c:my_docsreport.txt' );
end.
Listing #1 : Delphi code. Download shellexe (0.3 KB).
 
Now you can open any type of document from your program without knowing which program is associated with it. You can use the same function to open executable programs:
 
OpenObject( 'notepad.exe' );
Listing #2 : Delphi code. Download runexe (0.16 KB).
 
Don't forget that web site addresses and other URLs also have programs associated with them. So, if you want to open the default browser to a specific URL, simply call "OpenObject()" with the absolute URL as follows:
 
OpenObject( 'http://www.chami.com/tips/' );
Listing #3 : Delphi code. Download openurl (0.18 KB).

comments