COM object support

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

COM object support

Post by KIKI »

It woul be a great thing if PB support com object like in Visual Basic.
I know that there were Comate object , but comate object is hard to understand.
If we can use object like in VB PB will be the best for programming witout any contest
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: COM object support

Post by Fred »

I seriously doubt it would change the "best programming language" stuff for linux and OS X users :lol:
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Re: COM object support

Post by KIKI »

Fred wrote:I seriously doubt it would change the "best programming language" stuff for linux and OS X users :lol:
I agree with you but most of the programmers use Windows for business application and the only things that isn't good in PB for concuurencing VB is accessing easyli to com object
User avatar
Kiffi
Addict
Addict
Posts: 1486
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: COM object support

Post by Kiffi »

Fred wrote:I seriously doubt it would change the "best programming language" stuff for linux and OS X users :lol:
so 90% of all PureBasic programmers can not code COM in a
comfortable (native) way, because the remaining 10% are
using a different os?

Greetings ... Kiffi
Hygge
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: COM object support

Post by freak »

You are assuming that all Windows users want to use COM, which i doubt very much.
quidquid Latine dictum sit altum videtur
User avatar
Kiffi
Addict
Addict
Posts: 1486
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: COM object support

Post by Kiffi »

freak wrote:You are assuming that all Windows users want to use COM, which i doubt very much.
the interest in using COM is quite high (just see the activity in threads
about COMate, PureDispHelper and your postings about using COM).

And i prognosticate a much higher participation if PB supports COM officially.

Greetings ... Kiffi
Hygge
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: COM object support

Post by freak »

Well, we'd have to make some fundamental changes to the language to have "real" support for it. And we are not going to do that because it just doesn't fit the crossplatform design to have a large part of the language focus on a single, non-crossplatform technology. Yes, Windows makes up the largest parts of the userbase, but that doesn't change the fact that PureBasic is a crossplatform language (if it weren't, there would not be a Windows version either).
quidquid Latine dictum sit altum videtur
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COM object support

Post by srod »

Must admit that I avoid using COM unless I absolutely have to. :)
I may look like a mule, but I'm not a complete ass.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: COM object support

Post by Trond »

If we can use object like in VB
How does VB use com objects?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COM object support

Post by srod »

You add a reference to a type library to your project and then you can use the objects defined therein in your project etc. The compiler will typically build vTables dynamically as required based on the info gleamed from the type-lib, but will proceed via iDispatch if the vTables cannot be built and the component exposes iDispatch etc. or the developer specifically requests that automation is used.

In order for PB to support that level of COM integration.... well it would be a huge huge undertaking. VB wraps up all parameters as appropriate (variants, safe-arrays etc.) and handles nested object calls as well as object parameters. And then there is the garbage collection...

For this level of integration ... use VB! :wink:
I may look like a mule, but I'm not a complete ass.
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: COM object support

Post by skywalk »

Hi Srod,
Not that I'm complaining...But how or why did COMate(Plus) ever get written?
Instead of suggesting we use VB, shouldn't we really just say NO to VB.NET?
...
I agree with you in that I try not to use ActiveX objects and opt for DLLs when available.
However, some electronic equipment I must automate only offers ActiveX controls.
They are dwindling in number now, and I hope your COMatePlus tool will help as I convert from VB6 to PB.

To Fred and Freak,
I appreciate your direct answers on these topics.
It is just as important to know where PureBasic is going, than what features(and bugs) already exist.
My request would be an updated blog of "what's next". :)

Thanks for a great development tool!
Last edited by skywalk on Tue Feb 12, 2013 12:59 am, edited 1 time in total.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COM object support

Post by srod »

COMate arose out of an original need of mine to use ADO and it was, for me, a good way in to COM. Call it a learning experience if you like.

Use the best tool for the job, and if quick and easy access to COM objects is required then you can not go far wrong with VB. I am no great fan of VB, but I can recognise it's strengths easily enough. As I see it, there is little point complaining about PB's apparent lack of COM support when it was never intended to be a VB clone. Tools like COMate are there to be used and there is little you can do with VB automation that you cannot do with COMate (and almost as easily - though not quite! :) )

Just my opinion.
I may look like a mule, but I'm not a complete ass.
punak
User
User
Posts: 81
Joined: Tue Sep 07, 2021 12:08 pm

Re: COM object support

Post by punak »

Fred, do you still have the 2010 belief about adding com objects?
what's wrong with adding a few more functions to pb to run only on Windows?
You have already done this:
SetWindowCallback(@ProcedureName() [, #Window])
It's only supported on Microsoft Windows.

EventlParam() and EventwParam() and ClearConsole() and
SmartWindowRefresh(#Window, State) and ConsoleCursor(Height) and
ConsoleLocate(x, y) and ConsoleTitle(Title$) and GadgetItemID(#Gadget, Item) and
GetFunctionEntry(#Library, FunctionEntry) and GetSoundFrequency(#Sound [, Channel]) and
InitScintilla([LibraryName$]) and KeyboardMode(Flags) and ThreadPriority(Thread, Priority) and
MDIGadget(#Gadget, x, y, Width, Height, SubMenu, MenuItem [, Flags]) and MouseWheel() and ...

Supported OS

Windows
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: COM object support

Post by Fred »

All these are minor functions, while built-in COM support would be very hard to do. You can use COMate which fills the gap.
User avatar
jacdelad
Addict
Addict
Posts: 1993
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: COM object support

Post by jacdelad »

Not complaining, but nothing, that COMate isn't easy to use.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Post Reply