vb6 中如何做个没有窗口的应用程序.运行时什么情况都没有,但是程序已经运行了
- 提问者网友:城市野鹿
- 2021-02-28 03:25
- 五星知识达人网友:白昼之月
- 2021-02-28 04:12
Me.Hide
End Sub
- 1楼网友:大漠
- 2021-02-28 04:40
获取窗口句柄,然后getwindowrect就ok了 返回的rect是一个结构体,分别是:bottom,left,top,right
'用api解决你提出的问题 '该例子需要form上和一个textbox(text1)和 '一个commandbutton(command1) '使用时,在text1中输入桌面上任何一个窗体的标题,按command1后, '会在窗口的左上角显示指定窗体的高度、宽度、四个角的坐标 private declare function findwindow lib "user32 " alias "findwindowa " (byval lpclassname as string, byval lpwindowname as string) as long private type rect left as long top as long right as long bottom as long end type private declare function getwindowrect lib "user32 " (byval hwnd as long, lprect as rect) as long private sub command1_click() me.cls dim frmhwnd as long dim frmrect as rect dim frmheight as long dim frmwidth as long frmhwnd = findwindow(vbnullstring, text1.text) if frmhwnd = 0 then msgbox "窗体不存在 " else getwindowrect frmhwnd, frmrect frmheight = frmrect.bottom - frmrect.top frmwidth = frmrect.right - frmrect.left me.print "width= " & frmwidth me.print "height= " & frmheight me.print "lefttop( " & frmrect.left & ", " & frmrect.top & ") " me.print "righttop( " & frmrect.right & ", " & frmrect.top & ") " me.print "rightbottom( " & frmrect.right & ", " & frmrect.bottom & ") " me.print "leftbottom( " & frmrect.left & ", " & frmrect.bottom & ") " end if end sub