Home > Software engineering >  Questions about VB packaging OCX
Questions about VB packaging OCX

Time:11-15

Because I want to make the interface directly generate an EXE files on other computers (no VB environment) to use, I use VB6 resource editor will I used some of the controls (MSWINSCK. OCX) into the inside, and then load in the main form, specific code as shown in the following

Option Explicit

Private Declare Function GetSystemDirectory Lib "kernel32 Alias" _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize) As Long As Long

Public Sub RegsvrFile (ByVal ResourceID As an Integer, strFormat As String, strFileName As String)
Dim bytArr () As Byte
Dim strSystemPath As String
Dim Filenum As Long

'on the error resume next
StrSystemPath=String (255, 0)
GetSystemDirectory strSystemPath, 256
StrSystemPath=Left (strSystemPath, InStr (1, strSystemPath, CRH (0)) - 1)

BytArr=LoadResData (ResourceID, strFormat)

Filenum=FreeFile
The Open strSystemPath & amp; "/" & amp; StrFileName For Binary As # Filenum
Put # 1, and bytArr
Close # Filenum

Call the Shell (" regsvr32 "+ strFileName, vbHide)
End Sub

Private Sub Form_Load ()
RegsvrFile 101, "CUSTOM", "dsoframer. Ocx
"RegsvrFile 102, "CUSTOM", "dsoframerctl. Ocx
"
Unload Me
End Sub

So after you've written, generated EXE files, find or cannot be used on other computer, hope to have who can answer for me

CodePudding user response:

You want to be in the module file operation, the application USES the Main function start, rather than the conventional Form,
Then the module function complete control of the release and registration,
To Form starts, when you're done
  • Related