Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
#Include "Win32API.inc"
#Resource RcData, cursor, "erase.cur"
Global hDlg,hCursor As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,200,200, %WS_OverlappedWindow To hDlg
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local pt As Point, rc As Rect
Select Case Cb.Msg
Case %WM_InitDialog
hCursor = LoadOneCursor("cursor")
Case %WM_SetCursor
GetCursorPos(pt) : ScreenToClient(hDlg,pt) : GetClientRect(hDlg,rc)
If PtInRect(rc,pt) Then MousePtr hCursor : Function = 1
End Select
End Function
Function LoadOneCursor(curName$) As Dword
Local CurData$
CurData$ = Resource$(RcData, curName$)
Open "tempcursorfile.cur" For Binary As #1
Put #1, ,Abs CurData$
SetEof #1
Close #1
Function = LoadCursorFromFile ("tempcursorFile.cur")
Kill "tempcursorFile.cur"
End Function
'gbs_01194
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm