VB高级编程100例

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

VB6.0/C/SB/SB/SC/SVBVBClientsystryClientWinSocktcpClientTCPIPPrivateSubcmdConnect_Click()IfLen(Text1.Text)=0AndLen(Text2.Text)=0ThenMsgBox(IP)ExitSubElseIfLen(Text1.Text)0ThentcpClient.RemoteHost=Text1.TextElsetcpClient.RemoteHost=Text2.TextEndIfEndIftcpClient.ConnectTimer1.Enabled=TrueEndSubDataArrivalsystryWinSocktcpServerTCPForm_LoadPrivateSubForm_Load()tcpServer.LocalPort=1999tcpServer.ListenEndSubConnectionRequestPrivateSubtcpServer_ConnectionRequest(ByValrequestIDAsLong)IftcpServer.StatesckClosedThentcpServer.Close‘StateEndIf'tcpServer.AcceptrequestIDEndSubConnectionRequestDataArrivalTreeViewDataArrivalPrivateSubtcpServer_DataArrival(ByValbytesTotalAsLong)DimstrDataAsStringDimiAsLongDimmKeyAsStringtcpServer.GetDatastrData'strDataFori=1ToLen(strData)'strDataIfMid(strData,i,1)=@ThenmKey=Left(strData,i-1)'IDmKey'strDatastrData=Right(strData,Len(strData)-i)ExitForEndIfNextiSelectCaseVal(mKey)Case1‘Case2Case3Case4Case5Case6Case7Case8EndSelectEndSubtcpClient.SendDataID“@”tcpServer_ClosePrivateSubtcpServer_Close()tcpServer.ClosetcpServer.ListenEndSub____________________________________________________________________________________________________________________________________________________________________________________________________________________VBSQLServer2000Transact-SQLDOSBATBATBATTransact-SQLBAT1Transact-SQLCREATEPROCEDURECREATEPROC[EDURE]procedure_name[;number][{@parameterdata_type}[VARYING][=default][OUTPUT]]],…n][WITH{RECOMPILE|ENCRYPTION|RECOMPILE,ENCRYPTION}][FORREPLICATION]ASsql_statement[…n]CREATEPROCEDURE[]{}[…n]|CREATEPROCEDURECREATEPROCprocedure_name[number]number@parameterdata_typeTransact-SQL@Transact-SQLcursorVARYINGOUTPUTVARYINGOUTPUTdefaultRECOMPILEENCRYPTIONFORREPLICATIONRECOMPILEASsql-statement[…n]Transact-SQL2Transact-SQLTransact-SQLSQLServer2000VBVB6.0VBADOVBSQLServer20001ADOADOADODataVBDataADODataMicrosoftActiveXDataObjectsADOADOData··SQL··2ADOMicrosoftADODataControl6.0(OLEDB)ADOADO1)ADODCADODCProvider=SQLOLEDB.1;PersistSecurityInfo=False;UserID=sa;InitialCatalog=Science_File;DataSource=Data_ServersaScience_FileData_ServerdimodbcstrasString,adoconAsNewADODB.Connectionodbcstr=Provider=SQLOLEDB.1;PersistSecurityInfo=False;UserID=sa;InitialCatalog=Science_File;DataSource=Data_Serveradocon.Openodbcstr'2)DimadoasADODCado.ConnectionString=Provider=SQLOLEDB.1;Password=&User_Pwd&;PersistSecurityInfo=True;UserID=&User_Name&;InitialCatalog=&Data_Name&;DataSource=&server_nameUser-PwdUser_NameData_Nameserver_name3doc_ProcName1)1ADODBConnection2ActiveConnectionCommandConnection3CommandTextCommand4CommandTypeCommandCommandTypeadCmdStoredProc5CommandParametersParameters006EexecuteCommandTextdoc_ProcNameDimstrSAsString'DimadoconnAsNewADODB.Connection'ConnectionDimadocommAsNewADODB.Command'CommandDimReturnValueAsInteger'adoconn.ConnectionString=Adodc1.ConnectionString'Adodc1ADOadoconn.OpenSetadocomm.ActiveConnection=adoconn'CommandConnectionadocomm.CommandText=doc_ProcName'Commandadocomm.CommandType=adCmdStoredProc'CommandTextCommandadocomm.Parameters(1)=1adocomm.Parameters(2)=OutputParameters'OutputParametersadocomm.ExecuteReturnValue=adocomm.Parameters(0)'0strS=adocomm.Parameters(2)'strS2)CreateParameterParameterSetparameter=command.CreateParameter(Name,Type,Direction,Size,Value)·NameParameter·Type____________________________________________________________________________________________________________________________________________________________________________________________________________________VB61VB6Form1ShowInTaskBarFalse2--“”Module1,Module1.bas3Module1OptionExplicitPublicConstMAX_TOOLTIPAsInteger=64PublicConstNIF_ICON=&H2PublicConstNIF_MESSAGE=&H1PublicConstNIF_TIP=&H4PublicConstNIM_ADD=&H0PublicConstNIM_DELETE=&H2PublicConstWM_MOUSEMOVE=&H200PublicConstWM_LBUTTONDOWN=&H201PublicConstWM_LBUTTONUP=&H202PublicConstWM_LBUTTONDBLCLK=&H203PublicConstWM_RBUTTONDOWN=&H204PublicConstWM_RBUTTONUP=&H205PublicConstWM_RBUTTONDBLCLK=&H206PublicConstSW_RESTORE=9PublicConstSW_HIDE=0PublicnfIconDataAsNOTIFYICONDATAPublicTypeNOTIFYICONDATAcbSizeAsLonghWndAsLonguIDAsLonguFlagsAsLonguCallbackMessageAsLonghIconAsLongszTipAsString*MAX_TOOLTIPEndTypePublicDeclareFunctionShowWindowLibuser32(ByValhWndAsLong,ByValnCmdShowAsLong)AsLongPublicDeclareFunctionShell_NotifyIconLibshell32.dllAliasShell_NotifyIconA(ByValdwMessageAsLong,lpDataAsNOTIFYICONDATA)AsLong4Form1LoadPrivateSubForm_Load()'SystemTray====================================SystemTrayBeginWithnfIconData.hWnd=Me.hWnd.uID=Me.Icon.uFlags=NIF_ICONOrNIF_MESSAGEOrNIF_TIP.uCallbackMessage=WM_MOUSEMOVE.hIcon=Me.Icon.Handle'Tip.szTip=App.Title+(&App.Major&.&App.Minor&.&App.Revision&)&vbNullChar.cbSize=Len(nfIconData)EndWithCallShell_NotifyIcon(NIM_ADD,nfIconData)'=============================================================SystemTrayEndMe.HideEndSub5Form1QueryUnloadPrivateSubForm_QueryUnload(CancelAsInteger,UnloadModeAsInteger)CallShell_NotifyIcon(NIM_DELETE,nfIconData)EndSub6Form1MouseMovePrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,

1 / 88
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功