Common Object Model (COM) Dlls.
-
- New User
- Posts: 1
- Joined: Fri May 31, 2013 2:21 pm
- Location: Cape Town, South Africa
Common Object Model (COM) Dlls.
High everyone, I'm new here. I've been a Basic programmer for 15+ years - all with MS software.
I want to move to Pure Basic but ...
As well as development in Basic, I manage 3 HTA scripted desktop systems, which all use
my own COM dlls. As I'm sure you know, Javascript, vbscript and powershell cannot
address the winapi directly, only through COM DLLs using CreateObject.
So whether I like it or not, I need a COM dll compile facility.
Does Pure Basic have this capability ? I've searched through the documentation and, bearing in
mind I'm not familiar with the product or it's specific terminology, I can find nothing which
specifically addresses the issue.
Hoping for a positive answer
Flux Capacitor ...
I want to move to Pure Basic but ...
As well as development in Basic, I manage 3 HTA scripted desktop systems, which all use
my own COM dlls. As I'm sure you know, Javascript, vbscript and powershell cannot
address the winapi directly, only through COM DLLs using CreateObject.
So whether I like it or not, I need a COM dll compile facility.
Does Pure Basic have this capability ? I've searched through the documentation and, bearing in
mind I'm not familiar with the product or it's specific terminology, I can find nothing which
specifically addresses the issue.
Hoping for a positive answer
Flux Capacitor ...
Re: Common Object Model (COM) Dlls.
Hi FluxCapacitor
First of all, PureBasic is not the best decision, if you want to use mainly Com. I'm not sure, what are you looking for. If you want to invoke Com objects, search in the forum for ComatePlus. If you want to create a Com Dll, have a look here.
Further informations see here
Josh
First of all, PureBasic is not the best decision, if you want to use mainly Com. I'm not sure, what are you looking for. If you want to invoke Com objects, search in the forum for ComatePlus. If you want to create a Com Dll, have a look here.
Further informations see here
Josh
sorry for my bad english
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
Josh wrote:Hi FluxCapacitor
First of all, PureBasic is not the best decision, if you want to use mainly Com. I'm not sure, what are you looking for. If you want to invoke Com objects, search in the forum for ComatePlus. If you want to create a Com Dll, have a look here.
Further informations see here
Josh
So, in order to invoke some of the methods in a third-party Com Component, we need to use ComatePlus, or something similar? There is no CreateObject() or something similar in Purebasic? ( I already tried, and PB doesn't understand CreateObject() )
Re: Common Object Model (COM) Dlls.
PureBasic isnt object oriented, so COM isnt realy in the scope of the language. You can use it by doing all by hand. You have basic support with the interface structure.PBExplorer12 wrote: So, in order to invoke some of the methods in a third-party Com Component, we need to use ComatePlus, or something similar? There is no CreateObject() or something similar in Purebasic? ( I already tried, and PB doesn't understand CreateObject() )
Or you use a allready developed system like ComatePlus, which will do all the COM related stuff for you.
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
Thorium wrote:PureBasic isnt object oriented, so COM isnt realy in the scope of the language. You can use it by doing all by hand. You have basic support with the interface structure.PBExplorer12 wrote: So, in order to invoke some of the methods in a third-party Com Component, we need to use ComatePlus, or something similar? There is no CreateObject() or something similar in Purebasic? ( I already tried, and PB doesn't understand CreateObject() )
Or you use a allready developed system like ComatePlus, which will do all the COM related stuff for you.
Yes, I understand about keeping PureBasic 'pure', in the sense of keeping it procedural.
Unfortunately, I haven't been able to get ComatePlus to make use of some third party Parsing components, that have support for quoted strings. No matter how much pre-manipulation is done to a string - Inserting Chr(34)s or Chr(39)s, escaping quotes, all sorts of tricks - the ComatePlus Invoke() keeps returning the
' one or more arguments are invalid' type of message. Whereas if the function is called from other languages with internal COM support, it works fine.
Anyway, I'm going to try the regular expression route, for this. I'll take a look at ComatePlus for other things.
Re: Common Object Model (COM) Dlls.
please post some code. Perhaps we see, what's going wrong.PBExplorer12 wrote:' one or more arguments are invalid' type of message.
Greetings ... Kiffi
Hygge
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
Kiffi wrote:please post some code. Perhaps we see, what's going wrong.PBExplorer12 wrote:' one or more arguments are invalid' type of message.
Greetings ... Kiffi
Absolutely. Will put something out there, over the weekend. However, although it's clear how to attach an image, I'm not sure how to attach a Zip or dll or ocx file to a thread, for illustration.
Re: Common Object Model (COM) Dlls.
Store the files somewhere offsite (of the forum), i.e. Dropbox, and use:PBExplorer12 wrote:However, although it's clear how to attach an image, I'm not sure how to attach a Zip or dll or ocx file to a thread, for illustration.

This is also useful to link to other threads in the forum.
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
Demivec wrote:Store the files somewhere offsite (of the forum), i.e. Dropbox, and use:PBExplorer12 wrote:However, although it's clear how to attach an image, I'm not sure how to attach a Zip or dll or ocx file to a thread, for illustration.
This is also useful to link to other threads in the forum.
Well, I'm trying to create the simplest ole server, and the simplest Test pb code which will illustrate the COMatePlus issue. But am getting an error, in the COMatePlus.pbi code, that wasn't there before.
When you do a syntax check, it chokes on line 1838,
errorCode = COMatePLUS_CompileSubobjectInvokation(*hStatement, subObject, @parse())
, and returns the error
Bad parameter type: an array is expected.
I don't get it. I copied the .PBIs, directly from a pb project folder, that was compiling fine.
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
"
Well, I'm trying to create the simplest ole server, and the simplest Test pb code which will illustrate the COMatePlus issue. But am getting an error, in the COMatePlus.pbi code, that wasn't there before.
When you do a syntax check, it chokes on line 1838,
errorCode = COMatePLUS_CompileSubobjectInvokation(*hStatement, subObject, @parse())
, and returns the error
Bad parameter type: an array is expected.
I don't get it. I copied the .PBIs, directly from a pb project folder, that was compiling fine.[/quote]
"
Never mind. There was a similar post about the same problem, and the advice was to remote the '@'.
Still kinda unusual that the code - WITH the '@' - works fine in the previous module. Whatever, the error is gone now.
Well, I'm trying to create the simplest ole server, and the simplest Test pb code which will illustrate the COMatePlus issue. But am getting an error, in the COMatePlus.pbi code, that wasn't there before.
When you do a syntax check, it chokes on line 1838,
errorCode = COMatePLUS_CompileSubobjectInvokation(*hStatement, subObject, @parse())
, and returns the error
Bad parameter type: an array is expected.
I don't get it. I copied the .PBIs, directly from a pb project folder, that was compiling fine.[/quote]
"
Never mind. There was a similar post about the same problem, and the advice was to remote the '@'.
Still kinda unusual that the code - WITH the '@' - works fine in the previous module. Whatever, the error is gone now.
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
"Store the files somewhere offsite (of the forum), i.e. Dropbox, and use:
...
This is also useful to link to other threads in the forum."
So, in the attached, there are 2 simple projects (a PB and a VB6 version) which make use of the simplified Harbour oleserver hbTokenUdfs.dll.
The idea is to extract the number of tokens from a string, using the Harbour token count function HB_TokenCount().
The PB version generates an error, on every INVOKation:
"One or more arguments are invalid. Possibly a numerical overflow or too many nested objects, -if so, try splitting your method call into two or more subcalls."
the VB6 version takes the string:
sMessage := "Hi, WELcome to FANtasy Island!"
, and correctly returns 3 tokens, representing
sMessage
:=
"Hi, WELcome to FANtasy Island!"
The sample projects are located at
https://dl.dropboxusercontent.com/u/584 ... 130825.zip
The fact that Invoke returns only a Success or Failure value, and NOT the value of the method that's INVOKed, make it more difficult to debug, as you would with another language. But even if you call the INVOKE as a simple proc, then try to get the return value from a Property, you never get to first base, because INVOKE() doesn't seem to work with certain types of string parameters.
...
This is also useful to link to other threads in the forum."
So, in the attached, there are 2 simple projects (a PB and a VB6 version) which make use of the simplified Harbour oleserver hbTokenUdfs.dll.
The idea is to extract the number of tokens from a string, using the Harbour token count function HB_TokenCount().
The PB version generates an error, on every INVOKation:
"One or more arguments are invalid. Possibly a numerical overflow or too many nested objects, -if so, try splitting your method call into two or more subcalls."
the VB6 version takes the string:
sMessage := "Hi, WELcome to FANtasy Island!"
, and correctly returns 3 tokens, representing
sMessage
:=
"Hi, WELcome to FANtasy Island!"
The sample projects are located at
https://dl.dropboxusercontent.com/u/584 ... 130825.zip
The fact that Invoke returns only a Success or Failure value, and NOT the value of the method that's INVOKed, make it more difficult to debug, as you would with another language. But even if you call the INVOKE as a simple proc, then try to get the return value from a Property, you never get to first base, because INVOKE() doesn't seem to work with certain types of string parameters.
Re: Common Object Model (COM) Dlls.
Code: Select all
sTestString = " what the heck " + "," + "why, you" + "," + "you dirty rat"
Debug sTestString
Debug oOleServerTest\GetIntegerProperty( "GetNumberOfTokens('" + sTestString + "')" )
Debug COMate_GetLastErrorDescription()
Greetings ... Kiffi
Hygge
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
Kiffi wrote:HTHCode: Select all
sTestString = " what the heck " + "," + "why, you" + "," + "you dirty rat" Debug sTestString Debug oOleServerTest\GetIntegerProperty( "GetNumberOfTokens('" + sTestString + "')" ) Debug COMate_GetLastErrorDescription()
Greetings ... Kiffi
Ah, ok. So the Get...Property() in CoMate methods actually work on the the component's methods, as opposed to just returning attributes.
Very good, thanks.
Re: Common Object Model (COM) Dlls.
yes, the same way you do it with VB6:PBExplorer12 wrote:Ah, ok. So the Get...Property() in CoMate methods actually work on the the component's methods, as opposed to just returning attributes.
Code: Select all
nResult = oTokenTest.GetNumberOfTokens(sTestString) ' Returns 8
Hygge
-
- User
- Posts: 59
- Joined: Sun Jul 21, 2013 8:30 am
Re: Common Object Model (COM) Dlls.
"yes, the same way you do it with VB6"
Well, I guess it depends on how you look at it. But I think calling Get Integer/String/etc Property(), with a method name & its parameters as a parameter, looks very different syntactically, from calling the method directly.
Anyway, thanks for the help, Kiffi. Back on track, here.
Well, I guess it depends on how you look at it. But I think calling Get Integer/String/etc Property(), with a method name & its parameters as a parameter, looks very different syntactically, from calling the method directly.
Anyway, thanks for the help, Kiffi. Back on track, here.