| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 540 人关注过本帖
标题:再看一个小程序,怎么病的这么历害?
取消只看楼主 加入收藏
学习VB
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-1-30
收藏
 问题点数:0 回复次数:1 
再看一个小程序,怎么病的这么历害?

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
学习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
快速回复:再看一个小程序,怎么病的这么历害?
数据加载中...
 
   



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

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