标题:再看一个小程序,怎么病的这么历害?
只看楼主
学习VB
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-1-30
 问题点数:0 回复次数:2 
再看一个小程序,怎么病的这么历害?

Option Base 1
Option Explicit
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_GETLINE = &HC4
Private Const EM_GETLINECOUNT = &HBA
Private Sub Command1_Click()
Text1.Text = Clipboard.GetText(1)
Dim lngLineIndex As Long
Dim lngLineCount As Long
lngLineCount = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
Text2.Text = lngLineCount
Dim st1(255) As String
Dim i, j As Integer
Dim temp As String
For i = 1 To lngLineCount
st1(i) = Split(Text1.Text, ",", -1)
Next i
For i = 1 To lngLineCount - 1
For j = i + 1 To lngLineCount
If Len(st1(i)) > Len(st1(j)) Then
temp = st1(i)
st1(i) = st1(j)
st1(j) = temp
End If
Next j
Next i
For i = 1 To lngLineCount

Text1.Text = Text1.Text & st1(i) & vbCrLf
Next i

End Sub

搜索更多相关主题的帖子: Long Private ByVal 
2007-02-01 16:39
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
得分:0 

不知道你想说什么.


我的msn: myfend@
2007-02-01 17:09
学习VB
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-1-30
得分:0 

如果粘贴板上的内容是:
2-3=04 08 09 12,
2-3=01 06 10 11,
2-3=03 04 07,
2-3=01 07 11 12,
2-3=01 08 10,
2-3=01 05 11,
2-3=01 02 12,
2-3=02 08 12 13,
粘贴到TEXT1中后,变为如下形式
2-3=03 04 07,
2-3=01 08 10,
2-3=01 05 11,
2-3=01 02 12,
2-3=04 08 09 12,
2-3=01 06 10 11,
2-3=02 08 12 13,
2-3=01 07 11 12
也就是按码数多少做了一个排序

2007-02-01 17:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-119179-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.293849 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved