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

FormatMesage

Details
Written by: Stanko Milosev
Category: Delphi
Published: 29 September 2009
Last Updated: 18 December 2011
Hits: 5347

Using:

FormatMessage(Format_Message_Allocate_Buffer + Format_Message_From_System, nil, dwResult, 0, @pstrError, 0, nil);

Taken from here.

Regional settings.

Details
Written by: Stanko Milosev
Category: Delphi
Published: 03 August 2009
Last Updated: 18 December 2011
Hits: 5406

If you want to change regional settings for your application (not globaly for Windows), you can use this code:

 

function MakeLCID( lgID: Word; srtid: Word ): DWORD;
begin
Result := MakeLong( lgid, srtid );
end;

function MakeLangID( p, s: Word ): Word;
begin
Result := (s shl 10) or p
end;

procedure TForm3.btn1Click(Sender: TObject);
begin
Win32Check( SetThreadLocale(
MakeLCID(
MakeLangID( LANG_ENGLISH, SUBLANG_ENGLISH_US), 0)));
GetFormatSettings;
Application.UpdateFormatSettings := false;
ShowMessage(FormatDateTime('ddd, dd mmm yyyy hh:nn:ss +0200', Now));
end;

Taken from here.

CreateProcess - fail

Details
Written by: Stanko Milosev
Category: Delphi
Published: 29 July 2009
Last Updated: 18 December 2011
Hits: 5094

If CreateProcess doesn't work:

 

 

if CreateProcess ... then 
  ...
else //it doesn't work
  strLog := SysErrorMessage(GetLastError ); //information why it doesn't work

RSS

Details
Written by: Stanko Milosev
Category: Delphi
Published: 03 July 2009
Last Updated: 18 December 2011
Hits: 5499

To create RSS XML file, with OmniXML, you can use following code:

uses rrRss, OmniXML, SysUtils, Windows, OmniXMLProperties;

...

var
rss: TRSS;

...

rss := TRSS.Create;
rss.XMLDoc.PreserveWhiteSpace := False; //for XML to be "human readable"
rss.Version := '2.0'; //RSS version


//adding channel
rss.Add;
rss.Channel[0].Title := 'channel name';
rss.Channel[0].Link := 'link';
rss.Channel[0].Description := 'description';

...

//adding RSS feed
rss.Channel[0].Items.Add;
//it depends of RSS reader will consider this property
rss.Channel[0].Items[0].Guid.Value := 'guid';
rss.Channel[0].Items[0].Title := 'title';
//link where will be full article
rss.Channel[0].Items[0].Link := 'http://www.rsslink.com';
//content of RSS which will be shown in RSS reader
rss.Channel[0].Items[0].Description := 'description';
rss.Channel[0].Items[0].Category := 'test';
//date of publish
rss.Channel[0].Items[0].PubDate := 'ned, 05 jul 2009 17:00:23 +0200';
//because of FireFox, without this in FF don't want to work
rss.Channel[0].Items[intItemCount].Enclosure.Url := 'http://www.milosev.com';
//ofIndent also needed for XML to be "human readable"
if not rss.SaveToFile(strFileName, ofIndent) then
raise Exception.Create(rss.LastError);

RSS specification can be found here. pubDate must follow RFC822 specification.

Code taken from OmniXML\demo\properties.

If you need in RSS description to put line break, or something similiar, try CDATA, for example:

<description><![CDATA[ <p>There once was a man from nantucket<br> Who kept all his fish in a bucket</p> ]]></description>

If link is same in RSS then it is possible that some RSS readers will show RSS feed as read (not unread), because, idea of RSS is to get small part of log (news) you need, and then to go on a link to see all news.

Taken from here.

  1. Creating and modifying component templates
  2. Delphi 2007 IDE like Delphi 7
  3. Log in
  4. Reintroduce

Subcategories

C#

Azure

ASP.NET

JavaScript

Software Development Philosophy

MS SQL

IBM WebSphere MQ

MySQL

Joomla

Delphi

PHP

Windows

Life

Lazarus

Downloads

Android

CSS

Chrome

HTML

Linux

Eclipse

Page 94 of 164

  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98