The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

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

    Join 1,862 other subscribers

Archive for the ‘Delphi 2007’ Category

MonkeyStyler Blog: should be on DelphiFeeds too.

Posted by jpluimers on 2013/02/15

I mailed the DelphiFeeds people to add the MonkeyStyler Blog by Mike Sutton.

It is a nice Delphi related blog focussing on FireMonkey stuff.

–jeroen

Posted in Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, FireMonkey, OS X FMX, Software Development | 4 Comments »

Allen Bauer on: delphi – What’s the difference between CreateWnd and CreateWindowHandle? (plus a bit of CreateParams)

Posted by jpluimers on 2013/02/06

One of the really nice contributions on StackOverflow by Allen Bauer is almost 3 years ago.

It is about these three Delphi VCL methods introduced by TWinControl to make control development easier:

The really cool thing is that this API has been stable since 1995, and still allows you to subclass windows controls or create your own controls in a very simple way.

Note that Allen does not cover DestroyWnd or DestroyWindowHandle, but those are just counterparts of CreateWnd and CreateWindowHandle.

In normal Delphi application code, you have less Destroy overrides than Create overrides, and the same holds for control development.

–jeroen

via: delphi – What’s the difference between CreateWnd and CreateWindowHandle? – Stack Overflow.

Posted in Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Software Development | 2 Comments »

Delphi: path names both in .dpr and .dproj, why? (refactoring – How to reorganize the folder structure of my units in Delphi? – Stack Overflow)

Posted by jpluimers on 2012/09/27

Cool: learned something new here:

About the path names of files being in the .dproj as well as in the .dpr:

@Jeroen – Looks like msbuild might need those entries, otherwise they’re possibly redundant, AFAICT… In any case, there is not much editing involved, just delete ‘dccreference’ entries and then a ‘save all’ in the IDE regenerates them. – Sertac Akyuz

–jeroen

via: refactoring – How to reorganize the folder structure of my units in Delphi? – Stack Overflow.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , , , , | 14 Comments »

Delphi, solutions for `while debugging with Environment Variable “The program can’t start because ….dll is missing”‘

Posted by jpluimers on 2012/09/14

Two days ago I ran into the bug below while porting some code from Delphi 2006 to Delphi XE2, posted on StackOverflow, and got solutions in very little time.

Thanks Andreas HausladenDavid Heffernan, Ken WhiteSertac Akyuz, Rudy Velthuis, for answering, providing solutions and verifying!

Note that this worked up until Delphi XE, and has been fixed in Delphi XE3 (which for this project I can’t use as the client upgraded to XE2 without SA).

Problem

  • I get the error mentioned further on error when debugging an executable in Delphi XE2 update 4 under these circumstances:
  • that depends on mqic.dll from WebShpere that is in C:\Program Files \IBM\WebSphere MQ\bin\mqic.dll and C:\Program Files\IBM\WebSphere MQ\bin is on the system path (not on the user path).
  • is being debugged with an override environment variable in the Run -> Parameters -> Debugger -> Environment Block -> User overrides
  • Including System Variables on the same property page is checked

This is the error (it’s a Windows DLL load error marked “System Error”).

The program can’t start because mqic.dll is missing from your computer. Try reinstalling the program to fix this problem.

Solutions

–jeroen

via delphi – while debugging with Environment Variable “The program can’t start because ….dll is missing” – Stack Overflow.

Posted in Delphi, Delphi 2006, Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , | Leave a Comment »

Crap: VersionInfo handling broken as of Delphi XE2

Posted by jpluimers on 2012/09/11

Today I found out the hard way that you really need a build integration system for managing VersionInfo in Delphi applications: as of Delphi XE2 it is broken in the IDE.

See these links:

This is the only workable workaround so far:

–jeroen

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , , , , , , | 14 Comments »

ModelMaker Code Explorer 10.0.0: Delphi XE3 compatible, Locate Type and Empty Parameter Lists with ()

Posted by jpluimers on 2012/09/10

Last week, ModelMaker Code Explorer 10.0.0 got released:

General new features

  • Delphi XE3 / RAD Studio XE3 support
    (as well as support from Delphi 5 and up)
  • Member Search list allows filtering on member type. Todo items are also displayed.
  • Pascal, new option on tab MMX | Properties | Pascal | New Entities | Methods: Empty Parameter lists. This controls how empty method, procedure and delegate parameter lists are emitted: either suppressed – pascal style, or emitted as ( ) – c-style.
  • Locate Type: displays a filtered list of previously parsed class and interface types. This is used to open the containing source file and locate a class inside the file. Default key binding Alt+Shift+T.

Solved bugs

  • Text containing line breaks and stored in XML (settings, snippets) could contain stray 0x0B (#11) characters. Solved.
  • An access violation at shutdown could occur in older Delphi IDEs if MMX was not docked. Solved.
  • If the Delphi IDE editor buffer contains a stray #0 (which is bad in itself) would cause all kinds of exception in MMX. MMX now detects stray #0’s and abort all editing operations, displaying the line:column of the bad #0 character.
  • Pascal: relative paths starting with \ (relative to root in drive) would not be handled correct. Solved

–jeroen

via: ModelMaker Code Explorer 10.0.0.

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: , , , , , , , , , , , , , , , , , , | 2 Comments »

Delphi/Fortran memory allocation difference: row/column major order makes a big difference. StackOverflow answer.

Posted by jpluimers on 2012/08/14

Last week I posted an in depth answer on StackOverflow.com about the memory allocation difference in Delphi and Fortran, or more accurately in two different kinds of languages.

You have:

  • column major order (not only used in Fortran and other science centric languages, but also in the shading languages GLSL and HLSL that can be used in FireMonkey)
  • row major order (used in most other languages, for instance Delphi, C, etc)

A very important aspect is the order of for optimized loops. For column major order, the optimum is inside out (as the inner arrays/records are in consecutive memory locations), but for row major order, it is the exact inverse.

One of the consequences is that in Fortran it is a very fast operation to pass an array of inner fields as parameter to a method.

This is what I wrote: Read the rest of this entry »

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi for PHP, Delphi x64, Delphi XE, Delphi XE2, Development, Fortran, Software Development | 4 Comments »

Delphi 2007: reproduction and workaround for “[DCC Error] ….pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0”

Posted by jpluimers on 2012/07/31

Just in case you come across this error ([WayBackQC 108189):

[DCC Error] CompilerAVUnit.pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0

I had this error in a really complicated unit that I tried to backport from Delphi XE2 to Delphi 2007 (as there was some non-unicode compliant app that needed this).

I could not find it searching for F2084 Internal Error, so I sat down and trimmed it down to the CompilerAVUnit below.

The workaround is simple: remove the static; from method Outer and it compiles fine.

I will post more details on the static keyword in Delphi in a future blog post. For now I’ll keep it at this: Read the rest of this entry »

Posted in Delphi, Delphi 2007, Development, F2084, QC, Software Development | 8 Comments »

Why SizeOf for character arrays is evil: stackoverflow question “Why does this code fail in D2010, but not D7?”

Posted by jpluimers on 2010/05/11

This Why does this code fail in D2010, but not D7 question on stackoverflow once again shows that SizeOf on character arrays usualy is evil.

My point in this posting is that you should always try to write code that is semantically correct.

By writing semantically correct code, you have a much better chance of surviving a major change like a Unicode port.

The code below is semantically wrong: it worked in Delphi 7 by accident, not by design:
Like many Windows API functions, GetTempPath expects the first parameter (called nBufferLength) number of characters, not the number of bytes. Read the rest of this entry »

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Encoding, ISO-8859, Software Development, Unicode | Leave a Comment »

Delphi operator overloading: table of operators, names, and some notes on usage and ‘glitches’

Posted by jpluimers on 2009/10/19

Operator overloading is a very nice feature of the Delphi language.
However. the Delphi documentation on Operator overloading is not completely right.

Below is my table of what I found out so far, and some notes.

It is part of my “Nullable types in Delphi” session that I gave on some conferences.
The downloads for that session contain more detailed information.

This is just an abstract to get you going and a try to answer this operator overloading question on Stackoverflow.
Download the full presentation to get more in depth information.

Let me know if you need more information.

Notes

Operator overloading

Add your own “behaviour” to operators

  • Win32: Works only for records, not classes!
  • An operator and the operand(s)
    are being implemented worden by a “class operator”;
    this is a kind of class method with name and argumen(s)

Example:

  • Multiplication X : = A * B;
  • Operator: *
  • Name: Multiply
  • Operands: 2 -> two parameters
type
  TMyRecord = record
    class operator Multiply(A, B: TMyRecord): TMyRecord;
  end;

Documentation is not correct!

Combining the rules of operator and result types, you can do magical things like Dances with XML | Australian Delphi User Group Members.

Do not use Delphi 2006 with operator overloading

Delphi 2007 fixed a number of bugs including this one: Delphi 2006 wont allow const parameters of type record within record method? – Stack Overflow.

10+ years later: maybe assignment operator?

It might be that in 2019, a new Delphi version gets assignment operator overloading: [WayBack] Operator Overloading Explained – Code Partners

Watch the result type of comparison operators!

Tips:

  • Some operators should be overloaded pair-wise
    = and <>
    shl and shr
    < and >=
    > and <=
    dec and inc
    + and –
    / and *
    div and mod
  • Prefer Explicit over Implicit operators
    • Beware of the built-in type coercion (implicit operators)
    • e.g
      • Byte to Integer;
      • Integer to Double;
      • Variants from/to anything!

Table of operators

operator # usage name cagetory *
and 2 R := A and B; BitwiseAnd bit
not 1 R := not A; //BitwiseNot bit glitch: does not exist!
or 2 R := A or B; BitwiseOr bit
xor 2 R := A xor B; BitwiseXor bit
() cast 1 R := TValue(A); Explicit conversion
:= 1 R := A; Implicit conversion
operator # usage name category *
round 1 R := Round(A); Round function
trunc 1 R := Trunc(A); Trunc function
and 2 R := A and B; LogicalAnd logical
not 1 R := not A; LogicalNot logical
or 2 R := A or B; LogicalOr logical
xor 2 R := A xor B; LogicalXor logical
operator # usage name category *
+ 2 R := A + B; Add binary
/ 2 R := A / B; Divide binary
div 2 R := A div B; IntDivide binary
mod 2 R := A mod B; Modulus binary
* 2 R := A * B; Multiply binary
2 R := A – B; Subtract binary
operator # usage name category *
shl 2 R := A shl B; LeftShift binary name is confusing
shr 2 R := A shr B; RightShift binary name is confusing
1 R := -A; Negative binary
+ 1 R := +A; Positive binary
dec 1 Dec(A); Dec self
inc 1 Inc(A); Inc self
operator # usage name category *
= 2 R := A = B; Equal comparison
> 2 R := A > B; GreaterThan comparison
>= 2 R := A >= B; GreaterThanOrEqual comparison
< 2 R := A < B; LessThan comparison
<= 2 R := A <= B; LessThanOrEqual comparison
<> 2 R := A <> B; NotEqual comparison
operator # usage name category *
in 2 R := A in B; In set

–jeroen

Posted in Conferences, Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Event, Software Development | 6 Comments »