Date: 02-16-2022
Return to Index
created by gbSnippets
http://www.powerbasic.com/support/pbforums/showthread.php?t=4010&highlight=bcaptured+Jules
'Compiler Comments:
'This code was written to compilete in PBWin10. To compile with PBWin9, split pt
'into pt.x and pt.y as arguments in the line where PtinRect is used.
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Static bCaptured As Long
Local rc As RECT, pt As PointAPI
Select Case Cb.Msg
Case %WM_MouseMove
Dialog Set Text hDlg, Time$
If bCaptured = 0 Then SetCapture(hDlg) : bCaptured = 1 'capture on first entry, do once only
If bCaptured = 1 Then
GetCursorPos(pt) : GetWindowRect(hDlg,rc)
If PtInRect(rc,pt) = %FALSE Then
Dialog Set Text hDlg, "Outside!"
ReleaseCapture() : bCaptured = 0
Else
Dialog Set Text hDlg, "Inside!"
End If
End If
Function = 0
End Select
End Function
'gbs_01036
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm