Date: 02-16-2022
Return to Index
created by gbSnippets
'Compiler Comments:
'This code is written to compile in PBWin10. To compile in PBWin9, split pt
'into pt.x and pt.y as arguments wherever the ChildWindowFromPoint() API is used.
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_TextBox = 500
%IDC_Label = 501
Global hDlg,hTextBox,hLabel As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,150,100, %WS_OverlappedWindow To hDlg
Control Add TextBox, hDlg, %IDC_TextBox,"Push", 10,10,100,20
Control Handle hDlg, %IDC_TextBox To hTextBox
Control Add Label, hDlg, %IDC_Label,"Push", 10,50,100,20, %WS_Border
Control Handle hDlg, %IDC_Label To hLabel
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local pt As Point
Select Case Cb.Msg
Case %WM_SetCursor
GetCursorPos pt 'pt has xy screen coordinates
ScreenToClient hDlg, pt 'pt now has dialog client coordinates
Select Case ChildWindowFromPoint(hDlg,pt) 'pt for PBWin10
Case hTextBox
MousePtr 1 'arrow
Case hLabel
MousePtr 11 'hourglass
Case Else
MousePtr 1 'arrow
End Select
Function = 1
End Select
End Function
'gbs_01044
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm