The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,300 other followers

Archive for the ‘Delphi’ Category

How Can I Determine Which Version of Word is Installed on a Computer? – Hey, Scripting Guy! Blog – Site Home – TechNet Blogs

Posted by Jeroen Pluimers on 2014/07/24

Late binding sometimes is your friend:

Set objWord = CreateObject("Word.Application")
Wscript.Echo "Version: " & objWord.Version
Wscript.Echo "Build: " & objWord.Build
objWord.Quit

The accompanying Delphi code:

uses
  System.Win.ComObj;

procedure TTestVersionAgnosticWordMainForm.GetWordApplicationInfoButtonClick(Sender: TObject);
var
  WordApplication: OleVariant;
  Version: OleVariant;
  Build: OleVariant;
begin
  WordApplication := CreateOleObject('Word.Application');
  try
    try
      Version := WordApplication.Version;
      Build := WordApplication.Build;
      LogMemo.Lines.Add(Version);
      LogMemo.Lines.Add(Build);
    finally
      WordApplication.Quit;
    end;
  finally
    WordApplication := Unassigned; // release it
  end;
end;

–jeroen

via: How Can I Determine Which Version of Word is Installed on a Computer? – Hey, Scripting Guy! Blog – Site Home – TechNet Blogs.

Posted in Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Scripting, Software Development, VBScript | 10 Comments »

Delphi syntax for TODO list (via: How set up todo list categories in Delphi 2010 – Stack Overflow)

Posted by Jeroen Pluimers on 2014/07/23

A while ago, some of the TODO comments in my source code disappeared from the TODO list.

I wondered why, so I found this question: How set up todo list categories in Delphi 2010?.

The Delphi TODO item syntax in source code comments is like this (thanks Nelson H C Nepomuceno):

{ TODO 1 -cImportant :Do this!}
// TODO 1 -cImportant: Do this!

My comment there, after I found out I had done a stupid global search replace involving colons:

The important thing is the colon somewhere after the TODO. If you do not have the colon, then the TODO list will not show the comment. Anything after the colon will be the action item in the TODO list.

–jeroen

via: How set up todo list categories in Delphi 2010 – Stack Overflow.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Software Development | Leave a Comment »

The StackOverflow Pascal/DelphiSyntax Highlighter

Posted by Jeroen Pluimers on 2014/07/22

Found out where the StackOverflow Pascal has its origins: What happened to comments in syntax highlighter? – Meta Stack Overflow.

Like any syntax highlighter, it is not perfect (only a Delphi compiler driven highlighter would have a chance to be perfect), but it does a pretty good job and gets better over time.

–jeroen

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, FreePascal, Pascal, Software Development, Turbo Pascal | Leave a Comment »

Drawing fully justified text to a canvas (via: Parnassus OÜ – Delphi Consulting & Plugins – parnassus.co)

Posted by Jeroen Pluimers on 2014/07/19

Though fully justified text is most often in print, and not much in user interfaces any more, this might come in useful one day (it is based on the GDI functions TextOut and SetTextJustification):

David Millington Posted: Have you ever wanted to draw fully justified text ie, text that adheres to both the left and right sides of the destination rectangle? It’s more complicated than it seems, and there’s definitely no inbuilt support in the VCL. But here’s how to do it, including an open-source unit you can drop into your applications and use.

Drawing fully justified text to a canvas | Parnassus – Delphi Consulting & Plugins.

–jeroen

via:

Posted in Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Development, Software Development | Leave a Comment »

(Old style Pascal objects): Could you please remind me if Objects support polymorphism? For instance, I…

Posted by Jeroen Pluimers on 2014/07/17

I observe an increase of people not asking questions on Stack Overflow any more…

Today, two interesting questions caught my eye.

The first one was by Martijn Coppoolse about Is it possible to figure out whether a type’s property has a ‘stored’ flag or not, preferably without having to create an instance of that type? (note: emphasis is mine)

Then the most interesting one (note this is about old Turbo Pascal style object syntax that is still available in Delphi, yes polymorphism with the object keyword): Could you please remind me if Objects support polymorphism? by Roman Yankovsky.

–jeroen

PS: Martijn posted the solution he used:

So I tried looking at the StoredProc pointer, and I can differentiate between three states:
  1. nil, which means stored False;
  2. Pointer(1), which means that no stored flag was specified;
  3. an actual pointer, which means that a method was specified; and the pointer seems to point at the relevant method’s CodeAddress. However, we always use private methods for that, and those don’t seem to be enumerated by GetMethods.

Still, those three states are basically what I needed: don’t include an element when StoredProc = nil; when StoredProc = Pointer(1) make it compulsory, and make it optional otherwise when it’s a pointer.
Thanks a lot to all who helped! +Qing-Shan Xiao +Jeroen Wiert Pluimers +Asbjørn Heid

–jeroen

Posted in Delphi, Software Development, Development, Delphi 7 | 2 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 1,300 other followers

%d bloggers like this: