?
Solved

Register OCX within VB

Posted on 2003-03-14
6
Medium Priority
?
273 Views
Last Modified: 2010-05-01
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
Comment
Question by:MICS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8138791
use environ("windir") & "\system32"
0
 
LVL 14

Accepted Solution

by:
Tommy Kinard earned 200 total points
ID: 8138792
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8138904
use environ("windir") & "\system32"
0
Independent Software Vendors: 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!

 
LVL 3

Expert Comment

by:kokoloko
ID: 8138908
Use the following API:

Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal parDirectory As String, ByVal parSize As Long) As Long
0
 

Author Comment

by:MICS
ID: 8138946
opps...

That didn't answer it fully.

that gives me the system folder path.

but How do i register it?
0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 8139059
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question