Delphi 7 to Delphi 2009 conversion

Hello group,
What do I need to do to comile the following code in D2009.
Compiler error after the Else
E2010: Incompatible Types 'AnsiChar' and 'Char'

  if isUnicode then
   SearchHandle :=  FindFirstFilew( PWideChar( fn ), FindDataW )
  else
    SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), 
FindDataA );
        <<<<<compiler error in the above line >>>>>>>>>>>

Regards,
Bryan
0
Bryan
4/21/2010 8:14:25 PM
embarcadero.delphi.win32 2183 articles. 0 followers. Follow

2 Replies
1416 Views

Similar Articles

[PageSpeed] 57

> What do I need to do to comile the following code in D2009.
> Compiler error after the Else
> E2010: Incompatible Types 'AnsiChar' and 'Char'
> 
>  if isUnicode then
>   SearchHandle :=  FindFirstFilew( PWideChar( fn ), FindDataW )
>  else
>   SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ),
> FindDataA );        <<<<<compiler error in the above line >>>>>>>>>>>

Why on earth are you doing this? Just use

SearchHandle :=  FindFirstFile( PChar( fn ), FindData)

and you will compile perfectly across both D7 and D2009, assuming
FindData is declared as the generic TWin32FindData too.

-- 
Chris Rolliston
http://delphihaven.wordpress.com/
0
Chris
4/21/2010 9:33:19 PM
Thanks for your help!
Bryan

"Chris Rolliston" <spam@gmail.com> wrote in message 
news:236333@forums.embarcadero.com...
>> What do I need to do to comile the following code in D2009.
>> Compiler error after the Else
>> E2010: Incompatible Types 'AnsiChar' and 'Char'
>>
>>  if isUnicode then
>>   SearchHandle :=  FindFirstFilew( PWideChar( fn ), FindDataW )
>>  else
>>   SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ),
>> FindDataA );        <<<<<compiler error in the above line >>>>>>>>>>>
>
> Why on earth are you doing this? Just use
>
> SearchHandle :=  FindFirstFile( PChar( fn ), FindData)
>
> and you will compile perfectly across both D7 and D2009, assuming
> FindData is declared as the generic TWin32FindData too.
>
> -- 
> Chris Rolliston
> http://delphihaven.wordpress.com/
0
Bryan
4/22/2010 1:20:48 PM
Reply:

Similar Artilces:

Delphi 2007 to Delphi 2009 Conversion
CharArrayPtr = ^CharArray; CharArray = array[0..MaxInt-1] of Char; How to convert to Delphi 2009? Bill Bill Miller wrote: > CharArrayPtr = ^CharArray; > CharArray = array[0..MaxInt-1] of Char; > > How to convert to Delphi 2009? > > Bill it depends heavelly on how it is used fearther down in your project and what you want to convert it to. I you want to simple convert the declarations ignoring UNicode altogether then the only think you have to change is the CharArray declaratin from a Char to an AnsiChar eg CharArrayPtr = ^CharArray; CharArray =...

Question about Delphi 2009 vs Delphi 7
Hi, I was wondering if any of you can point me to a URLs that show the most important improvements between these versions of Delphi. The objective is convincing the powers-that-pay-the-bills that moving to D2009 (that we'd have to purchase) is a better idea than moving to D7 (for which we have licenses). Fire at will! -- Saluti, Alessandro Federici ------------------------------- "I have been through some terrible things in my life, some of which actually happened." (Mark Twain) Alessandro Federici wrote: > Hi, > I was wondering if any of yo...

Convert Delphi 7 to Delphi 2009 [Edit]
Hi! Please, I have a code done in Delphi 7... Now I want to convert Delphi 7 to Delphi 2009 but I'm having problems when compile the code. Error message: +[DCC Fatal Error] Far.dpr(9): F2063 Could not compile used unit 'System.pas'+ Please can somebody help me? Source Download (349KB): http://rapidshare.com/files/256191328/FileManager.rar.html Mirror Source Download: http://www.megaupload.com/?d=12GYLPT0 Password: delphi Thank u so much! (sorry for my bad english, it is not my native language) Edited by: loquax loquax on Jul 15, 2009 12:24 PM Sorry, bu...

Can delphi 2009 and delphi 7 be on the same computer?
Can I install and run delphi 2009 and delphi 7 separately on the same computer or will they interfer with each other? I have delpi 7 already so do I need to choose a new folder (not c:\Borland) when installing 2009? Lorne Anderson wrote: > Can I install and run delphi 2009 and delphi 7 separately on the same > computer or will they interfer with each other? > > I have delpi 7 already so do I need to choose a new folder (not c:\Borland) > when installing 2009? It works fine. You usually want to install the older version first. As for folders, the root folde...

Is possible to install delphi 7 and delphi 2009 upgrade?
I have delphi 7 interprise installed on my PC. Our company bought a delphi 2009 professional (upgrade). All of our projects now are made in delphi 7. We don't have time to move those projects to delphi 2009. Now, we are planning to create a new project using delphi 2009. Is it possible to install delphi 2009 in different windows profile without affecting delphi 7 projects? Edwin Aceron wrote: > I have delphi 7 interprise installed on my PC. Our company bought a > delphi 2009 professional (upgrade). All of our projects now are made > in delphi 7. We don't have time to move...

Win32 program: Delphi 7 vs Delphi XE5
How is a D7 Win32 program compared to a Delphi XE5 one in terms of stability and performance? Is Delphi XE5 good enough for a big ERP project with several DLL's and hundreds of units and forms? Thanks in advance Am 26.12.2013 15:02, schrieb lior ilan: > How is a D7 Win32 program compared to a Delphi XE5 one in terms of stability > and performance? > Is Delphi XE5 good enough for a big ERP project with several DLL's and > hundreds of units and forms? > Thanks in advance > Hello, XE5 has increased functionality. Stability seems to be ok for most ...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 7 to Delphi XE
Have been using Delphi 7 for many moons ( have got later versions but never upgraded to ) My first problem is: Component Palette. in XE it is a small toolbar docked in top right in Delphi 7 it gives a large view of all the components. I am struggling to be able to cope/access my components.in Delphi XE. Can I make the component pallette tool bar the same size as Delphi 7, or is there a fast way to view/choose all available components in XE, that I have not spotted yet? Kind Regards, Robert. Hi, What I know is that in Delphi 2010 and XE you can choose between t...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

How to access Delphi 7 & 2009 after purchasing Delphi XE
I have purchased and installed Delphi XE and now I'm unable to find information on how to download previous versions of Delphi, namely Delphi 7 and 2009. Please respond. Regards, SB, L&T Hi sushweta biswas, > I have purchased and installed Delphi XE and now I'm unable to find information on how to download previous versions of Delphi, namely Delphi 7 and 2009. Your reseller should have told you: after registering Delphi XE, you can go to http://www.embarcadero.com/xe-earlier-versions to enter your serial number of Delphi XE as well as your EDN account informati...

Delphi 7 to Delphi 2009 migration
Hello, for migrating a Delphi 7 application to Delphi 2009, I wonder if there is some kind of best practices guide available? For example, general pitfalls to watch out, ... or a tool which analyse the current code base in respect to problems with Delphi 2009. Basically it is a BDE based application accessing a MSSQL database. The only third-party component in use is an ActiveX thingy integrating a reporting engine. Thanks, Thomas At CodeRage 2008 session there is this Migrating your Applications to the Latest Delphi Many developers use Delphi 5, 6, 7, 2005, 2006 ...

Win32 Delphi language features introduced since Delphi 7
Hi, Am I right in thinking that the language features introduced since Delphi 7 fall into the categories: a) language features dictated by .Net compatibility. e.g. Namespaces, Inlining, records with methods, operator overloading, pure interfaces, generics, extended RTTI and reflection; b) Unicode strings and supporting procedures? c) 64-bit support What other language features, if any, have been introduced since D7? Had most of the post-D7 languages features, except for generics, Unicode strings, and 64-bit support, been introduced in or before Delphi 2005? How bug-free were ...

Web resources about - Delphi 7 to Delphi 2009 conversion - embarcadero.delphi.win32

Conversion (law) - Wikipedia, the free encyclopedia
Its criminal counterpart is theft . Examples are seen in cases where trees are cut down and the lumber hauled from the land by someone not having ...

Sonny Bill Williams' transformation due to conversion to Islam, Anthony Mundine says
He went from being savaged for walking out on the Bulldogs to becoming one of the world's most respected rugby union stars. Anthony Mundine believes ...

Government report: End ex-gay conversion “therapy” for LGBT youth
... endorsed efforts to ban the practice, which aims to change a person’s sexual orientation, gender identity or gender expression. “Conversion ...

Tory MP: 'It is time to make gay conversion therapy illegal'
Gay-conversion therapies were debated in the house of parliament this afternoon with one Conservative MP calling for legislation to make them ...

Russian Minister Confirms Plans to Ban Bitcoin-to-Fiat Conversions
Russia's Deputy Finance Minister has confirmed the country's plans to penalise the conversion of cryptocurrencies such as bitcoin into the ruble. ...

Get a free copy of powerful DVD ripping and video conversion software
DVD players are going the way of the Walkman, leaving many of us with vast libraries of obsolete discs. Of course the movies and TV shows themselves ...

This Texas Tech Two-Point Conversion Is A Work Of Art
Every college football play should start like this. Read more...

Advocates back Ohio bill to ban conversion therapy on gay, transgender minors
As a registered nurse and state-licensed social worker, Jody Davis spends much of her time helping others. But as a teen, she was put into conversion ...

5 Ways to Analyze the Path to Conversion
There are many different ways to analyze how a visitor comes to the point of conversion on your website. Over the past month I've been figuring ...

PRO-LIFE CONVERSION Ex-Planned Parenthood clinic reborn in Texas
PRO-LIFE CONVERSION Ex-Planned Parenthood clinic reborn in Texas

Resources last updated: 11/28/2015 3:13:56 AM