★★★敬請留意★★★:和微軟一模一樣的記事本的原始碼(3) (轉)

worldblog發表於2007-12-07
★★★敬請留意★★★:和微軟一模一樣的記事本的原始碼(3) (轉)[@more@]

 

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINECOUNT = &HBA
'Private Const EM_SCROLL = &HB5
'Private Const SB_LINEDOWN = 1
Dim Sline As Integer
Dim Lcount As Integer


 

'End Sub

Private Sub Command1_Click()
  Dim i As Integer
  Form1.Text1.SelStart = 0
  Form1.Text1.SetFocus
  Sline = SendMessage(Form1.Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
  Lcount = CInt(Text1.Text)
  If Lcount <= Sline Then
 
  For i = 1 To Lcount - 1
  SendKeys "{DOWN}"
  Next i
  Form3.H
  Else
  MsgBox "line over range"
 
  End If
  'Unload Form3
 ' Form3.Text1.SetFocus
End Sub


Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Form_Load
End Sub

Private Sub Form_Load()

Text1.SelStart = 0
If Text1.Text = "" Then
  Text1.Text = 0
Else
  Text1.Text = Lcount
End If


Text1.SelLength = Len(Lcount)
Form3.Show
Form3.Text1.SetFocus
End Sub

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-989357/,如需轉載,請註明出處,否則將追究法律責任。

相關文章