Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 538419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:01:47+00:00 2026-05-13T10:01:47+00:00

I’m developing a Word addin in Delphi 7, but soon I’ll upgrade it to

  • 0

I’m developing a Word addin in Delphi 7, but soon I’ll upgrade it to Delphi 2010, as you know, since version 2009 Delphi introduces the new string type UnicodeString which equals to the keyword string . On the other hand, according to this thread we need to use WideString to communicate with COM.

My question is, what should I do in order to get ready for Delphi 2010 in the future while currently developing in Delphi 7? Currently in my code I use a user-defined type UnicodeString, the idea is that when compile with D7 my string is WideString, when compile with D2009 and up it’s UnicodeString, I see Virtual TreeView uses such technique ,like the following code:

{$ifndef COMPILER_12_UP}
type
  UnicodeString = WideString;
  PByte = PAnsiChar;
{$endif COMPILER_12_UP}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:01:47+00:00Added an answer on May 13, 2026 at 10:01 am

    Step 1
    Usually you should stick to using the ‘normal’ types as far as possible: i.e. String and Char
    This way your code will be ‘automatically’ converted when you upgrade.
    NOTE : There are a few application-specific exceptions.

    If you don’t do this, you’re likely to experience a problem I had when upgrading a library of code that had in some places used AnsiString. This wasn’t a problem in old Delphi when AnsiString = String. But obviously this was problematic when the types were no longer the same.

    Step 2
    Read the guidelines provided for migrating to Unicode Delphi 2009. It mentions the functions that are typically abused when working with strings because it is assumed that each character is 1 byte. Take note of these, and code according to those recommendations.

    Steps 3, 4 and 5
    Avoid the use of conditional compilation. You’ll only give yourself more headaches.

    Steps 6, 7, 8, , 9 and 10
    Don’t try to second guess the compiler by redefining its internal types. You’re exposing yourself to many headaches. The thing is that the VCL, run-time libraries and 3rd party components all have an ‘understanding’ of what String is. The ‘new understanding’ will still be shared when you upgrade to Delphi 2009.

    If you change that definition, then things may still work in the old version due to implicit compatibility; however it is likely to break horribly when in Delphi 2009 things suddenly change.

    Remember! The kind of string used is an important consideration with Windows API calls. Windows typically supports both Ansi and Wide versions of most functions. In older Delphi, Ansi versions are used by default; and from Delphi 2009, Wide versions are used by default.

    Notes
    Regarding your concerns about WideString in COM development:
    Older versions of Delphi provide automatic typecasting between String and WideString – let your compiler work for you where it can. Obviously your COM interfaces have to be declared with WideString, but try to avoid anything beyond that.

    EDIT
    Take a look at the link provided by Hughes: Get ready for Delphi 2009 and up when developing with Delphi 7?

    Also just to emphasise: Each new version of Delphi attempts to maintain some level of backward compatibility (Delphi 2009 included). If you just code ‘normally’ you’re unlikely to be impacted to any great degree. In fact the converse is generally true; the more fancy you get, the more likely you are to encounter problems.

    The only serious problems I’ve ever had with moving to new versions of Delphi are:

    • 3rd party code/libraries without source code.
    • Unmaintained 3rd party code where their developers resorted to various coding ‘tricks’.
    • Midas code in Delphi 3 was a particularly arduous upgrade. (But there again, developers bypassing the recommended techniques was a big culprit.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.