tags:

views:

53

answers:

2

I have to use a ocx in .Net application. In the toolbox, i right clicked and from com tab added the ocx. Now the ocx appeared in the toolbox and added the control to the form. When i execute the application got this error 'Could not load file or assembly 'Interop.WINCMP3XLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'. Can you help me what else needs to be done.

I also used the Aximp tool to convert the wrapper dll for the ocx. Now when I used this dll, i could not access the method in the dll.

Please can anyone tell me the best way for using ocx in .Net application.

Thanks

A: 

Have you tried to register the OCX within windows?

You can do that running: regsvr32 "c:\myocx.ocx", replacing with your OCX file. This can be used too with DLL files.

RHaguiuda
+1  A: 

Usually what you do is:

  1. Register the control like RHaguiuda said - however, I've experienced that this is best placed in C:\Windows\System32
  2. Then, add the COM control to the toolbox
  3. Add it to the form from the toolbox

Now two references will appear for your project - of course the respective DLLs must then also be present in the output folder for your project. This, however, will be done automatically. When compiling the project.

I've never had to use aximp...

Please note that when you use a 64-bit operating system, you have to

  1. Place the OCX in C:\Windows\SysWOW64 and also call regsrv32.exe there
  2. Change your project to compile for 32-bit only in the project settings

This works for me - I hope it will work for you too :-)

Thorsten Dittmar