Can't get GetPrivateProfileString API to work 
Author Message
 Can't get GetPrivateProfileString API to work

Can someone give me a clue?
I'm writing a 32bit vb4 app.  I cut and pasted with the API viewer.
GetPrivateProfileInt and WritePrivateProfileString work perfectly, but
GetPrivateProfileString returns nothing.  No errors, nothing.  Any
ideas?
Bud Baker



Thu, 29 Jul 1999 03:00:00 GMT  
 Can't get GetPrivateProfileString API to work

Have you intialised the return string? ie

 KeyValue$ = String$(128, 0)

HTH

Rob Agnew
r&d TeamSoft



Quote:
> Can someone give me a clue?
> I'm writing a 32bit vb4 app.  I cut and pasted with the API viewer.
> GetPrivateProfileInt and WritePrivateProfileString work perfectly, but
> GetPrivateProfileString returns nothing.  No errors, nothing.  Any
> ideas?
> Bud Baker




Thu, 29 Jul 1999 03:00:00 GMT  
 Can't get GetPrivateProfileString API to work

The API viewer (and even some KB articles) are notoriously BAD for
incorrect declarations.  Note that below the FIRST declare comes from
the API viewer that ships with VB.  The second declare (which I
believe is correct) is from an article in the KB.  Note that declare
#1 lpKeyName As Any
#2 lpKeyName As String

Declare Function GetPrivateProfileString
Lib "KERNEL32"  Alias "GetPrivateProfileStringA"
(ByVal lpApplicationName As String,
 ByVal lpKeyName As Any,
 ByVal lpDefault As String,
 ByVal lpReturnedString As String,
 ByVal nSize As Long,
 ByVal lpFileName As String) As Long

Declare Function GetPrivateProfileString
Lib "KERNEL32"  Alias "GetPrivateProfileStringA"
 (ByVal AppName As String,
  ByVal KeyName As String,
  ByVal keydefault As String,
  ByVal ReturnString As String,
  ByVal NumBytes As Long,
  ByVal FileName As String) As Long

You may want to examine your WritePrivateProfileString
declare against this:

Declare Function WritePrivateProfileString
Lib "KERNEL32" Alias "WritePrivateProfileStringA"
 (ByVal AppName As String,
  ByVal KeyName As String,
  ByVal keydefault As String,
  ByVal FileName As String) As Long

--Good Luck
  Patrick

Quote:

>Can someone give me a clue?
>I'm writing a 32bit vb4 app.  I cut and pasted with the API viewer.
>GetPrivateProfileInt and WritePrivateProfileString work perfectly, but
>GetPrivateProfileString returns nothing.  No errors, nothing.  Any
>ideas?
>Bud Baker




Thu, 29 Jul 1999 03:00:00 GMT  
 Can't get GetPrivateProfileString API to work

Give us some ideas! What are you passing and where....?




Fri, 30 Jul 1999 03:00:00 GMT  
 Can't get GetPrivateProfileString API to work

Quote:

>Give us some ideas! What are you passing and where....?

Just as a quick note, try defining your "incoming {*filter*}" As String *
i (Where i is a number), and stripping the spaces using the Trim
function.

--
Cheers,
Clyne McCarthy



Sat, 31 Jul 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. API GetPrivateProfileString and WritePrivateProfileString don't work.

2. Does anyone haver a working sample of API function GetPrivateProfileString which reads values from ini files

3. Does anyone haver a working sample of API function GetPrivateProfileString which reads values from ini files

4. ------------ GetPrivateProfileString doesn't work !! ---------------

5. GetPrivateProfileString doesn't work with kernel32.dll

6. GetPrivateProfileString doesn't work with colors

7. 'Canned' data in VB program

8. Help needed getting the ChooseFont api function to work

9. Getting the Current (working) Directory via Win API

10. Property Gets don't work in an RDS object

11. Getting adduitional Api.txt's

12. Stack API's: Getting the VB Stack

 

 
Powered by phpBB® Forum Software