delphi 2006 code in delphi 2010

hello, 

is there any option to make delphi 2006 code work in delphi 2010? something like in java IDEs where you can define the code level you like to use?

the problem is, that i made a project with 2006 and sent it to my customer. they got 2010 and it compiles fine, but it just doesn't work. it deals with en-/decryption of text, we assumed, that it has something to do with ansi vs. unicode strings... but we cant find the exact position where the error occurs.

i am a bit dissapointed, because everywhere i read that the new IDE will always be downwards compatible and so on.. but in reality, it doesnt work..

but i still hope there is a magic checkbox or so, to get my project to work in delphi 2010...

thanks for any help!

best wishes
0
Thomas
10/20/2009 10:51:42 PM
embarcadero.delphi.ide 3925 articles. 0 followers. Follow

10 Replies
1305 Views

Similar Articles

[PageSpeed] 56

Thomas Schmidt wrote:

> 
> hello, 

Hi Thomas,


> 
> is there any option to make delphi 2006 code work in delphi 2010?
> something like in java IDEs where you can define the code level you
> like to use?
> 
> the problem is, that i made a project with 2006 and sent it to my
> customer. they got 2010 and it compiles fine, but it just doesn't
> work. it deals with en-/decryption of text, we assumed, that it has
> something to do with ansi vs. unicode strings... but we cant find the
> exact position where the error occurs.

Delphi 2010 is unicode and Delphi 2006 is Ansi.
In Ansi world 1 char = 1 byte
In Unicode world 1 char may be = 2 bytes

That is the problem you are having.

> 
> i am a bit dissapointed, because everywhere i read that the new IDE
> will always be downwards compatible and so on.. but in reality, it
> doesnt work..

In IDE all is compatible, in your code you should make sure you have
all done right.

> 
> but i still hope there is a magic checkbox or so, to get my project
> to work in delphi 2010...

I think the shortest path is make your en-/decryption code params =
PAnsiString, AnsiString, PAnsiChar, AnsiChar.

> 
> thanks for any help!
> 
> best wishes

Cesar Romero
0
Cesar
10/20/2009 11:02:37 PM
> {quote:title=Cesar Romero wrote:}{quote}
> 
> I think the shortest path is make your en-/decryption code params =
> PAnsiString, AnsiString, PAnsiChar, AnsiChar.
> 
> > 
> > thanks for any help!
> > 
> > best wishes
> 
> Cesar Romero

hello cesar,

thanks a lot for your fast answer! 
where do i enter these code params in delphi 2010?

kind regards
0
Thomas
10/21/2009 12:16:59 AM
Thomas Schmidt wrote:

> > I think the shortest path is make your en-/decryption code params =
> > PAnsiString, AnsiString, PAnsiChar, AnsiChar.
> > 
> > > 
> > > thanks for any help!
> > > 
> > > best wishes
> > 
> > Cesar Romero
> 
> hello cesar,
> 
> thanks a lot for your fast answer! 
> where do i enter these code params in delphi 2010?

Hi Thomas, 

It is not in Delphi itself, it is in your library code:
It was just a suggestion and you should take care of what you are doing:

Eg:

function DoCrypt(Value: PChar): PChar;

you should change to

function DoCrypt(Value: PAnsiChar): PAnsiChar;

Please check Nick Hodges articles:

Delphi in a Unicode World Part I: What is Unicode, Why do you need it,
and How do you work with it in Delphi?
http://dn.codegear.com/article/38437

Delphi in a Unicode World Part II: New RTL Features and Classes to
Support Unicode
http://dn.codegear.com/article/38498

Delphi in a Unicode World Part III: Unicodifying Your Code
http://dn.codegear.com/article/38693



Cesar Romero
0
Cesar
10/21/2009 12:27:16 AM
<Thomas Schmidt> wrote in message news:174957@forums.codegear.com...

> is there any option to make delphi 2006 code work in delphi 2010?
> something like in java IDEs where you can define the code level you
> like to use?

There is no such functionality in Delphi (or any other natively compiled 
language, for that matter).

> the problem is, that i made a project with 2006 and sent it to my
> customer. they got 2010 and it compiles fine, but it just doesn't work.

Can you be more specific about what exactly is not working correctly? 
Changes are, your code is making assumptions about character sizes and 
string encodings and such that are no longer true in 2010's Unicode 
environment.

> it deals with en-/decryption of text, we assumed, that it has something to 
> do
> with ansi vs. unicode strings...

Possibly.  Hard to saw for sure without seeing the actual code.

> i am a bit dissapointed, because everywhere i read that the new IDE will
> always be downwards compatible and so on..

That was true in older Ansi environments, before everything moved to 
Unicode.  There are things in Ansi code that have to be updated, or 
re-written, when dealing with Unicode.  It is not a 1-to-1 translation.

> i still hope there is a magic checkbox

Nope.

> to get my project to work in delphi 2010...

You will have to fix the bugs (and you do have bugs) in your code.

