Date: 02-16-2022
Return to Index
created by gbSnippets
'Compiler Comments:
'This code is written to compile with PBWin10. To compile with PBWin9,
'add this line:
#Include "CommCtrl.inc"
'Primary Code:
Local iLineCount&
iLineCount& = SendMessage(hRichEdit, %EM_GetLineCount, 0,0) 'total number of lines in control
'Compilable Example: (Jose Includes)
'This example gets the total number of lines in the control (not the number of lines selected).
#Compiler PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
#Include "RichEdit.inc"
Global hDlg as Dword, hRichEdit as Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,150, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 30,10,140,20
LoadLibrary("riched32.dll") : InitCommonControls
Control Add "RichEdit", hDlg, 500, "",20,40,160,100, 1345393092 'style& is the integer value of common styles
Control Handle hDlg, 500 To hRichEdit : Control Set Text hDlg, 500, "This is sample" + $CrLf + "text for the" + $CrLf + "RichEdit control."
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
Local iLineCount&
iLineCount& = SendMessage(hRichEdit, %EM_GetLineCount, 0,0) 'current line / 1st line of selection
MsgBox "Total Line Count: " + Str$(iLineCount&)
End If
End Function
'gbs_00227
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm