在线等!!!!!!!----如何获得计算机名并在textbox中显示?*****每个问题20分

lvenx 2003-12-15 06:51:11
如何获得计算机名并在textbox中显示?

如何设置快捷键?比如按F3

就实现 Text1.SetFocus

每个问题20分 快啊
...全文
29 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mmcgzs 2003-12-16
  • 打赏
  • 举报
回复
如果想真正实现快捷键必须使用子类
使用
registerhotkey
setwindowlong
callwindowproc
等api
xzp1030 2003-12-15
  • 打赏
  • 举报
回复
Option Explicit
'一个text,一个command
Private Sub Command1_Click()
Text1.Text = Environ("ComputerName")
End Sub
SaySorry 2003-12-15
  • 打赏
  • 举报
回复
添加一个不可见菜单项
快捷键给定位 F3
Text1.SetFocus
dreamreality 2003-12-15
  • 打赏
  • 举报
回复
对于那个setfocus的可以放一下label,然后设置快捷键,但有一个前题那就是他的tabindex一定要在textbox的前面,比如说一个是textbox是2那么label一定是1才行的
rainstormmaster 2003-12-15
  • 打赏
  • 举报
回复
Option Explicit

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Dim strString As String
'Create a buffer
strString = String(255, Chr$(0))
'Get the computer name
GetComputerName strString, 255
'remove the unnecessary chr$(0)'s
strString = Left$(strString, InStr(1, strString, Chr$(0)))
'Show the computer name
Text1.Text = strString
End Sub
online 2003-12-15
  • 打赏
  • 举报
回复
Text1.Text = Winsock1.LocalHostName

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