-- 
Remy Lebeau (TeamB)
0
Remy
10/21/2009 1:15:33 AM
"Cesar Romero" <cesar@liws.com.br> wrote in message 
news:174959@forums.codegear.com...

> Delphi 2010 is unicode and Delphi 2006 is Ansi.
> In Ansi world 1 char = 1 byte
> In Unicode world 1 char may be = 2 bytes

The number of bytes depends on the encoding used for the string.  A UTF-16 
string is always 2 bytes per Char, but a UTF-8 string can be between 1-4 
bytes, and an Ansi string can be however many bytes the associated codepage 
actually needs (usually 1-2, maybe 3, but can be more).

> I think the shortest path is make your en-/decryption code params =
> PAnsiString, AnsiString, PAnsiChar, AnsiChar.

That is certainly an option.  You just have to be careful if the source data 
is not an AnsiString to begin with, otherwise a data conversion will occur, 
potentially losing data if non-ASCII characters are being used.

-- 
Remy Lebeau (TeamB)
0
Remy
10/21/2009 1:18:42 AM
Thomas Schmidt wrote:

> thanks a lot for your fast answer! 
> where do i enter these code params in delphi 2010?

Hi Thomas,

Check the links in this thread:
http://stackoverflow.com/questions/1598211/delphi-conversion-unicode-issues



Cesar Romero
0
Cesar
10/21/2009 2:07:12 AM
I ran into a similar problem a while ago, also don't stare yourself blind on the encryption ... If you store it in a database where you can define your set make sure it is in UTF8 in the database. Which was my actual problem, not the encryption of a password :)
0
Kristof
10/21/2009 5:54:36 AM
Thomas Schmidt wrote:

> hello, 
> 
> is there any option to make delphi 2006 code work in delphi 2010?
> something like in java IDEs where you can define the code level you
> like to use?
> 
> the problem is, that i made a project with 2006 and sent it to my
> customer. they got 2010 and it compiles fine, but it just doesn't
> work.

You are hopefully aware of the fact that between Delphis 2007 and 2009,
strings were changed to be Unicode and that characters are and strings
now have 2-byte elements?

They can't just recompile with D2010, unless your code was made Unicode
ready. So get 2010 and do that.

-- 
Rudy Velthuis (TeamB)        http://www.teamb.com

"A nation is a society united by a delusion about its ancestry
 and by common hatred of its neighbors."
 -- William R. Inge
0
Rudy
10/21/2009 11:38:04 AM
thanks for your help! it works now!
0
Thomas
10/30/2009 1:04:18 AM
Hello,

similar problems I have here.
The code in Delphi 2006 looks like this and works fine:
{code}
   Header : string[100];
   version : byte;
   ...
   Header := 'Data ' + EditComment.Text;
   Header[100] := CHR (version);    <-- fails here: CHR command returns AnsiChar
   BlockWrite (FajlStream, Header[1], 100);
{code}

This code in 2010 triggers: +[DCC Error] main.pas(2285): E2010 Incompatible types: 'AnsiChar' and 'Char'+

The weirdest thing is, Help file says: *function Chr(X: Byte): Char;*  but compiler uses AnsiChar.

I must keep the file (where i write this string to) format fixed, because this file is interchanged between different applications.
Have tried with Array of char and similar but no luck.

Now I am trying with *Header : TCaption* and we will see what happens...
0
Aljaz
7/21/2010 7:32:40 AM
Reply:

Similar Artilces:

Transferring Delphi 5 BDE code to Delphi 2006 Nexus Embedded server code
In an application where I have used BDE in Delphi 5 I would like to transfer the whole project to Nexus Embedded server that in general implies mostly exchanging tTable with tnxTable etc. But, in a procedure I regenerate indexes using dbiRegenIndexes(basehandler). This function seems not to be supported anymore, so I just wonder if such a call is needed at all in Nexus Embedded Server, and if needed, what is now the correct syntax ?? I don't know the answer to your question but if you can't find answers here you may like to know that nexus db have there own free newsgr...

Is it worth to move my code from Delphi 2009 to Delphi 2010?
Hi guys, we are working on Delphi 2009 till this day because we do not have the time to upgrade our code to the newest version. There is always something more important (features, bugs...) and our code has 2+ million lines. I thought that instead of moving from D2009 to XE7 I could atleast move code to D2010 because it is more or less backward compatible and it shouldn't take me that much of a work. I wanted to ask you about your opinion. Is it a good version to move to? Regards. Dimitrij wrote: > I thought that instead of moving from D2009 to XE7 I could atleast > move ...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

Delphi 6 to Delphi 2010 character codes conversion
I an converting a unit from Delphi 6 to Delphi 2010. Everything works except for a couple of character codes, the decimal values are(224 and 227). As far as I can tell when data is loaded from the socket into a buffer, the codes are ok. When they are written to another buffer these 2 codes use the upper case version of the characters(192 and 224). I don' t see it on any other of the codes. I set the code page in the compiler options to 1252, but that did not work. Any other options I can set in Delp hi 2010 to correct this? TIA Jan B wrote: > I an converting a unit from D...

