Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
%IDC_TextBox = 500
%IDC_Button = 501
Global hDlg,OrigTBProc As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Cursor Test",300,300,200,75, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_BUtton,"Test", 50,10,100,20
Control Add TextBox, hDlg, %IDC_TextBox,"Test", 50,40,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
OrigTBProc = SetWindowLong(GetDlgItem(hDlg,%IDC_TextBox), %GWL_WndProc, CodePtr(NewTBProc))
Control Set Focus hDlg, %IDC_TextBox
Case %WM_Destroy
SetWindowLong GetDlgItem(hDlg,%IDC_TextBox), %GWL_WNDPROC, OrigTBProc
End Select
End Function
Function NewTBProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case Msg
Case %WM_SetFocus
CallWindowProc OrigTBProc, hWnd, %WM_SetFocus, wParam, lParam
DestroyCaret
Function = %False
Exit Function
End Select
Function = CallWindowProc(OrigTBProc, hWnd, Msg, wParam, lParam)
End Function
'gbs_01233
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm