Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NT4 API GetPrivateProfileString vs Win95 Help!
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00038058
Message ID:
00038080
Views:
54
>I've developed my app in NT, using Get/WritePrivateProfileString and it work fine there, but when I try to run it in 95, it craps out. MSDN tells of some subtle differences in the GetProfileString in the API's of NT 4 and Win95, but does not get specific.

Yes, there are differences although if you code it right it shouldn't make a difference. The main difference is that NT uses Wide
Character Sets for API calls and thus fills the rest of your string with garbage after the NULL when it returns to VFP. If you're not
checking for the NULL properly (or just kill the first NULL) you might get garbage.

It's hard to blow up GetPrivateProfileString because the API actually performs string bound and pointer checking internally.

What exactly are you seeing?

FWIW, the right way to call it and convert the string is like this:
*** DECLARE LOADED IN THE API OBJECT
lnResult=GetPrivateProfileString(lcSection,lcVariable,"*NONE*",;
                                 @lcResult,LEN(lcResult),THIS.cContentFile)
                         
* lcResult=TRIM(CHRTRAN(lcResult,CHR(0),""))
lcResult = SUBSTR(lcResult,1,lnResult)
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform