|
-
Jul 27th, 2000, 04:19 PM
#1
Thread Starter
New Member
<pre>I am writing a network messaging program that will reside on our users PC<font color="#007F00">'s, but the messages (displayed in a Rich text box) will be RTF files that reside on the server. I am using the GetPrivateProfileString function, and two INI files -- one will be stored with the program, and the other will be on the users private drive mapped to when the user is logged onto our network. MY OUESTION: Using the WritePrivateProfileString function -- is there a way to use a check box to activate the function? So when the check box is enabled true, it would write a new value into the INI file. The new value would be the starting value of the next message for the user to view. This way, the program will not run unless there is a new RTF message for the user to view (and not a previously viewed). Any help will be appreciated, **Thanks**</font></pre>
-
Jul 27th, 2000, 04:45 PM
#2
Code:
Public 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 Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Function readini(strsection As String, strkey As String, strfullpath As String) As String
Dim strbuffer As String
Let strbuffer$ = String$(750, Chr$(0&))
Let readini$ = Left$(strbuffer$, GetPrivateProfileString(strsection$, ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function
Public Sub writeini(strsection As String, strkey As String, strkeyvalue As String, strfullpath As String)
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Sub
Call writeini("Check.ini", "Checked", "" & Check1.Value & "", "C:\Check.ini")
Check1.Value = "" & readini("Check.ini", "Checked", "C:\Check.ini")
If Check1.Value = 1 Then
'code
End If
[Edited by Matthew Gates on 07-27-2000 at 05:49 PM]
-
Jul 27th, 2000, 08:47 PM
#3
Addicted Member
there is also a project demo on here in the demos section if you want to download that.
http://www.vb-world.net/demos/ini/
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
|