读书人

下面的vb如何改成vb.net,哪位高手给改

发布时间: 2012-04-12 15:46:35 作者: rapoo

下面的vb怎么改成vb.net,谁给改一下。偶是菜鸟学习中
Option Explicit
Dim WindowTop, WindowLeft

Function WindowStyle()
Call sta
End Function

Private Sub Form_Load()
lockform Me
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lMsg As Single
lMsg = X / Screen.TwipsPerPixelX
Select Case lMsg
Case WM_LBUTTONDBLCLK '双击左键显示窗体,要改成其他的看模块里的定义
ShowWindow Me.hwnd, SW_RESTORE
Me.Top = WindowTop
Me.Left = WindowLeft
'Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
Me.SetFocus
End Select
End Sub
Private Sub Form_Resize()
WindowTop = Me.Top
WindowLeft = Me.Left
If Me.WindowState = 1 Then
WindowStyle
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'退出程序时删除托盘图标
Call clicc3
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unlockform
Call clicc3
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub
Private Sub Image1_Click()
Call clicc2
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture(App.Path & "\anniu\kq-ax.gif")
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture(App.Path & "\anniu\kq-tq.gif")
End Sub
Private Sub Image2_Click()
Call clicc
End Sub
Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.Picture = LoadPicture(App.Path & "\anniu\dk-ax.gif")
End Sub
Private Sub Image2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.Picture = LoadPicture(App.Path & "\anniu\dk-tq.gif")
End Sub
Private Sub Image3_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
End Sub



Private Sub Image3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.Picture = LoadPicture(App.Path & "\anniu\tc-ax.gif")
End Sub
Private Sub Image3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.Picture = LoadPicture(App.Path & "\anniu\tc-tq.gif")
End Sub

'--------------------------------FORM主窗体源码-------------------------------------------------





Option Explicit
Private Declare Function RasHangUp Lib "RasApi32.DLL" Alias "RasHangUpA" (ByVal hRasConn As Long) As Long
Private Declare Function RasEnumConnections Lib "RasApi32.DLL" Alias "RasEnumConnectionsA" (lprasconn As Any, lpcb As Long, lpcConnections As Long) As Long
Const RAS95_MaxEntryName = 256
Const RAS95_MaxDeviceName = 128
Const RAS_MaxDeviceType = 16
Private Type RASCONN95
'set dwsize to 412
dwSize As Long
hRasConn As Long
szEntryName(RAS95_MaxEntryName) As Byte
szDeviceType(RAS_MaxDeviceType) As Byte
szDeviceName(RAS95_MaxDeviceName) As Byte
End Type
Public Function clicc()
Dim lngRetCode As Long
Dim lpcb As Long
Dim lpcConnections As Long
Dim intArraySize As Integer
Dim intLooper As Integer
ReDim lprasconn95(intArraySize) As RASCONN95
lprasconn95(0).dwSize = 412
lpcb = 256 * lprasconn95(0).dwSize
lngRetCode = RasEnumConnections(lprasconn95(0), lpcb, lpcConnections)
If lngRetCode = 0 Then
If lpcConnections > 0 Then
For intLooper = 0 To lpcConnections - 1
RasHangUp lprasconn95(intLooper).hRasConn
Next intLooper
Form1.List1.AddItem (Str(Time) + ":正在886520专用网络上注销您的计算机...")
Form1.List1.AddItem (Str(Time) + ":成功断开886520加速系统!")
Form1.List1.AddItem ("---------------------886520-----------------------")


Form1.List1.ForeColor = vbRed
Else
MsgBox "您还未开启网络加速,无法断开!", vbInformation
End If
End If
End Function
Public Function clicc1()
Dim lngRetCode As Long
Dim lpcb As Long
Dim lpcConnections As Long
Dim intArraySize As Integer
Dim intLooper As Integer
ReDim lprasconn95(intArraySize) As RASCONN95
lprasconn95(0).dwSize = 412
lpcb = 256 * lprasconn95(0).dwSize
lngRetCode = RasEnumConnections(lprasconn95(0), lpcb, lpcConnections)
If lngRetCode = 0 Then
If lpcConnections > 0 Then
For intLooper = 0 To lpcConnections - 1
RasHangUp lprasconn95(intLooper).hRasConn
Next intLooper
MsgBox "程序正确初始化"
Else
MsgBox "程序正确初始化"
End If
End If
End Function

Public Function clicc2()
Dim lngRetCode As Long
Dim lpcb As Long
Dim lpcConnections As Long
Dim intArraySize As Integer
Dim intLooper As Integer
ReDim lprasconn95(intArraySize) As RASCONN95
lprasconn95(0).dwSize = 412
lpcb = 256 * lprasconn95(0).dwSize
lngRetCode = RasEnumConnections(lprasconn95(0), lpcb, lpcConnections)
If lngRetCode = 0 Then
If lpcConnections > 0 Then
MsgBox "网络加速已经开启"
Else
Call Formstar
End If
End If
End Function
Public Function unico()
'Dim s, ss
' s = Form1.Inet1.OpenURL("http://vpn.886520.com/clientip.jsp")
' ss = Form1.Inet1.OpenURL("http://vpn.886520.com/ip.jsp")
' If InStr(s, ss) > 0 Then
'Else
'MsgBox "您没有获得886520加速器的使用权!"
'End
'End If
End Function

Public Function clicc3()
Dim lngRetCode As Long
Dim lpcb As Long
Dim lpcConnections As Long
Dim intArraySize As Integer
Dim intLooper As Integer
ReDim lprasconn95(intArraySize) As RASCONN95
lprasconn95(0).dwSize = 412
lpcb = 256 * lprasconn95(0).dwSize
lngRetCode = RasEnumConnections(lprasconn95(0), lpcb, lpcConnections)
If lngRetCode = 0 Then
If lpcConnections > 0 Then
For intLooper = 0 To lpcConnections - 1
RasHangUp lprasconn95(intLooper).hRasConn
Next intLooper
Form1.List1.AddItem (Str(Time) + ":正在886520专用网络上注销您的计算机...")
Form1.List1.AddItem (Str(Time) + ":成功断开886520加速系统!")
Form1.List1.AddItem ("---------------------886520-----------------------")
Form1.List1.ForeColor = vbRed
Else
End If
End If
End Function

'--------------------------------拨号信息反馈模块-------------------------------------------------

[解决办法]
这个代码可完全用vs2009转为vb.net。可能会报一些错。只是那几个API找到对应的就好了。
就是几个常用的钩子函数。

读书人网 >VB Dotnet

热点推荐