一个EXE文件有一个窗体旁边站了一个TXT文件,每当TXT文件中写一句
"游戏" c:\1\游戏.link
EXE中的窗体就多了个"游戏"的按钮,并在点击这个按钮时启动 游戏.link ,从而达到启动游戏的目的
"游戏" c:\1\游戏.link
EXE中的窗体就多了个"游戏"的按钮,并在点击这个按钮时启动 游戏.link ,从而达到启动游戏的目的
解决方案 »
- VB SQL3.5数据库修改
- 求助 vb 数据库路径问题
- 对已查询出的记录集如何排列?????????急急急
- 如何开发一个网络版的软件(局域网/互连网版)
- 同一程序,在其它机子上运行都没问题,只在某一台机子上提示下标越界,大家有碰到过这种问题吗?
- 帮忙看看,用什么软件好啊!!
- 用VB+SQL server2000做的企业人事信息管理系统 有偿求助
- 请教一个Tabstrip的问题
- 求助,调用dll出现如下错误:“实时错误:‘48’,找不到文件:winacq.dll"
- 这是什么原因?关于DBGrid
- 来看看怎么才能把按钮排列正常5555
- 请问各位从哪里能找到VB高手?或是WINDOWS编程高手?或API高手?
用下面声明的api
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const SW_HIDE = 0
Public Const SW_NORMAL = 1
Public Const SW_MAX = 10
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWDEFAULT = 10
Dim filename As String
Private Sub Command1_Click()
Shell filename
End SubPrivate Sub Form_Load()
Dim sFileName As String
Dim strTemp As String
sFileName = App.Path & "\1.txt"
Open sFileName For Input As #1
Line Input #1, strTemp
Close #1
If Left(strTemp, 2) = "游戏" Then
Command1.Visible = True
filename = Mid(strTemp, 3)
End If
End Sub
你再根据你的情况修改下上面的东东,大概能满足你的要求了
Shell Command1(Index).Tag, vbNormalFocus
End SubPrivate Sub Form_Load()
Command1(0).Left = 0
Dim str1, str2, s
Open "c:\1.txt" For Input As 1
While Not EOF(1)
Input #1, str1, str2
s = s + 1
Load Command1(s)
Command1(s).Caption = str1
Command1(s).Tag = str2
Command1(s).Visible = True
Command1(s).Left = Command1(s - 1).Left + Command1(s).Width + 100
Wend
Close
End Sub1.txt 内容格式如:PhotoShop CS,"D:\Program Files\PhotoShop CS\Photoshop.exe"
......可以加载多个游戏命令按钮
Shell Command1(Index).Tag, vbNormalFocus
End SubPrivate Sub Form_Resize()
Command1(0).Left = -Command1(0).Width - 100
Dim str1, str2, s
Open "c:\1.txt" For Input As 1
While Not EOF(1)
Input #1, str1, str2
s = s + 1
Load Command1(s)
Command1(s).Caption = str1
Command1(s).Tag = str2
Command1(s).Visible = True
Command1(s).Left = Command1(s - 1).Left + Command1(s).Width + 100
Command1(s).Top = Command1(s - 1).Top
If (s Mod 3 = 1) And s > 3 Then
Command1(s).Left = 0
Command1(s).Top = Command1(s).Top + Command1(s).Height + 100
End If
Wend
CloseEnd Sub