Date: 02-16-2022
Return to Index
created by gbSnippets
'The PowerBASIC MousePTR statement can change the cursor to a preset value
'or to the cursor for which a handle is acquired using the LoadCursor API.
'LoadCursor can get its cursor from pre-defined system cursors or from
'a cursor loaded via a resource file.
'Primary Code:
'1. From a system pre-defined cursor
MousePtr LoadCursor(%NULL, ByVal %IDC_Hand)
'2. From a resource file
Local szCur As Asciiz * 255
szCur = "dragdrop"
MousePtr LoadCursor(GetModuleHandle(EXE.Namex$), szCur)
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Resource "gbedit.pbr"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_SetCursor
' MousePtr 5
' MousePtr LoadCursor(%NULL, ByVal %IDC_Hand)
' SetCursor LoadCursor(%NULL, ByVal %IDC_Hand)
Local szCur As Asciiz * 255
szCur = "dragdrop"
MousePtr LoadCursor(GetModuleHandle(EXE.Namex$), szCur)
Function = 1
End Select
End Function
'gbs_00694
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm