December 11, 2024, 09:17:09 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


PrivateProfileString

Started by REDEBOLT, June 16, 2008, 04:11:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

REDEBOLT

I am trying to get my arms around "WritePrivateProfileString" without success.
What am I doing wrong?

I haven't been able to find any examples.

' Create the "ini" file for graphics.
'
'$INCLUDE "windows.inc"
$INCLUDE "typedefs.inc"
DECLARE IMPORT,WritePrivateProfileString alias WritePrivateProfileStringA(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName),BOOL
DECLARE IMPORT, _GetLastError ALIAS GetLastError(),INT

GLOBAL CreateIni
DEF inifile as file
SUB CreateIni(filename as string)
print filename
OPENFILE inifile,filename,"W"
print WRITE(inifile,"[Heeeeers Booob]")
print WritePrivateProfileString("Here is Bob","Bob","Hello Bob",inifile)
print _GetLastError()
CLOSEFILE inifile
ENDSUB

CreateIni(GETSTARTPATH+"Table2-1.ini")
print:print "Press <Enter> to quit."
input ""
Regards,
Bob

Ionic Wind Support Team

You don't open a file for it.  The last parameter is the full path to the ini file.   

Just don't do it on Vista if your program exists in the program files directory, unless the .ini file is in the users documents path of course.

Paul.

Ionic Wind Support Team