幫忙看一下這一個程式錯在哪裡?
為什麼執行沒有多久就當機?
試了好久都一樣

Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
    y As Long
End Type
Dim MouseXY As POINTAPI
Dim nX As Single, nY As Single
Dim BackX As Single, BackY As Single
Dim SrcDC As Long
Dim ret As Long
Private Sub Form_Load()
Picture1.ScaleMode = 3
Picture1.AutoRedraw = True
Form1.ScaleMode = 3
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
ret = GetCursorPos(MouseXY)
nX = MouseXY.x - 50
nY = MouseXY.y - 50
SrcDC = GetDC(0)
ret = StretchBlt(Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, SrcDC, nX, nY, 100, 100, vbSrcCopy)
Picture1.Refresh
ret = ReleaseDC(0, SrcDC)
End Sub
創作者介紹
創作者 vbqa 的頭像
vbqa

小吳 VBQA 程式設計討論

vbqa 發表在 痞客邦 留言(9) 人氣()