Pchar for PansiChar - Delphi 7 for Delphi 2010

hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work

function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll';
function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll';
function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll';
function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dll';

How do I solve this problem. I do not have the sources of DLL

Regards
0
Pedro
4/17/2013 6:37:51 PM
embarcadero.delphi.non-tech 5933 articles. 1 followers. Follow

6 Replies
2295 Views

Similar Articles

[PageSpeed] 1

Pedro Leonardo wrote:
> hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work
> 
> function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll';
> function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll';
> function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll';
> function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dll';
> 
> How do I solve this problem. I do not have the sources of DLL
> 
> Regards

Change the PChar declarations to PAnsiChar.  What in D7 was a PChar is now a 
PAnsiChar in the Unicode versions.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
4/17/2013 6:41:40 PM
> {quote:title=Pedro Leonardo wrote:}{quote}
> hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work
> 
> function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll';
> function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll';
> function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll';
> function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dll';
> 
> How do I solve this problem. I do not have the sources of DLL
> 
> Regards


Hi, 
I changed and not worked

Regards
0
Pedro
4/17/2013 6:49:55 PM
Pedro Leonardo wrote:
>> {quote:title=Pedro Leonardo wrote:}{quote}
>> hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work
>>
>> function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll';
>> function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll';
>> function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll';
>> function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dll';
>>
>> How do I solve this problem. I do not have the sources of DLL
>>
>> Regards
> 
> 
> Hi, 
> I changed and not worked
> 
> Regards

How are you calling the function then.  You probably are still sending the 
address of a Unicode string.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
4/17/2013 7:09:37 PM
> {quote:title=Pedro Leonardo wrote:}{quote}
> hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work
> 
> function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll';
> function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll';
> function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll';
> function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dll';
> 
> How do I solve this problem. I do not have the sources of DLL
> 
> Regards


Hi, I changed all calls  PChar to PAnsiChar

function TkmCreateStream(FileName: PAnsiChar; Var Stream: dWord; Var Error: dWord): PAnsiChar; stdcall; external 'trackbuffer.dll';
0
Pedro
4/17/2013 8:11:18 PM
Pedro Leonardo wrote:
>> {quote:title=Pedro Leonardo wrote:}{quote}
>> hello, I use a DLL developed in D7 and not have the same sources. I will use Delphi 2010 and the functions do not work
>>
>> function TkmInitialize(LOGXMLDIR: PChar; TkmByExt: dWord): dWord; stdcall; external 'trackbuffer.dll';
>> function TkmCreateStream(FileName: PChar; Var Stream: dWord; Var Error: dWord): PChar; stdcall; external 'trackbuffer.dll';
>> function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: dWord; MediaName: PChar): dWord; stdcall; external 'trackbuffer.dll';
>> function TkmIsTkm(FileName: PChar): Bool; stdcall; external 'trackbuffer.dll';
>>
>> How do I solve this problem. I do not have the sources of DLL
>>
>> Regards
> 
> 
> Hi, I changed all calls  PChar to PAnsiChar
> 
> function TkmCreateStream(FileName: PAnsiChar; Var Stream: dWord; Var Error: dWord): PAnsiChar; stdcall; external 'trackbuffer.dll';

But how are you calling it?  Did you fix up the calling code.  You said even 
after doing this it "didn't work" which is pretty non descriptive.  Not only do 
you need to fix the external declarations but you need to make sure you are 
passing in the correct data types to those calls.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
4/17/2013 8:14:57 PM
Hello Pedro,

> hello, I use a DLL developed in D7 and not have the same sources.
> I will use Delphi 2010 and the functions do not work

That is because you are mismatching the parameter types.  PChar is PAnsiChar 
in D7, but is PWideChar in D2010.  You need to declare the DLL functions 
accordingly in your D2010 code, eg:

{code:delphi}
function TkmInitialize(LOGXMLDIR: PAnsiChar; TkmByExt: dWord): dWord; stdcall; 
external 'trackbuffer.dll';

function TkmCreateStream(FileName: PAnsiChar; Var Stream: dWord; Var Error: 
dWord): PAnsiChar; stdcall; external 'trackbuffer.dll';

function TkmLogEnd(Stream: dWord; MediaDuration, MediaPosition, MediaType: 
dWord; MediaName: PAnsiChar): dWord; stdcall; external 'trackbuffer.dll';

function TkmIsTkm(FileName: PAnsiChar): Bool; stdcall; external 'trackbuffer.dll';
{code}

--
Remy Lebeau (TeamB)
0
Remy
4/17/2013 8:23:51 PM
Reply:

Similar Artilces:

here's a tech question for non-tech
I have not had occasion to want to do this before, so I'm hoping someone can enlighten me. I have an app built in D7, and it's rather complex in its functionality. Is it possible to rebuild the app to run as a service? Would that require separating the user interface from the app? Thanks, Bill William Meyer wrote on 4/22/2010 : > I have not had occasion to want to do this before, so I'm hoping > someone can enlighten me. I have an app built in D7, and it's rather > complex in its functionality. Is it possible to rebuild the app to run > as a service?...

PChar to PAnsiChar
Hello, I have the following code in Delphi 2007: WinExec( PChar( 'Notepad ' + TextFile), SW_SHOW); In Delphi XE8 I get the hint PAnsiChar. So I changed it to: WinExec( PAnsiChar( 'Notepad ' + TextFile), SW_SHOW); But then the compiler gives the warning: +W1044 suspicious typecast of string to PAnsiChar+. How can this be solved ? Thanks, Hubert Hubert Anemaat wrote: > WinExec( PAnsiChar( 'Notepad ' + TextFile), SW_SHOW); > > But then the compiler gives the warning: +W1044 suspicious typecast > of string to PAnsiChar+. &g...

7 #7
Name: Inan Email: maung_bandungatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: 7 Comments: this is my first time use this program Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a8) Gecko/2007091216 GranParadiso/3.0a8 ...

non #7
Name: Arslan mir Email: arslan_miratlivedotcom Product: Shiretoko Alpha 1 Summary: non Comments: better then any one Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2) Gecko/20080829082037 Shiretoko/3.1a2 From URL: http://www.mozilla.org/projects/shiretoko/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

*7*7
Name: baggar Email: zememraatyahoodotfr Product: Gran Paradiso Alpha 1 Summary: *7*7 Comments: haloooooooooooooooo Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 GranParadiso/3.0a1 ...

7 #7
Name: Rovensky Email: K_39-9atmaildotru Product: Firefox Summary: 7 Comments: Suuuupeeer! Fox Draive! Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14 From URL: http://hendrix.mozilla.org/ ...

Groupwise 7 and Outlook 2010 on Windows 7 64-bit coexisting
Hello. I am struggling with having Groupwise 7.0.3 client and outlook 2010 installed on the same Windows 7 64-bit machine. The GW client itself is working well, but not together with Outlook. I remembered installing first Outlook and then Groupwise is a good idea. But I am missing in the mail (32-bit) control panel the check for "always prompt for choosing the profile". It just not there. I can only select the "Novell Groupwise" profile or the "Outlook" profile. Any idea? Wrong WMS ? Thanks for help, Michael On 28.01.2011 19:15, Michael...

PChar to PAnsiChar #2
Hello, I have the following code in Delphi 2007: WinExec( PChar( 'Notepad ' + TextFile), SW_SHOW); In Delphi XE8 I get the hint PAnsiChar. So I changed it to: WinExec( PAnsiChar( 'Notepad ' + TextFile), SW_SHOW); But then the compiler gives the warning: +W1044 suspicious typecast of string to PAnsiChar+. How can this be solved ? Thanks, Hubert WinExec( PAnsiChar( 'Notepad ' + AnsiString(TextFile)), SW_SHOW); -- Patrick Schwarzer ...

Testing Non-Tech
I haven't seen anything for three days in this group! -- Q 01/24/2014 15:15:19 1.19.1.372 [Q'sBrokenToolBar] [Running on TQ] Quentin Correll wrote: > I haven't seen anything for three days in this group! How can that be? You replied to a post from Nick in thread "Test the best" today. -- Arno Arno, | How can that be? You replied to a post from Nick in thread | "Test the best" today. Strangely enough, I could post. <g> But I wasn't sure about that since XN didn't "receive" anything until I did ...

7.02/7.03/7.04
Is there some documentation somewhere that outlines the major differences between these versions? It seems that they're all three still active codebases. We're using 7.0.2.1506 in production, and I want to recommend an upgrade, but I'm not sure which version to target. Paul Horan[TeamSybase] VCI Springfield, MA www.vcisolutions.com Look at the online help (HtmlHelp) included with 7.04. The home page has links to new features in 7.0.4(none), 7.0.3, 7.0.2, etc. Also, from this document on the sybase website (http://www.sybase.com/detail/1,6904,1002288,00.ht...

CA EZAntivirus ver 7.0.7.7
ftp://ftp.ca.com/pub/myeTrust/apps/ -- Aloke ---- to reply by e-mail remove 123 and change invalid to com ...

Windows 7 #7
Name: Albert Offerein Email: adotoffereinatupcmaildotnl Product: Shiretoko Alpha 1 Summary: Windows 7 Comments: This browser works perfect in Windows 7 RTM build 7600 . The 3.5 was crashing from time to time, and i do not wanted to go back to IE8, so i am happy with this namoroka Each morning i install the update ( nightly build ) Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2a2pre) Gecko/20090901 Namoroka/3.6a2pre (.NET CLR 3.5.30729) From URL: http://www.mozilla.org/projects/namoroka/ Note to readers: Hendrix gives no expectation of a ...

windows 7 #7
Name: kieran Email: kieranian2001atgmaildotcom Product: Firefox Summary: windows 7 Comments: works on windows 7 but needs to be run from download rather than downloaded separately and then run Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Exchange 2010 and GroupWIse 7
Hi We are currently preparing to migrate to Exchange 2010. Our AD domain is w2k8r2 so we are unable to get an exchange 2003 server into the domain thus are unable to use the GroupWise connector. So I have setup a non-groupwise domain for the exchange server and this is linked to the GWIA. I have added an exchange user to the non groupwise domain and can see this in the system address book. When I try and send this user an email I get a 550 rejecting spoofed message. How can I get the GWIA to route email to the Exchange system? Thanks Andy -- AndyTee ---------------...

OSUG
Hi Everyone; This is a preliminary notice for the up coming Ottawa Sybase User Group meeting on December 7, 2010. FYI: http://chrispollach.blogspot.com/2010/10/osug201012.html Regards ... Chris President: OSUG / STD Inc. Blog: http://chrispollach.blogspot.com PBDJ: http://chrispollach.sys-con.com SourceForge: http://sourceforge.net/projects/stdfndclass ...

Web resources about - Pchar for PansiChar - Delphi 7 for Delphi 2010 - embarcadero.delphi.non-tech

Unofficial ByteStrings Patch To Enable AnsiString Support In Delphi XE8 Firemonkey On Android And IOS ...
Developer Andreas Hausladen has released an updated version of his patch for System.ByteStrings which gives you access to PAnsiChar and other ...

Using SQLite 3 with Unicode in Delphi
I’ve updated my SQLite3 Delphi wrapper for Unicode in Delphi 2009 and higher. Previous versions of the wrapper ducked the issue by using Ansi ...

Reference for unit 'System': Types
[ Overview ][ Constants ][Types][ Classes ][ Procedures and functions ][ Variables ][ Index ] Reference for unit 'System' ( #rtl ) Reference ...


Use AnsiString And UTF8String In Delphi XE5 Firemonkey On Android And IOS
Embarcadero disabled access to byte stings in Delphi XE5 Firemonkey and if you're a long time Delphi developer you may be missing them. They ...

Tim Anderson's ITWriting
... just updated it to work with Delphi 2009 – I’m not happy with what I’ve done, because I’ve changed a bunch of declarations from PChar to PAnsiChar ...

Resources last updated: 12/3/2015 10:49:19 AM