如何编写能自动伸缩的窗口?

qujing 2000-06-30 10:54:00
以前我学的是PowerBuilder,现改学VB,对那些API函数不知道怎么用,想知道
getcursor如何获取屏幕上鼠标的坐标。请各位网友帮助,先谢谢了。
...全文
118 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Longe 2000-06-30
  • 打赏
  • 举报
回复
使用windows API函数
Option Explicit

Private Type POINTAPI
X As Long
Y As Long
End Type
Dim p() As POINTAPI

Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

Private Sub form_click()
Dim hRgn As Long
Dim lRes As Long
ReDim p(4) As POINTAPI

With Me
p(0).X = 0
p(0).Y = 0
p(1).X = .ScaleWidth
p(1).Y = 0
p(2).X = .ScaleWidth
p(2).Y = .ScaleHeight
p(3).X = 0
p(3).Y = .ScaleHeight
End With

hRgn = CreatePolygonRgn(p(0), 4, 2)
lRes = SetWindowRgn(Me.hWnd, hRgn, True)
End Sub
Chen_Lin 2000-06-30
  • 打赏
  • 举报
回复
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

liyang 2000-06-30
  • 打赏
  • 举报
回复
应该用GetCursorPos
Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
x As Long
y As Long
End Type

dim blnReturn as boolean
dim CurPos as POINTAPI

blnReturn=GetCursorPos(CurPos)
if blnReturn then
CurPos.x
CurPos.y
end if
qujing 2000-06-30
  • 打赏
  • 举报
回复
谢谢各位网友的热心帮助,可帖子总分只能加到分,只能大家分了,要是哪位朋友觉得不满意,下次再补啦,我刚学,有好多问题要请教大家。再次表示深深的感谢。
chenjun 2000-06-30
  • 打赏
  • 举报
回复
我在VB中文网上找到了一编文章,专门介绍API调用的,你可以自己去找或给我你的E_mail,我给你发一个,我的E_mail是cjwlf@21cn.com

7,763

社区成员

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

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