In VB, "Green" software (1) Launch VB6.0, load "Visual Basic 6 Resource Editor" (2) in VISUAL BASIC 6 Resource Editor (2) In the VB Resource Editor window, click "Add Custom Information" Increase the Winsock Control (C: /Winddows/System/msWinsck.ocx), double-click the custom resource you just created, pop up the Edit Properties window, defined as follows: Type: "OCX" (you can also use the default "Custom" ) identification number: 101 language: Chinese (China) ⑶ save the resource file, write the following code: Option ExplicitPrivate Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer as String, ByVal nSize as Long) as LongConst MAX_PATH = 260 ' defined sufficiently long string Private Sub Form_Load () Dim TempFile () As ByteDim FileNum As IntegerDim TempDir As StringTempDir = GetWinSysDir 'custom function acquiring system Winddows / system directory TempFile = LoadResData (101, "OCX")' for Load a number of possible types of data from the resource (.res) file, and return a BYTE array filenum = freefileopen tempdir & "/ms" for binary as #filenum 'New file (copy Winsock control to the specified directory) Put # FileNum,, TempFile Close #FileNum 'Shell "regsvr32" & TempDir & "/Mswinsck.ocx", vbNormalFocus' register controls, there are pop-up dialog box Shell "regsvr32" & TempDir & "/Mswinsck.ocx / s", vbNormalFocus' registration Control, no pop-up dialog End Sublic Function getWinsysdir () Defines the function of the directory where Winddows / System is defined DIM S A String, Length As long s = string (max_path, 0) 'assignment length = getSystemDirectory (s, max_path)' s is a acquisition directory, max_path is the length S = Left (s, INSTR (S, CHR (0)) - 1 ) 'Remove excess space getWinsysdir = send function' Supplement: s and max_path value can be casually assigned, ', such as: DIM S AS STRING * 20' Length = GetSystemDirectory (S, 20) Using this method, you can in VB Files embedded in the program