home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "MainModule"
- Option Explicit
-
- #If Win16 Then
- Declare Function OSWritePrivateProfileString% Lib "KERNEL" Alias "WritePrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
- Declare Function OSGetPrivateProfileString% Lib "KERNEL" Alias "GetPrivateProfileString" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
- #Else
- Declare Function OSWritePrivateProfileString% Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$)
- Declare Function OSGetPrivateProfileString% Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$)
- #End If
-
- Sub Main()
- Dim ReturnString As String
- Dim Section As String
- Dim ErrCode As Long
-
- '--- Check to see if we are in the VB.INI File. If not, Add ourselves to the INI file
- #If Win16 Then
- Section = "Add-Ins16"
- #Else
- Section = "Add-Ins32"
- #End If
- ReturnString = String$(255, Chr$(0))
- ErrCode = OSGetPrivateProfileString(Section, "Sample.SimpleAlign", "NotFound", ReturnString, Len(ReturnString) + 1, "VB.INI")
- If Left(ReturnString, InStr(ReturnString, Chr(0)) - 1) = "NotFound" Then
- ErrCode = OSWritePrivateProfileString%(Section, "RunIn.RunAddIn", "0", "VB.INI")
- End If
- End Sub
-
-