Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword, hTextBox As Dword, OldProc&
%ID_Control = 500
Function PBMain() As Long
Local Style&
Dialog New Pixels, 0, "Test Code",300,300,200,205, %WS_OverlappedWindow To hDlg
Style& = %WS_TabStop Or %WS_Border Or %ES_Left Or %ES_AutoHScroll Or %ES_MultiLine Or %ES_AutoVScroll Or %ES_WantReturn
Control Add TextBox, hDlg, %ID_Control, "Right-mouse click me!", 15,10,170,50, Style&
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
OldProc& = SetWindowLong(GetDlgItem(hDlg, %ID_Control), %GWL_WndProc, CodePtr(NewProc)) 'subclass
Case %WM_Destroy
SetWindowLong hTextBox, %GWL_WNDPROC, OldProc& 'un-subclass
End Select
End Function
Function NewProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Select Case Msg
Case %WM_Char
If wParam = 13 Then
Dialog Set Text hDlg, Time$
End If
End Select
Function = CallWindowProc(OldProc&, hWnd, Msg, wParam, lParam)
End Function
'gbs_00832
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm