前段时间见过VB的变态应用.
我想说二句:有人说,我这个应该放在数据结构与算法版块里.而且我也发现了,论坛里面大多数的人.都是用VB做些系统底层的事.
不是我说一句打击的话:用VB去做系统内核编程,效率是非常之低的.最多使用一些技巧,比如下面的代码示例:[/CODE=VB]
'Changing the Priority Of a Running Process'Changes the priority of a running instance of Notepad.exe from Normal to Above NormalConst ABOVE_NORMAL = 32768
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(ABOVE_NORMAL)
Next
[/CODE]
而我更偏向于,用VB设计一些算法去解决一些问题:
比如:四则运算 算法 采用栈
围棋死活 算法 采用图
时间事务处理(PM事务跟进) 算法 采用队 我和分不多,可用分怎么这么难得.(这么久了才有600多分的可用分)
希望各位将VB与算法相结合,弄出一些比较实用的代码出来.与大家共享.
我想说二句:有人说,我这个应该放在数据结构与算法版块里.而且我也发现了,论坛里面大多数的人.都是用VB做些系统底层的事.
不是我说一句打击的话:用VB去做系统内核编程,效率是非常之低的.最多使用一些技巧,比如下面的代码示例:[/CODE=VB]
'Changing the Priority Of a Running Process'Changes the priority of a running instance of Notepad.exe from Normal to Above NormalConst ABOVE_NORMAL = 32768
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(ABOVE_NORMAL)
Next
[/CODE]
而我更偏向于,用VB设计一些算法去解决一些问题:
比如:四则运算 算法 采用栈
围棋死活 算法 采用图
时间事务处理(PM事务跟进) 算法 采用队 我和分不多,可用分怎么这么难得.(这么久了才有600多分的可用分)
希望各位将VB与算法相结合,弄出一些比较实用的代码出来.与大家共享.
因为爱好,去看了一些密码学与数据结构算法方面的书。
对VB里面的一些方法和属性都不是很了解。
不知道有个Split。自己去做一个方法。
请看。当然还有好多现在都不知道。'*************************************
'目的:按某个分隔符将文本分离成数组
'输入: Text 要分离的字符串
' Sige 分隔符
' Arr 数组 分离后的字符以此数组返回
'返回: 成功 True
' 失败 False
'*************************************Public Function strApart(ByVal Text As String, ByVal Sige As String, Arr) As Boolean
On Error GoTo strApartErr
Dim strBegin
Dim Count As Long
strApart = True
strBegin = 1
Count = 0
For i = 1 To Len(Text)
If Mid(Text, i, Len(Sige)) = Sige Then
Count = Count + 1
Arr(Count) = Mid(Text, strBegin, i - strBegin)
strBegin = i + 1
End If
Next
If Len(Text) <> strBegin - 1 Then
Count = Count + 1
Arr(Count) = Mid(Text, strBegin)
End If
Arr(0) = Count
Exit Function
strApartErr:
Err.Clear
strApart = False
End Function
还有不知道leftB MidB之类的,
如果有汉字,都先转换
怎么转换,读取其ASC。进行判断。小于256是单个字符,大于256的,都按汉字处理,
'Changing the Priority Of a Running Process 'Changes the priority of a running instance of Notepad.exe from Normal to Above Normal Const ABOVE_NORMAL = 32768
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(ABOVE_NORMAL)
Next
[/CODE] 远程控制的代码!!!
我上个星期才知道split
inStr刚刚才知道.
包括在四则运算里面给出的算法中.里面对字符串进行处理的一些方法,我还有一些现在都还不懂.
变态啥啊
人家整个ERP都是用VB写的
这就可以了
要不就写GZIP 里的LZ77
勿以VB而为之,勿以VB而不为。
接分。