Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Mar 17, 2004 11:25:40 GMT -5
Ok let me start by appologizing. I am on the short end of the rope this week because of recent events. That message was not pointed at anyone I just spaz when the I saw the comment about why wouldn't I show the proper way of doing it. Anyways true being told all I know is that they are apis I don't use them enough to have them memorized but for anyone who is interested in learning them check out www.allapi.net they hav a list of all the apis and you can download a compiled html version that has examples in vb6. This section is not dead because of what I said, it's because there are not enough vb programmers that bother coming here. Ninty 90% of this boards posters are mIRC scripters not programmers. Thats why I point people to other forums for their questions such as vb, php, c#, ect...
|
|
|
Post by Dangermouse on Mar 17, 2004 13:59:05 GMT -5
why use API's when u can use small functions Or spend an hour writing a class LOL ;D /me hugs tewl
|
|
|
Post by Lazer on Mar 17, 2004 16:07:56 GMT -5
/me * Hugs Tewl
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Mar 17, 2004 17:55:34 GMT -5
o btw lazer making doesnt have an e in it
|
|
Maverick
New Member
www.mavetech.tk
Posts: 174
|
Post by Maverick on Mar 18, 2004 9:41:30 GMT -5
lol @ tewl i think there are quite alot of people in here that are good programmers , many of them are just lazy my teacher once said: programmers are lazy when they want to do something that is not programming. that seemed to apply on me because i dont even study lol but some members are the opposite, they can do everything but not programming like posting silly comments like "lol" "lmao" or stuff like that on forums(spamming) rather than doing something good for them. Sorry but i have to send a message to all members on this board who are programmers br] you could have improved your skills by following what Tewl wanted to give u step by step. and u just let him down and made him cancel the whole thing. its your fault but when u need to do something similar and u had troubles with it, just remember that tewl wanted to teach me this but i didnt listen Mav
|
|
|
Post by Chuck on Mar 18, 2004 15:32:59 GMT -5
why you need to use an ini file? Just save or retrieve from normal text file.
|
|
|
Post by Alexander on Mar 18, 2004 16:19:49 GMT -5
i didnt let him down i wrote something nice for the competition on the first time, second time i was too ill though
|
|
|
Post by AbsoluteGenius on Mar 19, 2004 5:20:05 GMT -5
Here you go a simple class for reading and writing to an ini
Note: I have pasted the entire class contents here (formatted) but I know as soon as I hit that post button its gonna be ruined......
Option Explicit ' ********************** ' Private variables to store the settings made[img]http://proboards8.com/boardimages/sad.gif[/img]br]Private mvarPath As String Private mvarKey As String Private mvarSection As String Private mvarDefault As String Private mvarLastReturnCode As Long
' Declares for cIniFile[img]http://proboards8.com/boardimages/sad.gif[/img]br] ' Profile String functions[img]http://proboards8.com/boardimages/sad.gif[/img]br]Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As String, ByVal lpFileName As String) As Long Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As Any, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long ' local variable(s) to hold property value(s) Private mvarNullChar As String 'local copy
Public Property Let NullChar(ByVal vData As String) ' Used to signify the Key data is null mvarNullChar = vData End Property
Public Property Get NullChar() As String NullChar = mvarNullChar End Property
Property Get LastReturnCode() As Long ' Did the last call succeed? ' 0 if not! LastReturnCode = mvarLastReturnCode End Property
Property Let Default(sDefault As String) ' What to return if something goes wrong[img]http://proboards8.com/boardimages/sad.gif[/img]br] mvarDefault = sDefault End Property
Property Get Default() As String ' What to return if something goes wrong[img]http://proboards8.com/boardimages/sad.gif[/img]br] Default = mvarDefault End Property
Property Let Path(sPath As String) ' The filename of the INI file[img]http://proboards8.com/boardimages/sad.gif[/img]br] mvarPath = sPath End Property
Property Get Path() As String ' The filename of the INI file[img]http://proboards8.com/boardimages/sad.gif[/img]br] Path = mvarPath End Property
Property Let Key(sKey As String) ' The KEY= bit to look for mvarKey = sKey End Property
Property Get Key() As String ' The KEY= bit to look for Key = mvarKey End Property
Property Let Section(sSection As String) ' The [SECTION] bit to look for mvarSection = sSection End Property
Property Get Section() As String ' The [SECTION] bit to look for Section = mvarSection End Property
Property Get Value() As String ' Get the value of the current Key within Section of Path Dim sBuf As String Dim iSize As String Dim iRetCode As Integer sBuf = Space$(255) iSize = Len(sBuf) iRetCode = GetPrivateProfileString(mvarSection, mvarKey, mvarDefault, sBuf, iSize, mvarPath)
If (iSize > 0) Then Value = Left$(sBuf, iRetCode) If Value = mvarNullChar Then Value = "" End If Else Value = "" End If End Property
Property Let Value(sValue As String) ' Set the value of the current Key within Section of Path Dim iPos As Integer ' Strip chr$(0)[img]http://proboards8.com/boardimages/sad.gif[/img]br] iPos = InStr(sValue, Chr$(0)) Do While iPos <> 0 sValue = Left$(sValue, (iPos - 1)) & Mid$(sValue, (iPos + 1)) iPos = InStr(sValue, Chr$(0)) Loop If sValue = "" Or sValue = " " Then sValue = mvarNullChar End If
mvarLastReturnCode = WritePrivateProfileString(mvarSection, mvarKey, sValue, mvarPath) End Property
Public Sub DeleteValue() ' Delete the value at Key within Section of Path mvarLastReturnCode = WritePrivateProfileString(mvarSection, mvarKey, 0&, mvarPath) End Sub
Public Sub DeleteSection() ' Delete the Section in Path mvarLastReturnCode = WritePrivateProfileString(mvarSection, 0&, 0&, mvarPath) End Sub
Property Get INISection() As String ' Return all the keys and values within the current ' section, separated by chr$(0)[img]http://proboards8.com/boardimages/sad.gif[/img]br]Dim sBuf As String Dim iSize As String Dim iRetCode As Integer
sBuf = Space$(255) iSize = Len(sBuf) iRetCode = GetPrivateProfileString(mvarSection, 0&, mvarDefault, sBuf, iSize, mvarPath)
If (iSize > 0) Then INISection = Left$(sBuf, iRetCode) Else INISection = "" End If End Property
Property Let INISection(sSection As String) ' Set one or more the keys within the current section. ' Keys and Values should be separated by chr$(0)[img]http://proboards8.com/boardimages/sad.gif[/img]br] mvarLastReturnCode = WritePrivateProfileString(mvarSection, 0&, sSection, mvarPath) End Property
Private Sub Class_Initialize() mvarNullChar = "_" End Sub
|
|