|
-
Jul 11th, 2001, 10:03 AM
#1
INI files
Can anyone see anything wrong with this?
I keep getting a runtime errror 49 "bad DLL calling convention". I am using a "c:\apps\stock\test.ini" file and trying to retrieve a "fred" variable
Private Declare Function GetPrivateProfileString Lib "kernel32"
Alias _
"GetPrivateProfileStringA" _
(ByVal lpAppName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String)
Private Sub Command1_Click()
Dim nChar As Long
Dim ReturnedString As String
Dim Parsed() As String 'not used
ReturnedString = String(512, 0)
nChar = GetPrivateProfileString("test", "fred", "", ReurnedString, 512, "c:\apps\stock\test.ini")
Debug.Print (nChar)
End Sub
-
Jul 11th, 2001, 10:16 AM
#2
Frenzied Member
I'm doing a completely different thing and getting the same error. Can anyone help?
My code (peices)
VB Code:
Declare Function GetPrivateProfileString Lib "kernel32" _
Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Public Function Devour(ByVal FullFileName As String) As Long
Dim ReturnedString As String
Dim ReturnedSize As Long
ReturnedSize = GetPrivateProfileString ("Properties", "WorkStation", "", ReturnedString, 256, FullFileName)
End Function
My error
The instruction at "0x77e873dc" referenced memory at "0x00000000". The memory could not be "written".
Course, the wording on my error isn't but so important. It looks like it is trying to write to a bogus memory address. I've stepped through the code, and I get the error on the API call. The error is bad enough to crash Studio.
I'm using VS6 on W2KPro.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Jul 11th, 2001, 10:46 AM
#3
Frenzied Member
Never mind, I just fixed my own problem.
VB Code:
Public Function Devour(ByVal FullFileName As String) As Long
Dim ReturnedString As String * 256
Dim ReturnedSize As Long
ReturnedSize = GetPrivateProfileString ("Properties", "WorkStation", "", ReturnedString, 256, FullFileName)
End Function
You have to give the string a length.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|