COMate - control COM objects via automation - OBSOLETE!

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

No that output seems fine.

Oh well whatever the problem is I don't think we'll ever get to the bottom of it! :) Just put it down to 'one of those things!'!!!

**EDIT : can you point me towards one of those virtual drivers (I need a Vista version though). If I can get one of them to misbehave on my machine then I may be able to shed some light on it.
I may look like a mule, but I'm not a complete ass.
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

srod wrote:Oh well whatever the problem is I don't think we'll ever get to the bottom of it! :) Just put it down to 'one of those things!'!!!
Yes, I also think that this will be the best. Spending too much time with this probably isn't worth the effort.
srod wrote:**EDIT : can you point me towards one of those virtual drivers (I need a Vista version though). If I can get one of them to misbehave on my machine then I may be able to shed some light on it.
I've sent you a PM with the regarding information, so you can play with it ... erm ... I mean do some research. :-)

Thank you so much for your efforts!!

Regards, Little John
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

ADO demo added. 8th Nov. 2008.
I have translated (and added to the COMate package) Kiffi's PureDispHelper example for creating and adding/retrieving records from/to an OLE DB source using ADO. Also included is Kiffi's 'ado constants' file which will be required.

This is the first time I have used ADO with PB and I have to say it is nice. I likes it! :wink:

I am going to create a simple wrapper around ADO to allow for easy access to the basic commands etc. Shouldn't take too long. The wrapper will of course use COMate.

See the nxSoftware site for the download.
I may look like a mule, but I'm not a complete ass.
User avatar
graves
Enthusiast
Enthusiast
Posts: 160
Joined: Wed Oct 03, 2007 2:38 pm
Location: To the deal with a pepper

Post by graves »

Hi, srod,
I've a problem with COMate type-modifiers on EXCEL

if I send this line:

Code: Select all

ExcelObject\SetProperty("Cells(1,1) = '001' AS STRING")
EXCEL assigns a NUMERIC format to cell, but I need to assign a TEXT format to it.
There is some solution?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Well you are at the mercy of Excel there. You can either use some method/property or other to set the format of the cell or use an apostrophe!!! Any cell entry beginning with an apostrophe is formatted as text by Excel.

Code: Select all

ExcelObject\SetProperty("Cells(1,1) = '$0027001'") 
The $0027 escape sequence is used to insert the apostrophe.
I may look like a mule, but I'm not a complete ass.
User avatar
graves
Enthusiast
Enthusiast
Posts: 160
Joined: Wed Oct 03, 2007 2:38 pm
Location: To the deal with a pepper

Post by graves »

Thanks, srod.
I've tried it and it runs.
With an apostrophe, Excel treats numbers like text. But it marks all cells with a little green triangle. (Excel 2003). :?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Yes that is a bit of a pain.

As I say the alternative is to format the cell as text by using the appropriate methods.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Here you are :

Code: Select all

ExcelObject\SetProperty("Cells(1,1) = 001")
ExcelObject\SetProperty("Cells(1,1)\NumberFormat = '@'")
Or set a range of cells :

Code: Select all

ExcelObject\SetProperty("Cells(1,1) = 001")
ExcelObject\SetProperty("Range('A1:B10')\NumberFormat = '@'")
etc.
I may look like a mule, but I'm not a complete ass.
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Post by Nico »

Hello,

In the example AnimatedGif. AniGif, how changed the background color?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Edit the .gif file!

If you want to color the container then you'll have to subclass it because the ATL library will already have done that, meaning that PB's coloring commands are being bypassed. I am unsure what will happen if you subclass an ATL control?
I may look like a mule, but I'm not a complete ass.
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Post by Nico »

OleView gives me this:

Code: Select all

        HRESULT CopyTransImage();
        [id(0x60030003)]
        HRESULT LoadFile(
                        [in] BSTR FileName, 
                        [in] VARIANT_BOOL DoNotStart);
        [id(0x60030006)]
        HRESULT StopAnimate(
                        [in] VARIANT_BOOL StopAtFirstFrame, 
                        [in] VARIANT_BOOL StopAtOnce);
        [id(0x60030007)]
        HRESULT RestartAnimate();
        [id(0x60030008)]
        HRESULT NextFrame();
        [id(0x68030001), propput]
        HRESULT BackColor([in] OLE_COLOR rhs);
        [id(0x68030000), propget]
        HRESULT TimerStatus([out, retval] VARIANT_BOOL* );
        [id(0x6003000c)]
        HRESULT FinishCycleFast();
But I do not manage to use BackColor ?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Ah I see - sorry! My apologies.

Code: Select all

color = #Blue
GifObject\SetProperty("BackColor = " + Str(color))
Works fine here.
I may look like a mule, but I'm not a complete ass.
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Post by Nico »

Thanks Srod!
User avatar
graves
Enthusiast
Enthusiast
Posts: 160
Joined: Wed Oct 03, 2007 2:38 pm
Location: To the deal with a pepper

Post by graves »

srod wrote:Here you are :

Code: Select all

ExcelObject\SetProperty("Cells(1,1) = 001")
ExcelObject\SetProperty("Cells(1,1)\NumberFormat = '@'")
Or set a range of cells :

Code: Select all

ExcelObject\SetProperty("Cells(1,1) = 001")
ExcelObject\SetProperty("Range('A1:B10')\NumberFormat = '@'")
etc.
Wow, It Runs!!!

Tanks, again
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

graves wrote: Wow, It Runs!!!
Of course it does my old mucka! :wink:
I may look like a mule, but I'm not a complete ass.
Post Reply