Recent

Author Topic: How do I import OCX / ActiveX Control  (Read 51924 times)

Lazarususer6789

  • New Member
  • *
  • Posts: 15
How do I import OCX / ActiveX Control
« on: May 02, 2010, 03:09:01 pm »
I want to know what The Lazarus equivalent of vb6 clicking
Project > components >Browse >"using common dialog to get ocx or dll" >ok >click the new icon on the left draw a box with cursor and Its done
i don't care if i have to get some dll's as long as they not ie dlls
i need it to work on all 32 bit windows os  after windows 95 except windows vista and 7 if your method not work in vista like 99.9% of everything


I want to
.insert an ocx Active X into a form
.edit size with code (if the form resizes the activex will also resize)
.i want to make an exe that looks for an ocx in the same folder insted of the clsid in the registry like in vb where it has this code

classid="CLSID:920DFF5F-2EE6-4867-93A5-7BCF15B0F1C2"
id=Activex2
Filename="Activex1.ocx"
In the vb exe if the ocx is not registered or not there it uses ocx in app.path

So basically i want to use activex in Lazarus the same way i use it in vb5/6
Like this i want to make something like this In Lazarus
_______________
|_Form______|X|
|  _________     |
|  | Active X |   |
|  |   Here    |   |
|  |________|   |
|_____________|

Lazarususer6789

  • New Member
  • *
  • Posts: 15
activex
« Reply #1 on: May 03, 2010, 06:25:39 pm »
OK
« Last Edit: May 09, 2010, 01:16:18 pm by Lazarususer6789 »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: how do i import ocx
« Reply #2 on: May 04, 2010, 09:49:03 am »
Using OCX controls with Lazarus is not a well established technology and not recommended for a beginner. It still needs to be researched as far as I know and therefore should require considerable work to get working.

On the other hand you have to consider that OCX controls are both obsolete (VB 6 is also obsolete) and Windows only. Also consider that there are lot's of existing components for Lazarus which are cross-platform, so it's better to ask how to achieve the functionality that the OCX control would provide.
« Last Edit: May 04, 2010, 09:54:53 am by felipemdc »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: how do i import ocx
« Reply #3 on: May 04, 2010, 07:40:04 pm »
I think there is no easy answer for this problem, it is a complex program that you are trying to create. You have to start reading the OCX documentation from Microsoft and search for what is necessary to achieve this.

Wodzu

  • Full Member
  • ***
  • Posts: 171
Re: how do i import ocx
« Reply #4 on: May 05, 2010, 06:32:24 am »
On the other hand you have to consider that OCX controls are both obsolete (VB 6 is also obsolete) and Windows only. Also consider that there are lot's of existing components for Lazarus which are cross-platform, so it's better to ask how to achieve the functionality that the OCX control would provide.

If they are obsolete then what is the replacement for them?
Actually, the argument that something is Windows only is a bit annoying.  ;D After all there are a lot of things that are platform specific and they are handled by the Lazarus.

Personally I think that ActiveX is a nice technology and in the spirit of RAD. Just an example from the real life:

Few weeks ago I've received a scales (I do not know if it's a correct english word - by "scales" I mean device to measure weight) which I need to program. Each measurment needed to be store in database. Without an ActiveX control which provides me GUI and events out of the box I would have to write own wrapper for the dll, own GUI and I would need to test it. How long would it take? For me few hours probably. How long it took me with already premade control? Few mintes - it was trivial.

Just my thoughts...  :)

picstart

  • Full Member
  • ***
  • Posts: 236
Re: how do i import ocx
« Reply #5 on: May 05, 2010, 07:50:22 pm »
No one has made  more Windows features obsolete than Microsoft. This addiction to making code non portable even between the many Microsoft platforms is in part the encouragement for alternative solutions like Lazarus. Much work is done in Lazarus to mediate the penchant for Microsoft to make portability insecure. Lazarus is probably more portable across Microsoft platforms than anything from Microsoft.It is a bit of an imposition to expect ocx support in Lazarus considering Microsoft is applauding its extinction. With Microsoft Os releases you get to learn a new way to do the same thing. With Lazarus to get to do the same thing on the new OS  without having to re-learn it.
« Last Edit: May 05, 2010, 08:00:16 pm by picstart »

Wodzu

  • Full Member
  • ***
  • Posts: 171
Re: how do i import ocx
« Reply #6 on: May 06, 2010, 07:30:21 am »
It is a bit of an imposition to expect ocx support in Lazarus considering Microsoft is applauding its extinction.

