home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 3195
- ClientLeft = 165
- ClientTop = 735
- ClientWidth = 4680
- LinkTopic = "Form1"
- ScaleHeight = 3195
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Write
- Caption = "Save INI file"
- Height = 615
- Left = 2640
- TabIndex = 1
- Top = 360
- Width = 1575
- End
- Begin VB.CommandButton Add
- Caption = "Add Menu Item"
- Height = 615
- Left = 600
- TabIndex = 0
- Top = 360
- Width = 1695
- End
- Begin VB.Menu mnuFile
- Caption = "File"
- Begin VB.Menu mnuClose
- Caption = "Close"
- End
- Begin VB.Menu mnuOpen
- Caption = "Open"
- End
- Begin VB.Menu x
- Caption = "-"
- End
- Begin VB.Menu mnuRecentFile
- Caption = ""
- Enabled = 0 'False
- Index = 0
- Visible = 0 'False
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private 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
- Private Declare Function GetPrivateProfileString Lib _
- "kernel32" Alias "GetPrivateProfileStringA" _
- (ByVal lpApplicationName As String, _
- ByVal lpKeyName As Any, _
- ByVal lpDefault As String, _
- ByVal lpReturnedString As String, _
- ByVal nSize As Long, ByVal lpFileName As String) As Long
- Private Sub Add_Click()
- mnuRecentFile(0).Visible = True
- mnuRecentFile(0).Enabled = True
- mnuRecentFile(0).Caption = "hello"
- Load mnuRecentFile(2)
- mnuRecentFile(2).Caption = "yyy"
- End Sub
- Private Sub Form_Load()
- Dim r As Long, s As String
- s = String(255, 0)
- r = GetPrivateProfileString("VBMenu", "Files", "default", s, 255, "menu.ini")
- Load mnuRecentFile(1)
- mnuRecentFile(1).Caption = s
- End Sub
- Private Sub Write_Click()
- Dim r As Long
- r = WritePrivateProfileString("VBmenu", "Files", "xxx", "menu.ini")
- End Sub
-