Delphi 2006 vs Delphi 2009 IDE stability
Hello, all. I have medium sized project which includes about 20Mb of source code (just size of *.pas files). I use Delphi 2006. There are third party component suites JVCL, DevExpress Bars, Pegasus Imaging. All updates applied. The main problem is IDE stability. About four..five times a day IDE become unstable after intensive usage of code insight functions (most often I press Ctrl+Space key). The best outcome is that I have to save everything and restart the IDE. The worst outcome is when IDE stalls or falls into endless loop of error messages and any unsaved work is lost. OS...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

vcljpg to vclimg, packages and Delphi 2006 vs Delphi 2010 compatibility
Hello, everybody. I have a package A which has vcljpg in its "requires" clause. I have another several packages B, C, D, E, etc which has A in theirs "requires" clauses. All packages are both Delphi 2006 and Delphi 2010 compatible. The problem is that there is no vcljpg package in Delphi 2010 and in order to compile the whole bunch of packages I have to change vcljpg to vclimg and compile. Unfortunately it renders the whole set of packages incompilable under Delphi 2006. Is there a way to create an alias for vclimg or vcljpg in order to get the same code...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Price of upgrade from Delphi 2010 Professional to Delphi 2010 Enterprise?
It's weird, but I could not find the answer on so simple question not in Embarcadero Shop, neither by the forum search. For example, the shop info about Enterprise upgrade says: The Upgrade product is available to registered owners of 2006-2009 versions, blah-blah... So, if I'm Delphi 2010 Professional user, I even not eligible for upgrade? I have to buy a new version of Enterprise??? But if I'm Delphi 2006 Professional user, I can upgrade. Please clarify this nonsense for me. Exact question is in the subject. Thanks! Hi Dmitri, > It's weird, but I could not...

Migrate from Delphi 2007 to Delphi 2010
Hi All, Thanks in advance for your help. Below is my query, Currently I am using Delphi 2007 and i want to migrate to Delphi 2010. 1. What all things i need to take care while doing this? 2. What all third party components will get impacted? 3. Any known issues in Delphi 2010 which might impact the cause? 4. Any changes in database operation required as i am using Oracle? Hope I have post this query under correct category. If not sorry for the trouble and could you please suggest me the correct category for this? Looking forward for your response. Have a great day. Th...

Migrating From Delphi 7 to Delphi 2010
We did not know which forum was the best for this question. We have been wanting to migrate from Delphi 7 to a later version for years but it appears to be a daunting task. We first looked at D2006 and that was a radical new world. We bought D2010 a couple of years ago and not done much with it because there are so many parts to our applications. We have done a few new applications in D2010 and they seem to work okay. D2010 has not been impressive, perhaps because of the strangeness compared to D7. Is is possible for us to do a phased sort of migration where we do a form at a time? ...

Delphi 2010 professional to Delphi XE3
Hello, Sorry for this is not right place to ask this question: I have Delphi 2010 professional version, I like to upgrade to Delphi XE3 Am eligible to upgrade or no not? I like answer from Delphi sales team. I couldn’t find email to ask them. Thanks Mike Thomas <> wrote in news:506459@forums.embarcadero.com: > Hello, > > Sorry for this is not right place to ask this question: > I have Delphi 2010 professional version, I like to upgrade to Delphi > XE3 Am eligible to upgrade or no not? I like answer from Delphi > sales team. I couldn’t find emai...

Web resources about - delphi 2006 code in delphi 2010 - embarcadero.delphi.ide

Delphi - Wikipedia, the free encyclopedia
... an archaeological site and a modern town in Greece on the south-western spur of Mount Parnassus in the valley of Phocis . The site of Delphi ...

Delphi Automotive (@DelphiAuto) on Twitter
Log in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Delphi Automotive @ DelphiAuto ...

Delphi Connect for Verizon on the App Store on iTunes
Get Delphi Connect for Verizon on the App Store. See screenshots and ratings, and read customer reviews.


Audi working with Delphi to develop autonomous car tech
Audi is developing an iPad-sized device that will pack all the necessary computing power for a self-driving car

US approves China company's acquisition of Delphi biz
The Committee on Foreign Investment in the United States has formally approved the acquisition of Delphi's global production of braking systems ...

Verizon And Delphi Officially Launch Vehicle Diagnostics Service - $250 For The Module, $5 A Month On ...
If you're a car nut, a paranoid parent, or a small business owner looking to do a little, uh, company vehicle economy analysis, Verizon's teamed ...

Watch out Google: Delphi gives Ars a ride in its self-driving car
The automotive components maker gave Ars a preview ride around the neighborhood. MOUNTAIN VIEW, CA—On Thursday morning I met with Delphi at its ...

The skinny on Delphi's autonomous road trip across the United States
Filed under: Green , Videos , Autonomous Last week, Delphi's autonomous car became the first to complete a coast-to-coast trip across the United ...

Delphi partners with WiTricity on automated wireless charging system
One could easily argue that parking between the white lines at any local hangout presents a challenge for some inexperienced drivers. So, why ...

Resources last updated: 11/21/2015 4:17:00 PM