I do not impose to anyone anything. I am not expecting anything from people who are doing something for free. However, I think that the statement about OCX obsolation is untrue.

I was searching on google any information regarding this issue and haven't found a single article saying that ocx is dying.

For example: http://msdn.microsoft.com/en-us/library/aa751968%28v=VS.85%29.aspx.
I think Microsoft would mention it as it does in its articles.

So where did you read about this?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: how do i import ocx
« Reply #7 on: May 06, 2010, 08:26:26 am »
How do i put an Active X ocx into a lazarus :-)   :-\

Is your project commercial?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: Help with activex (WINDOWS)
« Reply #8 on: May 07, 2010, 05:29:36 pm »
Reporting your question on different boards won't give you more answers. Please stay on one topic
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Lazarususer6789

  • New Member
  • *
  • Posts: 15
Is there any Active X suport in Lazarus?
« Reply #9 on: May 12, 2010, 01:41:25 pm »
Is there any method of using an Active X (OCX) in Lazarus forms?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Is there any Active X suport in Lazarus?
« Reply #10 on: May 12, 2010, 02:05:36 pm »
I think that using COM Automation is a way of using ActiveX non-visual controls:

http://wiki.lazarus.freepascal.org/Office_Automation#Using_COM_Automation_to_interact_with_OpenOffice_and_Microsoft_Office

For using visual controls, did you already find, download and read ActiveX documentation as previously suggested?

Lazarususer6789

  • New Member
  • *
  • Posts: 15
Re: Is there any Active X suport in Lazarus?
« Reply #11 on: May 12, 2010, 02:33:37 pm »
I learned that a program wit Active X uses this info


File name Example "Activex1.ocx"
class id Example "920DFF5F-2EE6-4867-93A5-7BCF15B0F1C2"
what the control inside the ocx is called Example "Activexctl2"

My problem is how do i put this into lazarus
Do i use code or is there a menu?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Is there any Active X suport in Lazarus?
« Reply #12 on: May 13, 2010, 06:46:52 am »
There is no menu.

In Wikipedia you can read some more:

http://en.wikipedia.org/wiki/ActiveX

And there is a link to the source code of a simple ActiveX control in C++, which may also help understand how they work:

http://git.webvm.net/?p=afxsimple;a=tree

And here this C++ code could possibly load an ActiveX by code, although I am not 100% sure:

http://www.codersource.net/mfc/activex-com-dcom/custom-activex-control-in-mfc.aspx

And here an interresting discussion on the subject:

http://us.generation-nt.com/dynamically-loading-an-activex-com-dll-help-25478632.html

I have already said before that what you are trying to achieve isn't easy, so don't expect anyone to show a magic easy way. You will have to research a lot to achieve what you want.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: how do i import ocx
« Reply #13 on: May 13, 2010, 06:59:54 am »
If they are obsolete then what is the replacement for them?

ActiveX was a solution for cross-language and cross-technology objects and visual controls.

There is no replacement because the current trend by Microsoft and Apple as well is preventing cross-technology solutions. Microsoft would recommend that you drop all your current code completely and move to .NET instead.

Quote
Personally I think that ActiveX is a nice technology and in the spirit of RAD. Just an example from the real life:

Sure, but I was trying to give a working solution to the question.

Lazarususer6789

  • New Member
  • *
  • Posts: 15
Re: How do I import OCX / ActiveX Control
« Reply #14 on: May 14, 2010, 03:50:34 pm »
I was hoping somebody had made a menu that puts an Active X in the form

Any Way

i was searching in the Lazarus folder and found

C:\lazarus\fpc\2.0.4\units\i386-win32\winunits\activex.o
C:\lazarus\fpc\2.0.4\units\i386-win32\winunits\activex.ppu
C:\lazarus\fpc\2.0.4\units\i386-win32\winunits\libpactivex.a
C:\lazarus\fpc\2.0.4\source\packages\extra\winunits\activex.pp

I think they are what i am looking for but have no idea how to use them
I am new to lazarus so i dont know how to put into project or how to use them
if anyone knows how to use them how do i make this
_______________
|_Form______|X|
|  _________     |
|  | Active X |   |
|  |   Here    |   |
|  |________|   |
|_____________|
i have found an Active x ocx here http://ff24eva.0adz.com/vbp.7z

« Last Edit: May 14, 2010, 08:16:52 pm by Lazarususer6789 »