Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Register OCX within VB

Ok SO i need to register an OCX in Visual basic. The fine is called "MYOCX.ocx" its located in the System Folder of the computer. my problem is that the system folder can change. For example in Win2000 C:\Winnt\System32, and in WinXP C:\windows\system32.

any ideas how i can do it.
0
MICS
Asked:
MICS
1 Solution
 
EDDYKTCommented:
use environ("windir") & "\system32"
0
 
Tommy KinardCommented:
Refer to GetWindowsSysDir in the setup program that comes with VB. It is located in the C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\ directory. This is VB 6. The code will retrieve the system directory for versions of windows.
0
 
EDDYKTCommented:
use environ("windir") & "\system32"
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kokolokoCommented:
Use the following API:

Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal parDirectory As String, ByVal parSize As Long) As Long
0
 
MICSAuthor Commented:
opps...

That didn't answer it fully.

that gives me the system folder path.

but How do i register it?
0
 
Tommy KinardCommented:
Once you have the system directory, use the shell command to call regsvr32.exe using the command line switches /s {for being silent and the user doesnt know} /i {to install and pass command line to the dll} and the dll name.
so an example would be - the backslash is not required if you have already picked it up-
RetVal = Shell(WinSysDir & "\" & "regsvr32 /s /i " & "myocx.dll", vbHide)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now