vb里怎么记录一个应用程序的文本框里面的内容
比如我有一个文本框1,里面原始值是TEXT1,我运行了生成的EXE软件,把里面的值TEXT1修改成另一个程序文本框里面的内容,关闭,下次再运行exe软件的时候,里面的值就...
比如我有一个文本框1,里面原始值是TEXT1,我运行了生成的EXE软件,把里面的值TEXT1修改成另一个程序文本框里面的内容,关闭,下次再运行exe软件的时候,里面的值就变成了另一个程序文本框里面的内容,如何实现,具体点,谢谢
展开
2013-11-09
展开全部
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type POINTAPI '定义点(Point)结构
x As Long '点在X坐标(横坐标)上的坐标值
y As Long '点在Y坐标(纵坐标)上的坐标值
End Type
Dim WithEvents Timer1 As Timer ' 这里定义钩住事件
Dim MousePoint As POINTAPI
Private Sub Form_Load()
'创建一个计时器
Set Timer1 = Form1.Controls.Add("VB.Timer", "Timer1", Me)
'时间设置
Timer1.Interval = 1
Timer1.Enabled = True
If Dir(App.Path & "\Log.txt") <> "" Then
Open App.Path & "\Log.txt" For Input As #1
Dim s As String
Input #1, s
Text1.Text = s
Close #1
End If
End Sub
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type POINTAPI '定义点(Point)结构
x As Long '点在X坐标(横坐标)上的坐标值
y As Long '点在Y坐标(纵坐标)上的坐标值
End Type
Dim WithEvents Timer1 As Timer ' 这里定义钩住事件
Dim MousePoint As POINTAPI
Private Sub Form_Load()
'创建一个计时器
Set Timer1 = Form1.Controls.Add("VB.Timer", "Timer1", Me)
'时间设置
Timer1.Interval = 1
Timer1.Enabled = True
If Dir(App.Path & "\Log.txt") <> "" Then
Open App.Path & "\Log.txt" For Input As #1
Dim s As String
Input #1, s
Text1.Text = s
Close #1
End If
End Sub
2013-11-09
展开全部
完整代码如下,请在窗体上添加一个Text控件测试:
Private Sub Form_Load()
Dim SaveTXT As String
SaveTXT = GetSetting("VB", "MYAPP", "SaveTXT")
If SaveTXT <> "" Then
Text1.Text = SaveTXT
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting "VB", "MYAPP", "SaveTXT", Text1.Text
End Sub
Private Sub Form_Load()
Dim SaveTXT As String
SaveTXT = GetSetting("VB", "MYAPP", "SaveTXT")
If SaveTXT <> "" Then
Text1.Text = SaveTXT
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting "VB", "MYAPP", "SaveTXT", Text1.Text
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-11-09
展开全部
可以将修改后的内容保存到文本文件或数据库。下次启动程序时从文本文件或数据库中取出来
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询