Board index » delphi » Bad experiences with strings and PChars calling API in D@
ba...@tor.hookup.net (Brad Aisa)
![]() Delphi Developer |
Tue, 02 Feb 1999 03:00:00 GMT
Bad experiences with strings and PChars calling API in D@I have a couple of hell days, getting code to work properly that calls Win 1. PROBLEM WITH PCHARS In particular, this series of functions fails (A is a COM interface procedure A(Msg: PChar) B(Msg) procedure B(Msg: PChar) C(Msg) procedure C(Msg: PChar) {open a file) end; Now, I have traced through using the de{*word*81}, to function C. I can place a The following was necessary, to get it to work: procedure C(Msg: PChar) {open a file) end; This works just fine. I tried lots of other things, such as turning off optimizations, and 2. PROBLEMS WITH STRINGS AS PCHAR I have a structure which needs to be filled with some values and PChars trec = record arec.value1 := PChar(Edit1.Text); This would not work. It would result in garbled results. To make it work, I var string1 := PChar(Edit1.Text); Can anyone suggest what is going wrong? I thought you were supposed to be Note that in none of the examples I have given involve the function being Any feedback would be welcome. -- "The highest responsibility of philosophers is to serve as the |