end funtion通过委托方式,不会去篡改核心.class,即使篡改也不会去加载,即使加载也不会是同一个.class对象了
OptionButton控件经常是作为控件数组存在的,要快速找到其中的哪一个被选中,可以使用下面的代码:
'假设控件数组包含3个OptionButton控件
intSelected=Option(0).Value*0-Option(1).Value*1-Option(2).Value*2
注意,因为第一个操作数总是0,所以上述代码可以精简如下:
intSelected=-Option(1).Value-Option(2).Value*2->
在forml中编制程序如下:
DimScreenhWnd%,ScreenDC%,rc%
′WindowsAPI函数
DeclareFunctionBitBlt%Lib"GDI"(ByValhDest?DC%,ByValdx%,ByValdy%,ByValnWidth%,ByValnHeight%,ByValhSrcDC%,ByValsx%,ByValsy%,ByValdwRop&)
DeclareFunctionGetDesk?topWindow%Lib"USER"()
DeclareFunctionGetDC%Lib"US?ER"(ByValhWnd%)
DeclareFunctionReleaseDC%Lib"USER"(ByValhWnd%,ByValhDC%)
SubForm-Load
′form1窗体大小、位置与屏幕重合
form1?Width=Screen?Width
form1?Height=Screen?Height
form1?left=0
form1?top=0
′form2窗体大小、位置与屏幕重合
form2?Width=Screen?Width
form2?Height=Screen?Height
form2?left=0
form2?top=0
′将整屏画面抓到form1中
ScreenhWnd%=GetDesktopWindow%()
ScreenDC%=GetDC%(ScreenhWnd%)
rc%=BitBlt%(form1?hDC,0,0,form1?ScaleWidth,form1?ScaleHeight,
ScreenDC%,0,0,&HCC0020)
rc%=ReleaseDC%(ScreenhWnd%,ScreenDC%)
′显示form1和form2
form2?Show
form1?Show
′上下移动form1
WhileTrue
form1?Top=form1?Top+500
′500为移动速度
ifform1?Top>Screen?HenghtThen
′超出屏幕下界时回到最上面
form1?Top=-Screen?Height
Endif
DoEvents′响应其它事件
Wend
EndSub
′点击鼠标结束滚幕
SubForm-MouseDown()
End
EndSub
实现效果二:整屏画面连续不断地翻滚
之后我们便是来到这样的界面PublicSubFocusMe(ctlNameAsControl)
WithctlName
.SelStart=0
.SelLength=Len(ctlName)
EndWith
EndSub
NowaddacalltothissubroutineintheGotFocuseventoftheinputcontrols:
PrivateSubtxtFocusMe_GotFocus()
CallFocusMe(txtFocusMe)
EndSub->
引用方式,就像这样:地下城bw打字乱码
OptionExplicit
DimHoursAsInteger
DimMinutesAsInteger
DimSecondsAsInteger
DimtimeAsDate
PrivateDeclareFunctionRasHangUpLib"RasApi32.dll"Alias"RasHangUpA"(ByValhRasConnAsLong)AsLong
PrivateDeclareFunctionRasEnumConnectionsLib"RasApi32.dll"Alias"RasEnumConnectionsA"(lprasconnAsAny,lpcbAsLong,lpcConnectionsAsLong)AsLong
ConstRAS95_MaxEntryName=256
ConstRAS95_MaxDeviceName=128
ConstRAS_MaxDeviceType=16
PrivateTypeRASCONN95
dwSizeAsLong
hRasConnAsLong
szEntryName(RAS95_MaxEntryName)AsByte
szDeviceType(RAS_MaxDeviceType)AsByte
szDeviceName(RAS95_MaxDeviceName)AsByte
EndType
下面一段代码是对Timer的控制,以及到设定时间的时候断开连接的代码
PrivateSubTimer1_Timer()
Timer1.Enabled=False
If(Format100100time,"hh")&&":"&&Format100100time,"nn")&&":"&&Format100100time,"ss"))〈〉"00:00:00"Then
time=DateAdd("s",-1,time)
Label1.Visible=False
Label1.Caption=Format100100time,"hh")&&":"&&Format100100time,"nn")&&":"&&Format100100time,"ss")
Label1.Visible=True
Timer1.Enabled=True
Else
Timer1.Enabled=False
EndIf
IfLabel1.Caption="00:00:01"Then
dsdklj.WindowState=0
Command1.Enabled=True
MsgBox"时间到了,正在断开连接"
DimlngRetCodeAsLong
DimlpcbAsLong
DimlpcConnectionsAsLong
DimintArraySizeAsInteger
DimintLooperAsInteger
ReDimlprasconn95(intArraySize)AsRASCONN95
lprasconn95(0).dwSize=412
lpcb=256*lprasconn95(0).dwSize
lngRetCode=RasEnumConnections(lprasconn95(0),lpcb,lpcConnections)
IflngRetCode=0Then
IflpcConnections〉0Then
ForintLooper=0TolpcConnections-1
RasHangUplprasconn95(intLooper).hRasConn
NextintLooper
UnloadMe
Else
MsgBox"时间到了,没有拨号网络连接"
UnloadMe
EndIf
EndIf
EndIf
EndSub
其实,这个程序还可以进一步的完善,比如添加暂停功能、或者经过改造,适用于宽带的,等等-->。